oneapi-src/oneapi-ci

/opt/intel/oneapi/setvar.sh overrides bash arguments when sourced

brycelelbach opened this issue · 4 comments

It was suggested this might be an appropriate place for me to draw attention to this.

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.

Thanks for reporting it. I will pass it on to the maintainers.

@brycelelbach -- thanks for the notification. We are aware of the issue and are working on a solution to the problem. I'll include a link to this in our internal bug database.

Closing because setvars.sh is distributed with the product

@brycelelbach and @rscohn2 -- this issue has been resolved and will be available in the next oneAPI product release. There was code in the initial release of the script designed to manage cleanup on exit, including restoration of the $@ array, but it turned out that it did everything correctly except restoration of the $@ array.