Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padded install root with trailing os.path.sep doesn't relocate properly #28170

Closed
3 tasks done
vanderwb opened this issue Dec 29, 2021 · 0 comments
Closed
3 tasks done
Labels
bug Something isn't working triage The issue needs to be prioritized
Milestone

Comments

@vanderwb
Copy link
Contributor

Steps to reproduce

I've found that if I build packages in an environment with a padded install root that ends with a separator and then populate a build cache and attempt to install the cached package into a second - unpadded - environment, the RPATH and text-path relocation operations fail because this trailing character is not stripped from the old padded prefix, and so when the old prefix is replaced by the new prefix via a regex, a separating character is lost and an invalid path is produced.

Providing exact instructions to reproduce is difficult, since it will depend on the number of characters in your install root. For me, the following combination in the padded environment spack.yaml produces the issue:

    install_tree:
      root: /glade/scratch/vanderwb/spack/test/build/opt
      padded_length: 126

Meanwhile, for this particular install root, if I use a padded_length of 128 characters it works. See below for the implications.

I found at least two ways to fix the problem, but they basically boil down to rstrip'ing the os.path.sep character from the padded root, as is done for the user-provided root. I could provide a PR for how I've fixed it in our Spack clone, but I'm not sure where it would be best to put the fix. To me, the most logical place is in the parse_install_tree method, but in my testing this does not resolve the problem for already-created cached binary packages. It may be more robust to rstrip the old_layout_root variable in the relocate_package method.

Error message

There is no specific error message, but when using the debug flag and installing a package (spack -d install hdf+shared), a message is provided that demonstrates the trailing-slash issue.

For the 128-character (working) example:

==> [2021-12-28-22:55:31.203264] Relocating package from
  /glade/scratch/vanderwb/spack/test/build/opt/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__ to /glade/scratch/vanderwb/spack/test/pub/opt.

And from the 126-character (failing) example:

==> [2021-12-28-23:30:11.173922] Relocating package from
  /glade/scratch/vanderwb/spack/test/build/opt/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/ to /glade/scratch/vanderwb/spack/test/pub/opt.

Finally, if we compare the RPATH's of a relocated library in the second environment, the missing slash problem is obvious.

128-character:

$ readelf -d opt/hdf/4.2.15/gcc/4.8.5/kx64zky/lib/libdf.so | grep RPATH | tr ':' '\n' | grep openssl
/glade/scratch/vanderwb/spack/test/pub/opt/openssl/1.1.1l/gcc/4.8.5/jwr4s44/lib

126-character:

$ readelf -d opt/hdf/4.2.15/gcc/4.8.5/kx64zky/lib/libdf.so | grep RPATH | tr ':' '\n' | grep openssl
/glade/scratch/vanderwb/spack/test/pub/optopenssl/1.1.1l/gcc/4.8.5/jwr4s44/lib
/glade/scratch/vanderwb/spack/test/pub/opt/openssl/1.1.1l/gcc/4.8.5/jwr4s44/lib

I'm not entirely sure why it gets duplicated in the second case, but that does allow it to "work" for libraries. However, the same issue exists for text replacements and this does indeed break things (e.g., the Lmod initialization scripts).

Information on your system

  • Spack: 0.17.1-665-9d5ce49
  • Python: 3.7.9
  • Platform: linux-centos7-cascadelake
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output
@vanderwb vanderwb added bug Something isn't working triage The issue needs to be prioritized labels Dec 29, 2021
@tgamblin tgamblin added this to the v0.20.0 milestone Nov 7, 2022
haampie added a commit that referenced this issue Jan 23, 2023
amd-toolchain-support pushed a commit to amd-toolchain-support/spack that referenced this issue Feb 16, 2023
alalazo pushed a commit that referenced this issue Feb 20, 2023
koysean pushed a commit to koysean/spack that referenced this issue Feb 20, 2023
jmcarcell pushed a commit to key4hep/spack that referenced this issue Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage The issue needs to be prioritized
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants