Skip to content

pv-runtime: Only prepend /usr to glibc directory if it starts with /lib

Simon McVittie requested to merge wip/smcv/lib-gconv into master

Previously, we would remove any existing /usr prefix, and then prepend /usr to any thing that wasn't /app (with some awkwardness resulting from the leading "/" being optional), resulting in transformations like:

  • /lib64 -> /usr/lib64
  • /usr/lib64 -> /lib64 -> /usr/lib64
  • /app/lib64 -> /app/lib64
  • /nix/store/xxx/lib -> /usr/nix/store/xxx/lib

However, this seems like the wrong special-case behaviour: if the path is below some non-FHS directory like /opt or /nix/store, then prepending /usr to it is meaningless and probably harmful. In particular, on NixOS, /usr/nix/store doesn't exist.

Instead, simplify the logic down to just: if the path starts with /lib, then prepend /usr. This results in transformations like:

  • /lib64 -> /usr/lib64
  • /usr/lib64 -> no change
  • /app/lib64 -> no change
  • /nix/store/xxx/lib -> no change

Noticed while investigating https://github.com/ValveSoftware/steam-runtime/issues/511, but not directly related, other than that both affect NixOS.

Edited by Simon McVittie

Merge request reports

Loading