Intel® oneAPI Data Analytics Library
Community support for building compute-intensive applications that run fast on Intel® architecture.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
For the latest information on Intel’s response to the Log4j/Log4Shell vulnerability, please see Intel-SA-00646
204 Discussions

Bug in daalvars.sh if installation path contains "/bin"

Adam_S_6
Beginner
121 Views

I am running the Professional Edition for Fortran and C++ of Intel Parallel Studio XE 2016. This bug occurs in versions 16.0.0 and 16.0.1 at least.

When I discovered this bug, I was trying to source bin/compilervars.sh in order to set my LD_LIBRARY_PATH properly. After running this, my LD_LIBRARY_PATH contained a couple of suspicious entries:

daalvars.csh daalvars.sh /soft/spack/opt/spack/linux-x86_64aries/intel-16.0.1/compilers_and_libraries_2016.1.150/linux/daal/bin/lib/intel64_lin
daalvars.csh daalvars.sh /soft/spack/opt/spack/linux-x86_64aries/intel-16.0.1/compilers_and_libraries_2016.1.150/linux/daal/bin/../compiler/lib/intel64_lin

The installation directory I used was:

/soft/spack/opt/spack/linux-x86_64/binaries/intel-16.0.1

As you can see, something stripped the "/bin" out of the middle of my path. I tracked this bug down to another script that is sourced by compilervars.sh. If you look inside daal/bin/daalvars.sh, you'll see the following line:

local daal=${daal_bin/\/bin/}

This line is designed to strip the "/bin" from the end of a path. However, my path contains the word "/binaries". This bash replacement actually strips out the first occurrence of the word "/bin". In order to fix this bug, I changed the line to the following:

local daal=${daal_bin%\/bin}

The second problem with daalvars.sh is actually on the line above. The script added a "daalvars.csh daalvars.sh " to my path. To be fair, this is actually my fault. In my .bashrc, I created a function:

function cd {
    command -p cd "$@" && ls
}

This function automatically runs "ls" every time I change directories. The problem with the script is that it runs "cd" to determine the directory:

local daal_bin=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

The easiest fix for me was to change the line into:

local daal_bin=$(command -p cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

I know, it's definitely my fault for creating a "cd" function that obscures the system "cd". If you don't want to patch this then I totally understand. It's mainly the "/bin" stripping that I consider to be a bug.

I attached a patch that I created for this bug. In order to use it, download the path, place it in the daal/bin directory, and run:

patch -p1 < daalvars_patch.txt daalvars.sh

I couldn't figure out where to submit a bug report for this problem, so if you would like me to submit an official bug report just let me know.

0 Kudos
3 Replies
Adam_S_6
Beginner
121 Views

I just noticed that the same problem with "cd" is occurring for me in pkg_bin/compilervars_arch.sh with MANPATH. If you want to resolve this issue, simply add "command -p " before each call to "cd". I've added a patch to accomplish this.

Kittur_G_Intel
Employee
121 Views

Hi Adam,
I'll transfer this to the DAAL forum at: https://software.intel.com/en-us/forums/intel-data-analytics-acceleration-library  for faster resolution to this issue, thanks.

_Kittur

Zhang_Z_Intel
Employee
121 Views

Hi Adam,

Thanks for reporting the problem. We'll investigate and fix, if necessary, in our future releases.

Zhang

Reply