Fix building when HOST is set (e.g. to hostname) #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried building this on openSUSE Leap 15.2, and there were several failures related to
reallocarray
,UID_MAX
,GID_MAX
,setresuid
,setresgid
, andexecvpe
. Diving into to reallocarray(), I noticedconfigure
reported it as being present, but the man page indicates it requires_GNU_SOURCE
. (I have glibc 2.26, which lacks the reference to_DEFAULT_SOURCE
.)While working up a patch for that, I discovered that configure should've already set both
_GNU_SOURCE
and_DEFAULT_SOURCE
on Linux, but was not doing so. In fact it was settingOS_CFLAGS=-D__earth.lan__
, which looked suspiciously like part of my internal domain! I traced that here, and sure enough, my system has $HOST set to my FQDN (e.g. frodo.middle-earth.lan).[open]SUSE's /etc/profile sets HOST=$(uname -n) (aka hostname), and has done so since 2010 according to the git history. This completely breaks everything the configure script derives from $HOST.
As a naïve fix, I've renamed the HOST variable to HOSTCC, and that fixed all the build issues. Perhaps doing something like
unset HOST BUILD TARGET
to force the user to use the configure options--host=
etc. would be preferable, but I don't know...Unrelated: Linux has long supported 32-bit UID/GIDs (which might be encountered in domain environments, e.g. sssd), but you default to UID_MAX=65535. I could of course call
./configure --uid-max=4294967295 --gid-max=4294967295
, but I feel like I shouldn't have to. Does anything still use 16-bit UIDs these days?(Actually
--gid-max
doesn't work, as due to a typo that sets UID_MAX again. Oops!)Thanks for your work porting doas and for trying to take security seriously!