Skip to content

Commit

Permalink
build-sys: Ensure systemd-sysv-install symlink does not have //
Browse files Browse the repository at this point in the history
See: ostreedev/ostree-rs-ext#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.
  • Loading branch information
cgwalters authored and jamacku committed Dec 10, 2021
1 parent bb3efc1 commit 6bdf001
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -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
Expand Down

0 comments on commit 6bdf001

Please sign in to comment.