Skip to content

Instantly share code, notes, and snippets.

@brycelelbach
Last active October 11, 2022 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brycelelbach/76bb5bcfa6688533cf1d700c94d91f83 to your computer and use it in GitHub Desktop.
Save brycelelbach/76bb5bcfa6688533cf1d700c94d91f83 to your computer and use it in GitHub Desktop.
`/opt/intel/oneapi/setvar.sh` overrides bash arguments when sourced

When /opt/intel/oneapi/setvar.sh is sourced, it overrides ${@} (the bash variable that stores command line arguments). This is very problematic when when you are sourcing the script inside of another script that needs to process command line arguments.

To reproduce:

docker run -i ubuntu:20.04 /bin/bash -s <<EOF
echo "Bash Arguments: \${@}"
apt-get -y update
apt-get -y install gnupg curl
echo "deb https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/icc.list
curl --silent --show-error -L https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB -o - | apt-key add -
apt-get -y update
apt-get -y --no-install-recommends install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
source /opt/intel/oneapi/setvars.sh
echo "Bash Arguments: \${@}"
EOF

The last line SHOULD print out:

Bash Arguments: 

But instead it prints:

Bash Arguments: compiler=latest tbb=latest dev-utilities=latest

This is keeping Thrust's CI system from building with ICPC. We've got it patched for now but would like it fixed.

@LDM001
Copy link

LDM001 commented Oct 4, 2022

Have you found a cure? I recently posted this to the Intel list, see https://mail.google.com/mail/u/0/#search/bug+with+setvars/FMfcgzGqQmQtrBTPNPSFtbKPLJfZcBjq . If you have no cure, maybe you can add a "I too have it" so Intel will take it seriously.

N.B., my patch is to do "var="$@" ; source /opt/intel/oneapi/setvars.sh ; eval set -- $var". It works, but it seems dumb to me.

@brycelelbach
Copy link
Author

brycelelbach commented Oct 11, 2022 via email

@brycelelbach
Copy link
Author

I haven't, it's been a few years since I've worked o this.

The link you provided doesn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment