Skip to content

Commit

Permalink
feat(dracut-install): convert_abs_rel: canonicalise parent of from, too
Browse files Browse the repository at this point in the history
This fixes, for example, .so versioning links:
  diff --git a/cur b/new3
  index 3804a347..22d089a9 100644
  --- a/cur
  +++ b/new3
  -Image: /boot/initrd.img-5.10.0-13-amd64: 15M
  +Image: initrd: 15M
  -console-setup
  -crw-rw-rw-   1 root     root       1,   3 date etc/console-setup/null
  -drwxr-xr-x  13 root     root            0 date etc
  +drwxr-xr-x  12 root     root            0 date etc
  -drwxr-xr-x   2 root     root            0 date etc/console-setup
  --rw-r--r--   1 root     root       122498 date etc/console-setup/cached_UTF-8_del.kmap
  --rw-r--r--   1 root     root         6240 date etc/ld.so.cache
  +-rw-r--r--   1 root     root         6308 date etc/ld.so.cache
  --rw-r--r--   1 root     root          152 Dec 15  2020 etc/udev/rules.d/10-console.rules
  --rwxr-xr-x   1 root     root        98048 Mar  3  2021 usr/bin/gzip
  --rwxr-xr-x   1 root     root        14976 Oct 11  2020 usr/bin/kbd_mode
  --rwxr-xr-x   1 root     root       220304 Oct 11  2020 usr/bin/loadkeys
  --rwxr-xr-x   1 root     root          229 date usr/bin/setupcon
  -lrwxrwxrwx   1 root     root           32 date usr/lib32/libnss_files.so.2 -> ../../lib32/libnss_files-2.31.so
  +lrwxrwxrwx   1 root     root           20 date usr/lib32/libnss_files.so.2 -> libnss_files-2.31.so
  -lrwxrwxrwx   1 root     root           37 date usr/lib64/ld-linux-x86-64.so.2 -> ../../lib/x86_64-linux-gnu/ld-2.31.so
  +lrwxrwxrwx   1 root     root           34 date usr/lib64/ld-linux-x86-64.so.2 -> ../lib/x86_64-linux-gnu/ld-2.31.so
  --rw-r--r--   1 root     root          185 date usr/lib/dracut/modules.txt
  +-rw-r--r--   1 root     root          171 date usr/lib/dracut/modules.txt
  -lrwxrwxrwx   1 root     root           46 date usr/lib/i386-linux-gnu/libnss_dns.so.2 -> ../../../lib/i386-linux-gnu/libnss_dns-2.31.so
  +lrwxrwxrwx   1 root     root           18 date usr/lib/i386-linux-gnu/libnss_dns.so.2 -> libnss_dns-2.31.so
  -lrwxrwxrwx   1 root     root           48 date usr/lib/i386-linux-gnu/libnss_files.so.2 -> ../../../lib/i386-linux-gnu/libnss_files-2.31.so
  +lrwxrwxrwx   1 root     root           20 date usr/lib/i386-linux-gnu/libnss_files.so.2 -> libnss_files-2.31.so
  +-rw-r--r--   1 root     root        19187 date usr/lib/modules/5.10.0-13-amd64/kernel/crypto/blake2b_generic.ko
  -drwxr-xr-x  21 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers
  +-rw-r--r--   1 root     root        25083 date usr/lib/modules/5.10.0-13-amd64/kernel/crypto/xor.ko
  +drwxr-xr-x  22 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers
  +drwxr-xr-x   2 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers/block
  +-rw-r--r--   1 root     root        74667 date usr/lib/modules/5.10.0-13-amd64/kernel/drivers/block/loop.ko
  -drwxr-xr-x   4 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/fs
  +drwxr-xr-x   5 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/fs
  +drwxr-xr-x   2 root     root            0 date usr/lib/modules/5.10.0-13-amd64/kernel/fs/overlayfs
  +-rw-r--r--   1 root     root       285667 date usr/lib/modules/5.10.0-13-amd64/kernel/fs/overlayfs/overlay.ko
  --rw-r--r--   1 root     root        69130 date usr/lib/modules/5.10.0-13-amd64/modules.alias
  --rw-r--r--   1 root     root        64959 date usr/lib/modules/5.10.0-13-amd64/modules.alias.bin
  +-rw-r--r--   1 root     root        69907 date usr/lib/modules/5.10.0-13-amd64/modules.alias
  +-rw-r--r--   1 root     root        65907 date usr/lib/modules/5.10.0-13-amd64/modules.alias.bin
  --rw-r--r--   1 root     root        19517 date usr/lib/modules/5.10.0-13-amd64/modules.dep
  --rw-r--r--   1 root     root        28161 date usr/lib/modules/5.10.0-13-amd64/modules.dep.bin
  --rw-r--r--   1 root     root          131 date usr/lib/modules/5.10.0-13-amd64/modules.devname
  +-rw-r--r--   1 root     root        19635 date usr/lib/modules/5.10.0-13-amd64/modules.dep
  +-rw-r--r--   1 root     root        28409 date usr/lib/modules/5.10.0-13-amd64/modules.dep.bin
  +-rw-r--r--   1 root     root          157 date usr/lib/modules/5.10.0-13-amd64/modules.devname
  --rw-r--r--   1 root     root       107148 date usr/lib/modules/5.10.0-13-amd64/modules.symbols
  --rw-r--r--   1 root     root       129343 date usr/lib/modules/5.10.0-13-amd64/modules.symbols.bin
  +-rw-r--r--   1 root     root       107260 date usr/lib/modules/5.10.0-13-amd64/modules.symbols
  +-rw-r--r--   1 root     root       129476 date usr/lib/modules/5.10.0-13-amd64/modules.symbols.bin
  -lrwxrwxrwx   1 root     root           44 date usr/lib/systemd/system/ctrl-alt-del.target -> ../../../../lib/systemd/system/reboot.target
  +lrwxrwxrwx   1 root     root           13 date usr/lib/systemd/system/ctrl-alt-del.target -> reboot.target
  -lrwxrwxrwx   1 root     root           20 date usr/lib/systemd/systemd-udevd -> ../../../bin/udevadm
  +lrwxrwxrwx   1 root     root           17 date usr/lib/systemd/systemd-udevd -> ../../bin/udevadm
  -lrwxrwxrwx   1 root     root           87 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-audit.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-journald-audit.socket
  -lrwxrwxrwx   1 root     root           89 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-dev-log.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-journald-dev-log.socket
  -lrwxrwxrwx   1 root     root           81 date usr/lib/systemd/system/sockets.target.wants/systemd-journald.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-journald.socket
  -lrwxrwxrwx   1 root     root           86 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-control.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-udevd-control.socket
  -lrwxrwxrwx   1 root     root           85 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-kernel.socket -> ../../../../../lib/systemd/system/sockets.target.wants/../systemd-udevd-kernel.socket
  +lrwxrwxrwx   1 root     root           32 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-audit.socket -> ../systemd-journald-audit.socket
  +lrwxrwxrwx   1 root     root           34 date usr/lib/systemd/system/sockets.target.wants/systemd-journald-dev-log.socket -> ../systemd-journald-dev-log.socket
  +lrwxrwxrwx   1 root     root           26 date usr/lib/systemd/system/sockets.target.wants/systemd-journald.socket -> ../systemd-journald.socket
  +lrwxrwxrwx   1 root     root           31 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-control.socket -> ../systemd-udevd-control.socket
  +lrwxrwxrwx   1 root     root           30 date usr/lib/systemd/system/sockets.target.wants/systemd-udevd-kernel.socket -> ../systemd-udevd-kernel.socket
  -lrwxrwxrwx   1 root     root           83 date usr/lib/systemd/system/sysinit.target.wants/kmod-static-nodes.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../kmod-static-nodes.service
  -lrwxrwxrwx   1 root     root           91 date usr/lib/systemd/system/sysinit.target.wants/systemd-ask-password-console.path -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-ask-password-console.path
  -lrwxrwxrwx   1 root     root           82 date usr/lib/systemd/system/sysinit.target.wants/systemd-journald.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-journald.service
  -lrwxrwxrwx   1 root     root           86 date usr/lib/systemd/system/sysinit.target.wants/systemd-modules-load.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-modules-load.service
  -lrwxrwxrwx   1 root     root           80 date usr/lib/systemd/system/sysinit.target.wants/systemd-sysctl.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-sysctl.service
  -lrwxrwxrwx   1 root     root           92 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-tmpfiles-setup-dev.service
  -lrwxrwxrwx   1 root     root           88 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-tmpfiles-setup.service
  -lrwxrwxrwx   1 root     root           79 date usr/lib/systemd/system/sysinit.target.wants/systemd-udevd.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-udevd.service
  -lrwxrwxrwx   1 root     root           86 date usr/lib/systemd/system/sysinit.target.wants/systemd-udev-trigger.service -> ../../../../../lib/systemd/system/sysinit.target.wants/../systemd-udev-trigger.service
  +lrwxrwxrwx   1 root     root           28 date usr/lib/systemd/system/sysinit.target.wants/kmod-static-nodes.service -> ../kmod-static-nodes.service
  +lrwxrwxrwx   1 root     root           36 date usr/lib/systemd/system/sysinit.target.wants/systemd-ask-password-console.path -> ../systemd-ask-password-console.path
  +lrwxrwxrwx   1 root     root           27 date usr/lib/systemd/system/sysinit.target.wants/systemd-journald.service -> ../systemd-journald.service
  +lrwxrwxrwx   1 root     root           31 date usr/lib/systemd/system/sysinit.target.wants/systemd-modules-load.service -> ../systemd-modules-load.service
  +lrwxrwxrwx   1 root     root           25 date usr/lib/systemd/system/sysinit.target.wants/systemd-sysctl.service -> ../systemd-sysctl.service
  +lrwxrwxrwx   1 root     root           37 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service -> ../systemd-tmpfiles-setup-dev.service
  +lrwxrwxrwx   1 root     root           33 date usr/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup.service -> ../systemd-tmpfiles-setup.service
  +lrwxrwxrwx   1 root     root           24 date usr/lib/systemd/system/sysinit.target.wants/systemd-udevd.service -> ../systemd-udevd.service
  +lrwxrwxrwx   1 root     root           31 date usr/lib/systemd/system/sysinit.target.wants/systemd-udev-trigger.service -> ../systemd-udev-trigger.service
  --rwxr-xr-x   1 root     root           20 Dec 15  2020 usr/lib/udev/console-setup
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libacl.so.1 -> ../../../lib/x86_64-linux-gnu/libacl.so.1.1.2253
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libacl.so -> ../../../lib/x86_64-linux-gnu/libacl.so.1.1.2253
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libacl.so.1 -> libacl.so.1.1.2253
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libacl.so -> libacl.so.1.1.2253
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libapparmor.so.1 -> ../../../lib/x86_64-linux-gnu/libapparmor.so.1.6.3
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libapparmor.so.1 -> libapparmor.so.1.6.3
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libattr.so.1 -> ../../../lib/x86_64-linux-gnu/libattr.so.1.1.2448
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libattr.so -> ../../../lib/x86_64-linux-gnu/libattr.so.1.1.2448
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libattr.so.1 -> libattr.so.1.1.2448
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libattr.so -> libattr.so.1.1.2448
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libaudit.so.1 -> ../../../lib/x86_64-linux-gnu/libaudit.so.1.0.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libaudit.so -> ../../../lib/x86_64-linux-gnu/libaudit.so.1.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libaudit.so.1 -> libaudit.so.1.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libaudit.so -> libaudit.so.1.0.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libblkid.so.1 -> ../../../lib/x86_64-linux-gnu/libblkid.so.1.1.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libblkid.so -> ../../../lib/x86_64-linux-gnu/libblkid.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libblkid.so.1 -> libblkid.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libblkid.so -> libblkid.so.1.1.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libbpf.so.0 -> ../../../lib/x86_64-linux-gnu/libbpf.so.0.3.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libbpf.so.0 -> libbpf.so.0.3.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libbsd.so.0 -> ../../../lib/x86_64-linux-gnu/libbsd.so.0.11.3
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libbsd.so -> ../../../lib/x86_64-linux-gnu/libbsd.so.0.11.3
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libbsd.so.0 -> libbsd.so.0.11.3
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libbsd.so -> libbsd.so.0.11.3
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libcap-ng.so.0 -> ../../../lib/x86_64-linux-gnu/libcap-ng.so.0.0.0
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libcap-ng.so -> ../../../lib/x86_64-linux-gnu/libcap-ng.so.0.0.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libcap-ng.so.0 -> libcap-ng.so.0.0.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libcap-ng.so -> libcap-ng.so.0.0.0
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libcap.so.2 -> ../../../lib/x86_64-linux-gnu/libcap.so.2.44
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libcap.so -> ../../../lib/x86_64-linux-gnu/libcap.so.2.44
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libcap.so.2 -> libcap.so.2.44
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libcap.so -> libcap.so.2.44
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libcrypto.so -> ../../../lib/x86_64-linux-gnu/libcrypto.so.1.1
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libcrypto.so -> libcrypto.so.1.1
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libcrypt.so.1 -> ../../../lib/x86_64-linux-gnu/libcrypt.so.1.1.0
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/libcrypt.so -> ../../../lib/x86_64-linux-gnu/libcrypt.so.1
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libcrypt.so.1 -> libcrypt.so.1.1.0
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/libcrypt.so -> libcrypt.so.1
  -lrwxrwxrwx   1 root     root           42 date usr/lib/x86_64-linux-gnu/libc.so.6 -> ../../../lib/x86_64-linux-gnu/libc-2.31.so
  +lrwxrwxrwx   1 root     root           12 date usr/lib/x86_64-linux-gnu/libc.so.6 -> libc-2.31.so
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/libdl.so.2 -> ../../../lib/x86_64-linux-gnu/libdl-2.31.so
  -lrwxrwxrwx   1 root     root           40 date usr/lib/x86_64-linux-gnu/libdl.so -> ../../../lib/x86_64-linux-gnu/libdl.so.2
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/libdl.so.2 -> libdl-2.31.so
  +lrwxrwxrwx   1 root     root           10 date usr/lib/x86_64-linux-gnu/libdl.so -> libdl.so.2
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libelf.so.1 -> ../../../lib/x86_64-linux-gnu/libelf-0.183.so
  -lrwxrwxrwx   1 root     root           41 date usr/lib/x86_64-linux-gnu/libelf.so -> ../../../lib/x86_64-linux-gnu/libelf.so.1
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libelf.so.1 -> libelf-0.183.so
  +lrwxrwxrwx   1 root     root           11 date usr/lib/x86_64-linux-gnu/libelf.so -> libelf.so.1
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libgcrypt.so.20 -> ../../../lib/x86_64-linux-gnu/libgcrypt.so.20.2.8
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libgcrypt.so -> ../../../lib/x86_64-linux-gnu/libgcrypt.so.20.2.8
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libgcrypt.so.20 -> libgcrypt.so.20.2.8
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libgcrypt.so -> libgcrypt.so.20.2.8
  -lrwxrwxrwx   1 root     root           52 date usr/lib/x86_64-linux-gnu/libgpg-error.so.0 -> ../../../lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libgpg-error.so -> ../../../lib/x86_64-linux-gnu/libgpg-error.so.0
  +lrwxrwxrwx   1 root     root           22 date usr/lib/x86_64-linux-gnu/libgpg-error.so.0 -> libgpg-error.so.0.29.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libgpg-error.so -> libgpg-error.so.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libip4tc.so.2 -> ../../../lib/x86_64-linux-gnu/libip4tc.so.2.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libip4tc.so.2 -> libip4tc.so.2.0.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libkmod.so.2 -> ../../../lib/x86_64-linux-gnu/libkmod.so.2.3.6
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libkmod.so.2 -> libkmod.so.2.3.6
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libkmod.so -> libkmod.so.2.3.6
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/liblz4.so.1 -> ../../../lib/x86_64-linux-gnu/liblz4.so.1.9.3
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/liblz4.so -> ../../../lib/x86_64-linux-gnu/liblz4.so.1.9.3
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/liblz4.so.1 -> liblz4.so.1.9.3
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/liblz4.so -> liblz4.so.1.9.3
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/liblzma.so.5 -> ../../../lib/x86_64-linux-gnu/liblzma.so.5.2.5
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/liblzma.so -> ../../../lib/x86_64-linux-gnu/liblzma.so.5.2.5
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/liblzma.so.5 -> liblzma.so.5.2.5
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/liblzma.so -> liblzma.so.5.2.5
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libmd.so.0 -> ../../../lib/x86_64-linux-gnu/libmd.so.0.0.4
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libmd.so -> ../../../lib/x86_64-linux-gnu/libmd.so.0.0.4
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libmd.so.0 -> libmd.so.0.0.4
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libmd.so -> libmd.so.0.0.4
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libmnl.so.0 -> ../../../lib/x86_64-linux-gnu/libmnl.so.0.2.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libmnl.so -> ../../../lib/x86_64-linux-gnu/libmnl.so.0.2.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libmnl.so.0 -> libmnl.so.0.2.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libmnl.so -> libmnl.so.0.2.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libmount.so.1 -> ../../../lib/x86_64-linux-gnu/libmount.so.1.1.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libmount.so -> ../../../lib/x86_64-linux-gnu/libmount.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libmount.so.1 -> libmount.so.1.1.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libmount.so -> libmount.so.1.1.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libmpfr.so.6 -> ../../../lib/x86_64-linux-gnu/libmpfr.so.6.1.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libmpfr.so.6 -> libmpfr.so.6.1.0
  -lrwxrwxrwx   1 root     root           42 date usr/lib/x86_64-linux-gnu/libm.so.6 -> ../../../lib/x86_64-linux-gnu/libm-2.31.so
  +lrwxrwxrwx   1 root     root           12 date usr/lib/x86_64-linux-gnu/libm.so.6 -> libm-2.31.so
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libnss_dns.so.2 -> ../../../lib/x86_64-linux-gnu/libnss_dns-2.31.so
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libnss_dns.so -> ../../../lib/x86_64-linux-gnu/libnss_dns.so.2
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libnss_dns.so.2 -> libnss_dns-2.31.so
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libnss_dns.so -> libnss_dns.so.2
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libnss_files.so.2 -> ../../../lib/x86_64-linux-gnu/libnss_files-2.31.so
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libnss_files.so -> ../../../lib/x86_64-linux-gnu/libnss_files.so.2
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libnss_files.so.2 -> libnss_files-2.31.so
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libnss_files.so -> libnss_files.so.2
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libnvpair.so.3 -> ../../../lib/x86_64-linux-gnu/libnvpair.so.3.0.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libnvpair.so.3 -> libnvpair.so.3.0.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libpam.so.0 -> ../../../lib/x86_64-linux-gnu/libpam.so.0.85.1
  -lrwxrwxrwx   1 root     root           41 date usr/lib/x86_64-linux-gnu/libpam.so -> ../../../lib/x86_64-linux-gnu/libpam.so.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libpam.so.0 -> libpam.so.0.85.1
  +lrwxrwxrwx   1 root     root           11 date usr/lib/x86_64-linux-gnu/libpam.so -> libpam.so.0
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 -> ../../../lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libpcre2-8.so -> ../../../lib/x86_64-linux-gnu/libpcre2-8.so.0.10.1
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 -> libpcre2-8.so.0.10.1
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libpcre2-8.so -> libpcre2-8.so.0.10.1
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libpcre.so.3 -> ../../../lib/x86_64-linux-gnu/libpcre.so.3.13.3
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libpcre.so.3 -> libpcre.so.3.13.3
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libpthread.so.0 -> ../../../lib/x86_64-linux-gnu/libpthread-2.31.so
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libpthread.so -> ../../../lib/x86_64-linux-gnu/libpthread.so.0
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libpthread.so.0 -> libpthread-2.31.so
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libpthread.so -> libpthread.so.0
  -lrwxrwxrwx   1 root     root           48 date usr/lib/x86_64-linux-gnu/libreadline.so.8 -> ../../../lib/x86_64-linux-gnu/libreadline.so.8.1
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libreadline.so -> ../../../lib/x86_64-linux-gnu/libreadline.so.8
  +lrwxrwxrwx   1 root     root           18 date usr/lib/x86_64-linux-gnu/libreadline.so.8 -> libreadline.so.8.1
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libreadline.so -> libreadline.so.8
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/librt.so.1 -> ../../../lib/x86_64-linux-gnu/librt-2.31.so
  -lrwxrwxrwx   1 root     root           40 date usr/lib/x86_64-linux-gnu/librt.so -> ../../../lib/x86_64-linux-gnu/librt.so.1
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/librt.so.1 -> librt-2.31.so
  +lrwxrwxrwx   1 root     root           10 date usr/lib/x86_64-linux-gnu/librt.so -> librt.so.1
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libseccomp.so.2 -> ../../../lib/x86_64-linux-gnu/libseccomp.so.2.5.1
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libseccomp.so.2 -> libseccomp.so.2.5.1
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libselinux.so -> ../../../lib/x86_64-linux-gnu/libselinux.so.1
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libselinux.so -> libselinux.so.1
  -lrwxrwxrwx   1 root     root           49 date usr/lib/x86_64-linux-gnu/libsigsegv.so.2 -> ../../../lib/x86_64-linux-gnu/libsigsegv.so.2.0.6
  +lrwxrwxrwx   1 root     root           19 date usr/lib/x86_64-linux-gnu/libsigsegv.so.2 -> libsigsegv.so.2.0.6
  -lrwxrwxrwx   1 root     root           51 date usr/lib/x86_64-linux-gnu/libsmartcols.so.1 -> ../../../lib/x86_64-linux-gnu/libsmartcols.so.1.1.0
  +lrwxrwxrwx   1 root     root           21 date usr/lib/x86_64-linux-gnu/libsmartcols.so.1 -> libsmartcols.so.1.1.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libtinfo.so.6 -> ../../../lib/x86_64-linux-gnu/libtinfo.so.6.2
  -lrwxrwxrwx   1 root     root           43 date usr/lib/x86_64-linux-gnu/libtinfo.so -> ../../../lib/x86_64-linux-gnu/libtinfo.so.6
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libtinfo.so.6 -> libtinfo.so.6.2
  +lrwxrwxrwx   1 root     root           13 date usr/lib/x86_64-linux-gnu/libtinfo.so -> libtinfo.so.6
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libtspi.so.1 -> ../../../lib/x86_64-linux-gnu/libtspi.so.1.2.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libtspi.so.1 -> libtspi.so.1.2.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libudev.so.1 -> ../../../lib/x86_64-linux-gnu/libudev.so.1.7.0
  -lrwxrwxrwx   1 root     root           42 date usr/lib/x86_64-linux-gnu/libudev.so -> ../../../lib/x86_64-linux-gnu/libudev.so.1
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libudev.so.1 -> libudev.so.1.7.0
  +lrwxrwxrwx   1 root     root           12 date usr/lib/x86_64-linux-gnu/libudev.so -> libudev.so.1
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libuuid.so.1 -> ../../../lib/x86_64-linux-gnu/libuuid.so.1.3.0
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libuuid.so -> ../../../lib/x86_64-linux-gnu/libuuid.so.1.3.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libuuid.so.1 -> libuuid.so.1.3.0
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libuuid.so -> libuuid.so.1.3.0
  -lrwxrwxrwx   1 root     root           47 date usr/lib/x86_64-linux-gnu/libuutil.so.3 -> ../../../lib/x86_64-linux-gnu/libuutil.so.3.0.0
  +lrwxrwxrwx   1 root     root           17 date usr/lib/x86_64-linux-gnu/libuutil.so.3 -> libuutil.so.3.0.0
  -lrwxrwxrwx   1 root     root           50 date usr/lib/x86_64-linux-gnu/libzfs_core.so.3 -> ../../../lib/x86_64-linux-gnu/libzfs_core.so.3.0.0
  +lrwxrwxrwx   1 root     root           20 date usr/lib/x86_64-linux-gnu/libzfs_core.so.3 -> libzfs_core.so.3.0.0
  -lrwxrwxrwx   1 root     root           45 date usr/lib/x86_64-linux-gnu/libzfs.so.4 -> ../../../lib/x86_64-linux-gnu/libzfs.so.4.1.0
  +lrwxrwxrwx   1 root     root           15 date usr/lib/x86_64-linux-gnu/libzfs.so.4 -> libzfs.so.4.1.0
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libz.so.1 -> ../../../lib/x86_64-linux-gnu/libz.so.1.2.11
  -lrwxrwxrwx   1 root     root           44 date usr/lib/x86_64-linux-gnu/libz.so -> ../../../lib/x86_64-linux-gnu/libz.so.1.2.11
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libz.so.1 -> libz.so.1.2.11
  +lrwxrwxrwx   1 root     root           14 date usr/lib/x86_64-linux-gnu/libz.so -> libz.so.1.2.11
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libzstd.so.1 -> ../../../lib/x86_64-linux-gnu/libzstd.so.1.4.8
  -lrwxrwxrwx   1 root     root           46 date usr/lib/x86_64-linux-gnu/libzstd.so -> ../../../lib/x86_64-linux-gnu/libzstd.so.1.4.8
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libzstd.so.1 -> libzstd.so.1.4.8
  +lrwxrwxrwx   1 root     root           16 date usr/lib/x86_64-linux-gnu/libzstd.so -> libzstd.so.1.4.8
  --rwxr-xr-x   1 root     root       517176 Nov  2  2019 usr/local/lib/libgmp.so.10.3.0
  +-rwxr-xr-x   1 root     staff      517176 Nov  2  2019 usr/local/lib/libgmp.so.10.3.0
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/depmod -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/depmod -> ../bin/kmod
  -lrwxrwxrwx   1 root     root           19 date usr/sbin/halt -> ../../bin/systemctl
  +lrwxrwxrwx   1 root     root           16 date usr/sbin/halt -> ../bin/systemctl
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/insmod -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/insmod -> ../bin/kmod
  -lrwxrwxrwx   1 root     root           12 date usr/sbin/ip -> ../../bin/ip
  +lrwxrwxrwx   1 root     root            9 date usr/sbin/ip -> ../bin/ip
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/lsmod -> ../../bin/kmod
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/modinfo -> ../../bin/kmod
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/modprobe -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/lsmod -> ../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/modinfo -> ../bin/kmod
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/modprobe -> ../bin/kmod
  -lrwxrwxrwx   1 root     root           19 date usr/sbin/poweroff -> ../../bin/systemctl
  +lrwxrwxrwx   1 root     root           16 date usr/sbin/poweroff -> ../bin/systemctl
  -lrwxrwxrwx   1 root     root           19 date usr/sbin/reboot -> ../../bin/systemctl
  -lrwxrwxrwx   1 root     root           14 date usr/sbin/rmmod -> ../../bin/kmod
  +lrwxrwxrwx   1 root     root           16 date usr/sbin/reboot -> ../bin/systemctl
  +lrwxrwxrwx   1 root     root           11 date usr/sbin/rmmod -> ../bin/kmod

