From 6bdf001168f14dfc00fd3596a28a7696dbbda8cc Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 10 Dec 2021 11:05:41 -0500 Subject: [PATCH] build-sys: Ensure `systemd-sysv-install` symlink does not have `//` See: https://github.com/ostreedev/ostree-rs-ext/pull/182 In https://github.com/ostreedev/ostree we generate a cryptographic checksum over files and symlinks, and directories. ostree does not currently perform any canonicalization on symlinks; we'll respect and honor whatever bytes we're provided as input, and replicate that on the target. We're using the Rust tar crate to do tar serialization, which has so far worked fine...except, I hit this corner case: ``` [root@cosa-devsh ~]# rpm -qf /usr/lib/systemd/systemd-sysv-install chkconfig-1.13-2.el8.x86_64 [root@cosa-devsh ~]# ll /usr/lib/systemd/systemd-sysv-install lrwxrwxrwx. 2 root root 24 Nov 29 18:08 /usr/lib/systemd/systemd-sysv-install -> ../../..//sbin/chkconfig [root@cosa-devsh ~]# ``` But, using `set_link_name` to write the tarball, we end up with the canonicalized path `../../../sbin/chkconfig` - i.e. without the double `//`. This breaks the checksum. Now, I am a bit tempted to change ostree to do canonicalization. But even if we did, I'd need to *exactly* match what tar-rs is doing. For the record, this is *the only* non-canonical symlink in Fedora and RHEL CoreOS today. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 95d36138..146960b8 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,7 @@ install: [ -d $(DESTDIR)/$(SYSTEMDUTILDIR) ] || mkdir -p -m 755 $(DESTDIR)/$(SYSTEMDUTILDIR) install -m 755 $(PROG) $(DESTDIR)/$(SBINDIR)/$(PROG) - ln -s ../../../$(SBINDIR)/$(PROG) $(DESTDIR)/$(SYSTEMDUTILDIR)/systemd-sysv-install + ln -s ../../..$(SBINDIR)/$(PROG) $(DESTDIR)/$(SYSTEMDUTILDIR)/systemd-sysv-install install -m 755 ntsysv $(DESTDIR)/$(SBINDIR)/ntsysv install -m 755 alternatives $(DESTDIR)/$(SBINDIR)/alternatives