Sorry for chiming in so late, as I was on holiday, but this might be a side 
effect of a bug that we submitted to Sun/Oracle long ago that they fixed.

SGE was truncating environment variables when it saw a newline.  For example:

$ export FOO='abc
123
def'

Yes, this is legal syntax for the shell, however if you qsub -V'ed a job, and 
did "echo $FOO" all you saw was "abc".

It appears that the fix that was done might have been to translate the newline 
to a "\" "n", and then on the back-end when starting the job, it looks like it 
is blindly replacing all "\n"'s with a real newline.

Just a thought...
 -Jeff



-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of Rayson Ho
Sent: Monday, November 21, 2011 7:17 AM
To: Dave Love
Cc: Stephen Willey; [email protected]; Ed Spittles
Subject: Re: [gridengine users] max length of an environment variable

Dave,

The fix is good. However, there is still a bug in Grid Engine... if
you have environment variables that have the pattern \n (eg.
$QUESTION="yes\no?") in the value, then Grid Engine will happily
replace each \n into a new line (ie. $QUESTION="yes<new line>o?"),
which is not what most sites wanted.

$ export QUESTION="yes\no"
$ qsub -V ~/bin/env (wrapper around env, and sleeps for a short while)

Job output:
...
LS_COLORS=
QUESTION=yes
o
HOSTTYPE=x86_64-linux
...

Submission side simply handles the mapping by using
sge_replace_string() to map "\n" (new line) into \n (I mean, '\'
followed by 'n' in the memory, for others who don't know C/C++, the C
compiler eats one slash ('\') in the source for escape sequence), and
shepherd maps \n back to C string "\n" (new line). But the mapping is
not properly escaped, so that's why whenever we have a '\' followed by
an 'n', shepherd maps the sequence into a new line.

The current fix should handle most common cases, but a better escape
sequence is needed to handle all cases (or else years later someone
will step into this).

Rayson



On Thu, Nov 17, 2011 at 8:09 AM, Dave Love <[email protected]> wrote:
> Stephen Willey <[email protected]> writes:
>
>> Not sure about the answer to this specifically but just to warn you of
>> another env thing that might trip you up: SGE doesn't like multi-line
>> env variables (like bash functions).  It his us because we use
>> environment-modules.
>
> Long fixed, for what it's worth:
> https://arc.liv.ac.uk/trac/SGE/changeset/3556/sge
> There was a previous change that was only partial as far as I remember.
> _______________________________________________
> users mailing list
> [email protected]
> https://gridengine.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

Reply via email to