Closes dracutdevs#1781
  • Loading branch information
nabijaczleweli committed Jun 24, 2022
1 parent e08e97a commit 5e68016
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions src/install/dracut-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,45 @@ static size_t dir_len(char const *file)
static char *convert_abs_rel(const char *from, const char *target)
{
/* we use the 4*MAXPATHLEN, which should not overrun */
char relative_from[MAXPATHLEN * 4];
_cleanup_free_ char *realtarget = NULL;
char buf[MAXPATHLEN * 4];
_cleanup_free_ char *realtarget = NULL, *realfrom = NULL, *from_dir_p = NULL;
_cleanup_free_ char *target_dir_p = NULL, *realpath_p = NULL;
const char *realfrom = from;
size_t level = 0, fromlevel = 0, targetlevel = 0;
int l;
size_t i, rl, dirlen;

dirlen = dir_len(from);
from_dir_p = strndup(from, dirlen);
if (!from_dir_p)
return strdup(from + strlen(destrootdir));
if (realpath(from_dir_p, buf) == NULL) {
log_warning("convert_abs_rel(): from '%s' directory has no realpath: %m", from);
return strdup(from + strlen(destrootdir));
}
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
* character - need to skip all leading /'s */
for (i = dirlen + 1; from[i] == '/'; ++i)
;
_asprintf(&realfrom, "%s/%s", buf, from + i);

dirlen = dir_len(target);
target_dir_p = strndup(target, dirlen);
if (!target_dir_p)
return strdup(from + strlen(destrootdir));

realpath_p = realpath(target_dir_p, NULL);
if (realpath_p == NULL) {
log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target);
log_warning("convert_abs_rel(): target '%s' directory has no realpath: %m", target);
return strdup(from + strlen(destrootdir));
}

