nixpkgs/pkgs/tools
Yarny0 1ed9ba08f1 tsm-client: fix patching rpath with autoPatchelf
Since commit
7b9fd5d1c9
tsm-client no longer produces working binaries
(discovered with bisection).
Instead, calling the command line client `dsmc`
just produces the error

> error while loading shared libraries: libtsmxerces-depdom.so.28: cannot open shared object file: No such file or directory

Output of `ldd $out/dsmc`

> linux-vdso.so.1 (0x00007ffd89f70000)
> libgsk8ssl_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8ssl_64.so (0x0000791c8eb34000)
> libgsk8iccs_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8iccs_64.so (0x0000791c8e9b7000)
> libgsk8km_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8km_64.so (0x0000791c8e791000)
> libxmlutil-8.1.13.0.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/opt/tivoli/tsm/client/api/bin64/libxmlutil-8.1.13.0.so (0x0000791c8e675000)
> libcrypt.so.1 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libcrypt.so.1 (0x0000791c8e639000)
> libpthread.so.0 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libpthread.so.0 (0x0000791c8e619000)
> libdl.so.2 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libdl.so.2 (0x0000791c8e614000)
> libstdc++.so.6 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libstdc++.so.6 (0x0000791c8e43f000)
> libgpfs.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/opt/tivoli/tsm/client/api/bin64/libgpfs.so (0x0000791c8e22a000)
> libdmapi.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/opt/tivoli/tsm/client/api/bin64/libdmapi.so (0x0000791c8e020000)
> librt.so.1 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/librt.so.1 (0x0000791c8e015000)
> libm.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libm.so.6 (0x0000791c8ded4000)
> libgcc_s.so.1 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libgcc_s.so.1 (0x0000791c8deba000)
> libc.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libc.so.6 (0x0000791c8dce5000)
> libgsk8cms_64.so => /nix/store/i21g0x44g336ag8rkx0dgndb9v4w2xhk-tsm-client-8.1.13.3-unwrapped/local/ibm/gsk8_64/lib64/libgsk8cms_64.so (0x0000791c8d78d000)
> /nix/store/4s21k8k7p1mfik0b33r2spq5hq7774k1-glibc-2.33-108/lib/ld-linux-x86-64.so.2 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib64/ld-linux-x86-64.so.2 (0x0000791c8f074000)
> libtsmxerces-depdom.so.28 => not found
> libtsmxerces-c.so.28 => not found

Output of `ldd $out/lib/libtsmxerces-depdom.so.28`

> linux-vdso.so.1 (0x00007fff69388000)
> libpthread.so.0 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libpthread.so.0 (0x000078f150454000)
> libtsmxerces-c.so.28 => not found
> libstdc++.so.6 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libstdc++.so.6 (0x000078f15027f000)
> libm.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libm.so.6 (0x000078f15013e000)
> libgcc_s.so.1 => /nix/store/ndnqiz3nnifj1blhg9q626xlmkqq1nmh-gcc-10.3.0-lib/lib/libgcc_s.so.1 (0x000078f150124000)
> libc.so.6 => /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib/libc.so.6 (0x000078f14ff4d000)
> /nix/store/qjgj2642srlbr59wwdihnn66sw97ming-glibc-2.33-123/lib64/ld-linux-x86-64.so.2 (0x000078f150601000)

The commit given above rewrote the `autoPatchelfHook`.
The new hook still calls `patchelf` to actually
modify binary files, but the discovery of
shared libraries apparently got changed.

Thorough investigation of all `patchelf` calls in the
old and new autoPatchelfHook showed that all files are
treated equally up the the files

* $out/opt/tivoli/tsm/client/api/bin64/libtsmxerces-depdom.so.28.0
* $out/opt/tivoli/tsm/client/api/bin64/libxmlutil-8.1.13.0.so

where the new autoPatchelf implementation replaced `$out/lib`
with `$out/opt/tivoli/tsm/client/api/bin64` in the rpath.

I failed to see *why* the new algorithm does
that, or if that might be considered a bug.
The `tsm-client` package has some confusing symlink
structure which certainly might confuse `autoPatchelfHook`.

The following ideas to "restore" the old behaviour
of `autoPatchelfHook` failed to produce a working package:
* add "$out" or "${placeholder "out"}" to `runtimeDependencies`
* use `addAutoPatchelfSearchPath` with `$out/lib` or
  another so-file-containing directory

The commit at hand fixes the issue by directly adding `$out/lib`
to the rpath of all shared libraries in that directory.
This has to be done *after* `autoPatchelf` got executed.
To accomplish this, we disable auto-calling `autoPatchelf`
(it would run after `postFixup`) and instead call it
manually in `postFixup`, just before we patch the rpath by hand.
2022-07-07 19:05:28 +02:00
..
admin Merge pull request #180020 from Ma27/synapse-admin-src 2022-07-05 13:03:14 +02:00
archivers Merge master into staging-next 2022-06-27 12:01:26 +00:00
audio tts: 0.6.2 -> 0.7.1 2022-06-28 07:50:52 +00:00
backup tsm-client: fix patching rpath with autoPatchelf 2022-07-07 19:05:28 +02:00
bluetooth blueman: 2.2.5 -> 2.3 2022-07-05 16:54:44 +02:00
bootloaders/refind refind: Fix possible NULL dereference 2022-06-09 22:30:13 -04:00
cd-dvd ventoy-bin: 1.0.76 -> 1.0.77 2022-06-19 22:27:19 -03:00
compression zfp: use python3Packages 2022-07-04 13:12:41 +02:00
filesystems fuse-overlayfs: set enableParallelBuilding/strictDeps 2022-07-05 20:23:19 +10:00
games fabric-installer: 0.10.2 -> 0.11.0 2022-06-25 20:17:27 +00:00
graphics Merge pull request #179192 from sersorrel/xcftools-cve-2019-5086 2022-07-05 14:59:35 +02:00
inputmethods fcitx5-unikey: 5.0.9 -> 5.0.10 2022-06-26 14:16:38 +08:00
misc cloc: 1.92 -> 1.94 2022-07-05 22:55:03 +02:00
networking mu: 1.8.3 -> 1.8.5 2022-07-06 21:18:07 +08:00
nix Merge pull request #178834 from kamadorueda/alejandra-update 2022-06-24 19:37:13 -05:00
package-management Merge pull request #178664 from StarGate01/mynewt-newt 2022-07-01 12:49:50 +08:00
security crlfsuite: 2.0 -> 2.1.1 2022-07-06 01:47:29 +00:00
system Merge pull request #173454 from qbit/p5-rex 2022-07-01 23:02:40 +02:00
text ugrep: 3.8.2 -> 3.8.3 2022-06-30 07:37:46 +05:30
toml2nix
typesetting texlive.bin.xdvi: pull upstream darwin fix for -fno-common toolchains 2022-07-02 20:48:31 +01:00
video Merge pull request #178364 from trofi/update-rtmpdump 2022-06-24 07:08:21 +00:00
virtualization virtctl: 0.53.0 -> 0.54.0 2022-07-05 17:05:58 -03:00
wayland hyprpaper: init at unstable-2022-07-04 (#180192) 2022-07-05 22:29:34 +03:00
X11 xosview2: remove spurious doCheck = false 2022-07-06 01:28:12 -03:00