Given a system with execjob_launch hook enabled.
The problem is that an embedded single quote or double quote that does not appear as the LAST character in the environment value, causes that environment to not get set. Also any environment variables after that (to be processed next) get "eaten" up by mom parsing. This results in other environment variables to get unset.
The following will trigget this problem:
export hello='happy days"are"here to stay'
export dello="the days'are here now'then"
export iello='nothing compares" to you'
qsub -V -I
% echo $dello
<-- empty as well as environment variables after that
% echo $PBS_MOMPORT
% echo $LESSCLOSE
lessclose.sh %s %s <-- not empty due environment variable processed before $dello
Looking at the mom hooks's *.out file under /var/spool/pbs/mom_priv/hooks/tmp, with the hook's debug=t, one sees:
LESSCLOSE=lessclose.sh %s %s,USE_FAM=,dello=the days'are here now'then,PBS_MOMPORT=15003,...
The following will not trigger the problem as the single or double quote is the LAST character in the value...
export nello='the way that was"'
export pello='"music makes the people"'
export mello="the way it is'"
export pello="'music makes the people come together'"