/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
* character - need to skip all leading /'s */
for (i = dirlen + 1; target[i] == '/'; ++i)
;
_asprintf(&realtarget, "%s/%s", realpath_p, &target[i]);

/* now calculate the relative path from <from> to <target> and
store it in <relative_from>
store it in <buf>
*/
relative_from[0] = 0;
rl = 0;

/* count the pathname elements of realtarget */
Expand All @@ -208,13 +218,13 @@ static char *convert_abs_rel(const char *from, const char *target)
if (realtarget[i] == '/')
level++;

/* add "../" to the relative_from path, until the common pathname is
/* add "../" to the buf path, until the common pathname is
reached */
for (i = level; i < targetlevel; i++) {
if (i != level)
relative_from[rl++] = '/';
relative_from[rl++] = '.';
relative_from[rl++] = '.';
buf[rl++] = '/';
buf[rl++] = '.';
buf[rl++] = '.';
}

/* set l to the next uncommon pathname element in realfrom */
Expand All @@ -223,17 +233,17 @@ static char *convert_abs_rel(const char *from, const char *target)
/* skip next '/' */
l++;

/* append the uncommon rest of realfrom to the relative_from path */
/* append the uncommon rest of realfrom to the buf path */
for (i = level; i <= fromlevel; i++) {
if (rl)
relative_from[rl++] = '/';
buf[rl++] = '/';
while (realfrom[l] && realfrom[l] != '/')
relative_from[rl++] = realfrom[l++];
buf[rl++] = realfrom[l++];
l++;
}

relative_from[rl] = 0;
return strdup(relative_from);
buf[rl] = 0;
return strdup(buf);
}

static int ln_r(const char *src, const char *dst)
Expand Down

0 comments on commit 5e68016

Please sign in to comment.