Skip to content

Commit

Permalink
build: Normalize HAVE_SUID
Browse files Browse the repository at this point in the history
See commit 15d7938 ("Try to fix #2310 -- Can't create run directory
without suid-root", 2021-05-13) / PR #4273.

It is the only "HAVE_" option whose value is set by if/else on a
makefile.  Also, it is set in different places to either "yes", "no",
blank or "-DHAVE_SUID".  Set the value only on configure.ac and only to
either blank or to "-DHAVE_SUID".

Misc: The `ifeq ($(HAVE_SUID),-DHAVE_SUID)` comparison that this adds is
based on the existing `ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR)`
comparison on Makefile.in.
  • Loading branch information
kmk3 committed Nov 25, 2021
1 parent c84dc09 commit 6d42e13
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ realinstall:
# firejail executable
install -m 0755 -d $(DESTDIR)$(bindir)
install -m 0755 src/firejail/firejail $(DESTDIR)$(bindir)
ifeq ($(HAVE_SUID),yes)
ifeq ($(HAVE_SUID),-DHAVE_SUID)
chmod u+s $(DESTDIR)$(bindir)/firejail
endif
# firemon executable
Expand Down
9 changes: 4 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3757,10 +3757,9 @@ if test "${enable_suid+set}" = set; then :
enableval=$enable_suid;
fi
if test "x$enable_suid" = "xno"; then :
HAVE_SUID="no"
else
HAVE_SUID="yes"
if test "x$enable_suid" != "xno"; then :
HAVE_SUID="-DHAVE_SUID"
fi
Expand Down Expand Up @@ -3854,7 +3853,7 @@ if test "x$enable_lts" = "xyes"; then :
HAVE_USERNS=""
HAVE_X11=""
HAVE_FILE_TRANSFER=""
HAVE_SUID="yes"
HAVE_SUID="-DHAVE_SUID"
BUSYBOX_WORKAROUND="no"
HAVE_CONTRIB_INSTALL="no",
Expand Down
9 changes: 4 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,9 @@ HAVE_SUID=""
AC_SUBST([HAVE_SUID])
AC_ARG_ENABLE([suid],
[AS_HELP_STRING([--disable-suid], [install as a non-SUID executable])])
AS_IF([test "x$enable_suid" = "xno"],
[HAVE_SUID="no"],
[HAVE_SUID="yes"]
)
AS_IF([test "x$enable_suid" != "xno"], [
HAVE_SUID="-DHAVE_SUID"
])

HAVE_FATAL_WARNINGS=""
AC_SUBST([HAVE_FATAL_WARNINGS])
Expand Down Expand Up @@ -257,7 +256,7 @@ AS_IF([test "x$enable_lts" = "xyes"], [
HAVE_USERNS=""
HAVE_X11=""
HAVE_FILE_TRANSFER=""
HAVE_SUID="yes"
HAVE_SUID="-DHAVE_SUID"
BUSYBOX_WORKAROUND="no"
HAVE_CONTRIB_INSTALL="no",
])
Expand Down
6 changes: 1 addition & 5 deletions src/common.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ HAVE_FIRETUNNEL=@HAVE_FIRETUNNEL@
HAVE_PRIVATE_HOME=@HAVE_PRIVATE_HOME@
HAVE_GCOV=@HAVE_GCOV@
HAVE_SELINUX=@HAVE_SELINUX@
ifeq (@HAVE_SUID@, yes)
HAVE_SUID=-DHAVE_SUID
else
HAVE_SUID=
endif
HAVE_SUID=@HAVE_SUID@
HAVE_DBUSPROXY=@HAVE_DBUSPROXY@
HAVE_USERTMPFS=@HAVE_USERTMPFS@
HAVE_OUTPUT=@HAVE_OUTPUT@
Expand Down

0 comments on commit 6d42e13

Please sign in to comment.