crun icon indicating copy to clipboard operation
crun copied to clipboard

rpm: Use relative, not absolute, symbolic links

Open debarshiray opened this issue 1 year ago • 2 comments

Currently, the Fedora Packaging Guidelines don't choose sides between absolute and relative symbolic links [1], but RPM does [2,3]. Building the crun RPM with absolute symlinks leads to:

  ...
  warning: absolute symlink: /usr/bin/krun -> /usr/bin/crun
  ...
  warning: absolute symlink: /usr/bin/crun-wasm -> /usr/bin/crun
  ...
  RPM build warnings:
    absolute symlink: /usr/bin/krun -> /usr/bin/crun
    absolute symlink: /usr/bin/crun-wasm -> /usr/bin/crun
  ...

Given the prevalence of chroot-like environments these days due to bind mounts in containers, relative symbolic links do look like the better alternative, and various prominent parts of the operating system already use them. Some examples:

  • /etc/localtime -> ../usr/share/zoneinfo/Europe/Prague
  • /etc/mtab -> ../proc/self/mounts
  • /etc/os-release -> ../usr/lib/os-release
  • /usr/bin/dnf -> dnf-3
  • /usr/bin/ghostscript -> /usr/bin/gs
  • /usr/bin/gpg2 -> gpg
  • /usr/bin/python -> ./python3
  • /usr/bin/python3 -> python3.11
  • /usr/bin/qemu-kvm -> qemu-system-x86_64
  • /usr/bin/systemd-resolve -> resolvectl
  • /usr/bin/systemd-umount -> systemd-mount
  • /usr/bin/traceroute6 -> traceroute
  • /usr/bin/unxz -> xz

[1] https://docs.fedoraproject.org/en-US/packaging-guidelines/#_symlinks

[2] https://github.com/rpm-software-management/rpm/issues/668

[3] https://github.com/rpm-software-management/rpm/issues/2419

debarshiray avatar Feb 13 '24 22:02 debarshiray

@lsm5 PTAL

giuseppe avatar Feb 14 '24 12:02 giuseppe

@lsm5 can we merge this one?

giuseppe avatar Feb 20 '24 12:02 giuseppe

Thanks, @giuseppe & @lsm5

debarshiray avatar Feb 21 '24 14:02 debarshiray