sestatus: avoid self-referential symlink
Stephen Smalley
maintainerPATCH 1/1 sestatus: avoid self-referential symlink
From: Joe-Ju-Alpha <[email protected]>
--- policycoreutils/sestatus/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
policycoreutils/sestatus/Makefile +3 -2
@@ -28,10 +28,11 @@ install: all [ -d $(DESTDIR)$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)$(MANDIR)/man5 -mkdir -p $(DESTDIR)$(BINDIR) -mkdir -p $(DESTDIR)$(SBINDIR) +ifneq ($(BINDIR),$(SBINDIR)) # Some tools hard code /usr/sbin/sestatus ; add a compatibility symlink - # install will overwrite a symlink, so create the symlink before calling - # install to allow distributions with BINDIR == SBINDIR + # install will overwrite a symlink, so create it before installing. ln -sf --relative $(DESTDIR)$(BINDIR)/sestatus $(DESTDIR)$(SBINDIR) +endif install -m 755 sestatus $(DESTDIR)$(BINDIR) install -m 644 sestatus.8 $(DESTDIR)$(MANDIR)/man8 install -m 644 sestatus.conf.5 $(DESTDIR)$(MANDIR)/man5
Signature · 1 line
2.55.0
Stephen Smalley
maintainerQuoted 2 lines · Stephen Smalley
From: Joe-Ju-Alpha <[email protected]>
See below. In addition, it would be good if the patch description / commit message had a non-empty body that says which install breaks - GNU coreutils works fine here without your patch, so presumably your use case is busybox or toybox install. Lastly, this still doesn't cover the case where SBINDIR=/usr/sbin but the on-disk /usr/sbin is a symlink to bin (usrmerge, no DESTDIR); textually unequal so ln still runs, still relies on install-overwrites ala GNU coreutils install. Not a regression so up to you but it remains uncovered.
Quoted 11 lines
Signed-off-by Joe-Ju-Alpha <[email protected]>--- policycoreutils/sestatus/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)policycoreutils/sestatus/Makefile +0
-0
policycoreutils/sestatus/Makefile install: all · line 33
Quoted 8 lines
policycoreutils/sestatus/Makefile +2
-2@@ -28,10 +28,11 @@ install: all [ -d $(DESTDIR)$(MANDIR)/man5 ] || mkdir -p $(DESTDIR)$(MANDIR)/man5 -mkdir -p $(DESTDIR)$(BINDIR) -mkdir -p $(DESTDIR)$(SBINDIR) +ifneq ($(BINDIR),$(SBINDIR)) # Some tools hard code /usr/sbin/sestatus ; add a compatibility symlink - # install will overwrite a symlink, so create the symlink before calling - # install to allow distributions with BINDIR == SBINDIR + # install will overwrite a symlink, so create it before installing.
This comment is no longer relevant, right, because you are now preventing creation of the symlink if BINDIR==SBINDIR.
Quoted 8 lines
policycoreutils/sestatus/Makefile +1
-1ln -sf --relative $(DESTDIR)$(BINDIR)/sestatus $(DESTDIR)$(SBINDIR) +endif install -m 755 sestatus $(DESTDIR)$(BINDIR) install -m 644 sestatus.8 $(DESTDIR)$(MANDIR)/man8 install -m 644 sestatus.conf.5 $(DESTDIR)$(MANDIR)/man5 --2.55.0