Skip to content

Quotes aren't needed because spack doesn't use a shell. Consider removing them #22766

@adamjstewart

Description

@adamjstewart

If you use spack load to load any package that uses spack.util.environment.from_sourcing_file (including all Intel packages), or any package that depends on one of these packages, Spack emits the aforementioned erroneous warning message. We should remove this warning.

Steps to reproduce the issue

$ spack install intel-mkl
$ spack load intel-mkl

Error Message

$ spack load intel-mkl
==> Warning: Quotes in command arguments can confuse scripts like configure.
  The following arguments may cause problems when executed:
      source /dev/null &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"
  Quotes aren't needed because spack doesn't use a shell.
  Consider removing them
==> Warning: Quotes in command arguments can confuse scripts like configure.
  The following arguments may cause problems when executed:
      source /opt/intel/compilers_and_libraries_2020.0.166/mac/mkl/bin/mklvars.sh intel64 &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"
  Quotes aren't needed because spack doesn't use a shell.
  Consider removing them
$ spack -d load intel-mkl
==> [2021-04-03-12:58:51.404517] Imported load from built-in commands
==> [2021-04-03-12:58:51.406030] Imported load from built-in commands
==> [2021-04-03-12:58:51.408626] Reading config file /Users/Adam/spack/etc/spack/defaults/config.yaml
==> [2021-04-03-12:58:51.445309] Reading config file /Users/Adam/.spack/config.yaml
==> [2021-04-03-12:58:51.448786] DATABASE LOCK TIMEOUT: 3s
==> [2021-04-03-12:58:51.448919] PACKAGE LOCK TIMEOUT: No timeout
==> [2021-04-03-12:58:51.697714] Reading config file /Users/Adam/spack/etc/spack/defaults/repos.yaml
==> [2021-04-03-12:58:54.283298] Reading config file /Users/Adam/spack/etc/spack/defaults/modules.yaml
==> [2021-04-03-12:58:54.300375] Reading config file /Users/Adam/spack/etc/spack/defaults/darwin/modules.yaml
==> [2021-04-03-12:58:54.306236] Reading config file /Users/Adam/.spack/modules.yaml
==> [2021-04-03-12:58:54.552076] Reading config file /Users/Adam/.spack/darwin/compilers.yaml
==> [2021-04-03-12:58:54.582045] normalize_path.normalize_suite_dir:	trying /opt/intel/compilers_and_libraries_2020.0.166
==> [2021-04-03-12:58:54.583319] normalize_path.normalize_suite_dir:	found 1:
  ['/opt/intel/compilers_and_libraries_2020.0.166']
==> [2021-04-03-12:58:54.584315] normalize_path.normalize_suite_dir:	/opt/intel/compilers_and_libraries_2020.0.166
==> [2021-04-03-12:58:54.585610] file_to_source.normalize_path:	/opt/intel/compilers_and_libraries_2020.0.166/mac/mkl/bin/mklvars.sh
==> [2021-04-03-12:58:54.585712] sourcing /opt/intel/compilers_and_libraries_2020.0.166/mac/mkl/bin/mklvars.sh
==> [2021-04-03-12:58:54.587316] Warning: Quotes in command arguments can confuse scripts like configure.
  The following arguments may cause problems when executed:
      source /dev/null &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"
  Quotes aren't needed because spack doesn't use a shell.
  Consider removing them
==> [2021-04-03-12:58:54.587617] '/bin/bash' '-c' 'source /dev/null &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"'
==> [2021-04-03-12:58:54.742466] Warning: Quotes in command arguments can confuse scripts like configure.
  The following arguments may cause problems when executed:
      source /opt/intel/compilers_and_libraries_2020.0.166/mac/mkl/bin/mklvars.sh intel64 &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"
  Quotes aren't needed because spack doesn't use a shell.
  Consider removing them
==> [2021-04-03-12:58:54.742856] '/bin/bash' '-c' 'source /opt/intel/compilers_and_libraries_2020.0.166/mac/mkl/bin/mklvars.sh intel64 &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"'
==> [2021-04-03-12:58:55.186467] '/Users/Adam/spack/opt/spack/darwin-catalina-x86_64/apple-clang-12.0.0/python-3.8.8-hb53qjrjzg2glssozy2xoppjczwuh2bs/bin/python3.8' '-c' 'from distutils.sysconfig import get_config_h_filename; print(get_config_h_filename())'
==> [2021-04-03-12:58:55.371812] '/Users/Adam/spack/opt/spack/darwin-catalina-x86_64/apple-clang-12.0.0/python-3.8.8-hb53qjrjzg2glssozy2xoppjczwuh2bs/bin/python3.8' '-c' 'from distutils.sysconfig import get_config_var; print(get_config_var('"'"'prefix'"'"'))'

Information on your system

  • Spack: 0.16.1-2031-d978d72e19
  • Python: 3.8.7
  • Platform: darwin-catalina-ivybridge
  • Concretizer: clingo

Additional information

Basically, the command we are running is:

$ '/bin/bash' '-c' 'source /opt/intel/compilers_and_libraries_2020.0.166/mac/mkl/bin/mklvars.sh intel64 &> /dev/null && python3 -c "import os, json; print(json.dumps(dict(os.environ)))"'

While it's true that the outer set of single quotes is not necessary, the inner set of double quotes is necessary for the command to work. This seems like a false positive. I think the easiest solution is to add a "ignore_quotes" kwarg to the Executable.__call__ method.

  • 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

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions