[torqueusers] square brackets in PBS_JOBID and TMPDIR

Alex Frase atf3 at psu.edu
Thu Jun 14 09:18:26 MDT 2012


We've run into problems with TORQUE's use of square brackets to denote array jobs.  This behavior 
appears to have started in 2.5 and remains as of 4.0.1.

Because PBS_JOBID (i.e. "1234[1]") is also used as part of TMPDIR (i.e. "/tmp/1234[1].hostname/"), 
the square brackets indirectly end up in user scripted shell commands such as:

     cp $TMPDIR/output* /my/dir/

Such a command can fail for an array job if the []s in TMPDIR confuse the shell, preventing the 
expansion of the * wildcard; rather than copying all files as expected, cp then reports that there 
is no such file "output*".

A similar problem was posted to this list in 2010:


However, since that report only raised the issue in the context of the stdout/stderr output 
filenames, it appears the solution was to simply filter []s out of those filenames only.  A similar 
strategy could work here in the construction of the TMPDIR string, but since users may still want to 
use PBS_JOBID in a shell context for their own reasons, it might be safer to address both of these 
issues at their source and avoid using any characters in PBS_JOBID which have special meaning to any 
of the common shells.


More information about the torqueusers mailing list