]> The Tcpdump Group git mirrors - tcpdump/commit
Autoconf: Get --with-user and --with-chroot right. [skip appveyor]
authorDenis Ovsienko <[email protected]>
Sat, 22 Jul 2023 12:50:16 +0000 (13:50 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 13 Oct 2023 08:52:16 +0000 (10:52 +0200)
commite6e2db1ca398a11fabd27bac2a81f110c7b2de06
tree36381b1f420aa74cdeae594ad6801c74c295bfa4
parent46e3bdae96a220f0407a7bad2c3c15710c7d07ad
Autoconf: Get --with-user and --with-chroot right.  [skip appveyor]

As Francois-Xavier points it out, my commit 3aa6574 fixed one bug, but
introduced another: running "./configure --with-gcc" also erroneously
takes the --with-user code path because withval is set to "yes" after
the --with-gcc block:

./configure --with-gcc
[...]
checking whether to drop root privileges by default... configure:
  error: --with-user requires a username

The matter is, in Autoconf AC_ARG_WITH() without ation-if-not-given
assigns withval only if with_xxxx is set to any value (including an
empty string), so make sure withval is always set in AC_ARG_WITH() and
spell all possible withval values in AS_CASE(), this way regardless of
any other options the behaviour is correct.

Rejected:
--with-user
--with-user=
--with-user=yes
--with-chroot
--with-chroot=
--with-chroot=yes

Accepted:
--without-user
--with-user=no
--with-user=someuser
--without-chroot
--with-chroot=no
--with-chroot=/somedir

(cherry picked from commit df376cdfb5aca21ffb516e9b4ae9cccf0da4d166)

Moreover:
Run autoreconf2.69 -f.
configure
configure.ac