Skip to content

Commit 8beeaad

Browse files
committed
shell: do not set TMPDIR to FLUX_JOB_TMPDIR when unset
Problem: The job shell tmpdir plugin sets TMPDIR to FLUX_JOB_TMPDIR when TMPDIR is not already set. However, this causes problems if the current job submits more jobs, because TMPDIR now points to a job specific directory. This can cause jobs to fail when they are executed on different nodes (where the job tmpdir does not exist). If the job runs locally, then it shares TMPDIR with another job which is probably not the original intent of the feature. For these reasons, avoid setting TMPDIR to FLUX_JOB_TMPDIR. Just leave TMPDIR unset if the user submitted the job that way. Fixes #4329
1 parent fd98713 commit 8beeaad

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/shell/tmpdir.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@ static int tmpdir_init (flux_plugin_t *p,
9999
cleanup_push_string (cleanup_directory_recursive, jobtmp);
100100

101101
/* Set/change FLUX_JOB_TMPDIR to jobtmp.
102-
* If TMPDIR is unset, set it to $FLUX_JOB_TMPDIR.
103102
*/
104-
if (flux_shell_setenvf (shell, 1, "FLUX_JOB_TMPDIR", "%s", jobtmp) < 0
105-
|| flux_shell_setenvf (shell, 0, "TMPDIR", "%s", jobtmp) < 0)
103+
if (flux_shell_setenvf (shell, 1, "FLUX_JOB_TMPDIR", "%s", jobtmp) < 0)
106104
shell_die_errno (1, "error updating job environment");
107105

108106
return 0;

0 commit comments

Comments
 (0)