I've run into an issue where an intel compiler generated program that I'm running with taskset has been putting its temporary files into the working directory instead of /tmp (defined by environment variable TMPDIR). If run by itself, it works correctly. If run with taskset (e.g.
taskset -c 0 <program>
Then it seems to completely ignore the TMPDIR environment variable. I then verified this by writing a quick bash script as follows:
contents of test.sh:
#!/bin/bash echo $TMPDIR
When run by itself:
$ export TMPDIR=/tmp $ test.sh /tmp
When run through taskset:
$ export TMPDIR=/tmp $ taskset -c 1 test.sh ""
Another test. If I export the TMPDIR variable inside of my script and then use taskset to spawn a new process, it doesn't know about that variable:
#!/bin/bash export TMPDIR=/tmp taskset -c 1 sh -c export
When run, the list of exported variables does not include TMPDIR. It works correctly with any other exported environment variable. If i diff the output of:
taskset -c 1 bash -c export
Then I see that there are 4 changes. The taskset spawned export doesn't have LD_LIBRARY_PATH, NLSPATH (intel compiler variable), SHLVL is 3 instead of 1, and TMPDIR is missing. Can anyone tell me why?