Skip to content

spack external find errors out on unreadable path #38733

@mathomp4

Description

@mathomp4

Steps to reproduce

I ran spack external find and it errored out as a path is unreadable by users:

$ spack external find
==> Error: [Errno 13] Permission denied: '/usr/local/lib'
$ ls -ltr /usr/local/  | grep lib
drwxr-xr-x    4 root   root  4096 Aug  5  2021 lib64/
drwx------    9 root   root  4096 Aug 27  2022 lib/

It looks like spack external find assumes /usr/local/lib is readable.

I naively tried --exclude /usr/local/lib but --exclude is for excluding packages.

Error message

I also ran:

spack --debug --traceback external find

The ending traceback is:

Traceback (most recent call last):
  File "/discover/nobackup/mathomp4/spack/bin/spack", line 52, in <module>
    sys.exit(main())
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack_installable/main.py", line 37, in main
    sys.exit(spack.main.main(argv))
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/main.py", line 1024, in main
    return _main(argv)
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/main.py", line 979, in _main
    return finish_parse_and_run(parser, cmd_name, env_format_error)
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/main.py", line 1007, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/main.py", line 648, in _invoke_command
    return_val = command(parser, args)
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/cmd/external.py", line 258, in external
    action[args.external_command](args)
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/cmd/external.py", line 164, in external_find
    detected_packages.update(spack.detection.by_library(pkg_cls_to_check, path_hints=args.path))
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/detection/path.py", line 149, in by_library
    libraries_in_ld_and_system_library_path(path_hints=path_hints)
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/detection/path.py", line 90, in libraries_in_ld_and_system_library_path
    return path_to_dict(search_paths)
  File "/gpfsm/dnb44/mathomp4/spack/lib/spack/spack/detection/common.py", line 115, in path_to_dict
    for lib in os.listdir(search_path):
PermissionError: [Errno 13] Permission denied: '/usr/local/lib'

I can provide the full debug if needed, but it is...long!

Information on your system

  • Spack: 0.21.0.dev0 (95847a0)
  • Python: 3.9.12
  • Platform: linux-sles12-skylake_avx512
  • 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

Metadata

Metadata

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions