Bug 260082 - sbin/ping fails if WITHOUT_INET and WITHOUT_INET6 are set
Summary: sbin/ping fails if WITHOUT_INET and WITHOUT_INET6 are set
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-27 23:11 UTC by Michael Dexter
Modified: 2023-09-24 15:50 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Dexter 2021-11-27 23:11:35 UTC
This commit appears to cause sbin/ping to fail of both the WITHOUT_INET and WITHOUT_INET6 build options are set:

https://github.com/freebsd/freebsd-src/commit/9ce201f2ee3ca340032d9cc71d91a36b3b45a4c3#diff-07afc5f05fc4879c80f36cee3bf6fdb5f19d233084824b8f517c18d205f6d23f

The error:

cc -target x86_64-unknown-freebsd14.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp
 -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin  -O2 -pipe -fno-common -DORDER   -DN
DEBUG -MD  -MF.depend.ealloc.o -MTealloc.o -std=gnu99 -Wno-format-zero-length -n
obuiltininc -idirafter /usr/lib/clang/11.0.1/include -Qunused-arguments   -c /us
r/src/sbin/rcorder/ealloc.c -o ealloc.o
--- all_subdir_sbin/ping ---
/usr/src/sbin/ping/main.c:83:38: error: expected ')'
        while ((ch = getopt(argc, argv, ":" OPTSTR)) != -1) {
                                            ^
/usr/src/sbin/ping/main.c:83:21: note: to match this '('
        while ((ch = getopt(argc, argv, ":" OPTSTR)) != -1) {
                           ^
1 error generated.

Reverting to the previous commit of /usr/src/sbin/ping/main.c does not produce the error.
Comment 1 Bjoern A. Zeeb freebsd_committer freebsd_triage 2021-11-28 13:40:23 UTC
It should simply not be built them and that is a thing for the upper level makefile.
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-11-28 18:08:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=a4ef9e58bc0c07110a54ba0fa88eb118c5377e6f

commit a4ef9e58bc0c07110a54ba0fa88eb118c5377e6f
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-11-28 17:50:13 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-11-28 18:05:39 +0000

    sbin: build ping if at least one of INET & INET6 is enabled

    It does not build (and serves no purpose) if neither is true (i.e.,
    building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
    in ping to make this case clear.

    PR:             260082
    Sponsored by:   The FreeBSD Foundation

 sbin/Makefile    | 5 ++++-
 sbin/ping/main.c | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)
Comment 3 Kyle Evans freebsd_committer freebsd_triage 2021-11-28 18:10:48 UTC
Also probably needs some OptionalObsoleteFiles entries
Comment 4 Ed Maste freebsd_committer freebsd_triage 2021-11-28 19:43:29 UTC
(In reply to Kyle Evans from comment #3)
Addressed in:

commit 0179739a0096c62cb3c9665d68246046255ab849
Author: Ed Maste <emaste@FreeBSD.org>
Date:   Sun Nov 28 13:23:29 2021 -0500

    OptionalObsoleteFiles: remove ping with INET & INET6 disabled
    
    Reported by:    kevans
    Fixes:          a4ef9e58bc0c ("sbin: build ping if at least one of...")
    Sponsored by:   The FreeBSD Foundation
Comment 5 Michael Dexter 2021-11-29 00:11:49 UTC
Fix confirmed! Thank you!
Comment 6 commit-hook freebsd_committer freebsd_triage 2021-12-13 01:29:56 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0f0d52fd6ae71657ea0797338e633696c1c3567d

commit 0f0d52fd6ae71657ea0797338e633696c1c3567d
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-11-28 17:50:13 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-12-13 01:28:58 +0000

    sbin: build ping if at least one of INET & INET6 is enabled

    It does not build (and serves no purpose) if neither is true (i.e.,
    building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
    in ping to make this case clear.

    PR:             260082
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit a4ef9e58bc0c07110a54ba0fa88eb118c5377e6f)

    OptionalObsoleteFiles: remove ping with INET & INET6 disabled

    Reported by:    kevans
    Fixes:          a4ef9e58bc0c ("sbin: build ping if at least one of...")
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit 0179739a0096c62cb3c9665d68246046255ab849)

 sbin/Makefile                            | 5 ++++-
 sbin/ping/main.c                         | 2 ++
 tools/build/mk/OptionalObsoleteFiles.inc | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-12-31 18:19:19 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=daf481f3d508e7497b456e8df7db17c90b623ee0

commit daf481f3d508e7497b456e8df7db17c90b623ee0
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-12-31 01:11:31 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2021-12-31 18:16:30 +0000

    rescue: include ping iff at least one of INET & INET6 is enabled

    Ping does not build (and serves no purpose) if neither is enabled
    (i.e., building WITHOUT_INET and WITHOUT_INET6).

    This is equvalent to a4ef9e58bc0c but for rescue/.

    PR:             260082
    Fixes:          a4ef9e58bc0c ("sbin: build ping if at least one of...")
    Sponsored by:   The FreeBSD Foundation

 rescue/rescue/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-09-24 15:50:19 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=db9863a7975ddc22609c07e7273790c852efd8b6

commit db9863a7975ddc22609c07e7273790c852efd8b6
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-12-31 01:11:31 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-09-24 15:48:33 +0000

    rescue: include ping iff at least one of INET & INET6 is enabled

    Ping does not build (and serves no purpose) if neither is enabled
    (i.e., building WITHOUT_INET and WITHOUT_INET6).

    This is equvalent to a4ef9e58bc0c but for rescue/.

    PR:             260082
    Fixes:          a4ef9e58bc0c ("sbin: build ping if at least one of...")
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit daf481f3d508e7497b456e8df7db17c90b623ee0)

 rescue/rescue/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)