Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-dev] Remote tools now escapes all non-alphanumeric characters which causes problems for JAXB resource manager commands

Simon,

we made that change on purpose to avoid unintended consequences if special shell characters are part of a directory or command argument.
E.g. the original approach wouldn't work if the  <generated batch file> would contain a dollar sign somewhere in its path. 

Why don't you use org.eclipse.ptp.remote.core.IRemoteProcessBuilder.environment() to set the environment variables? 

Roland

On Tue, Jan 31, 2012 at 1:10 AM, Simon Wail <simon.wail@xxxxxxxxxxx> wrote:
Dev Team,
I've been testing my SLURM - Blue Gene JAXB resource manager in preparation for code submission and hit a major problem.  My original development of the resource manager was done using PTP 5.0.1 and it was working fine.  Now I've been testing it under 5.0.4 and it doesn't work anymore.  I've investigated the problem and it seems to be the way remote commands are passed to ssh using the remotetools code.  The command I want to execute is "env - PATH=$PATH MMCS_SERVER_IP=$MMCS_SERVER_IP sbatch <generated batch file>" and this is defined in the JAXB resource manager file as:

        <submit-batch name="submit-batch" directory="${ptp_rm:directory#value}" waitForId="true">
            <arg>env</arg>
            <arg>-</arg>
            <arg>PATH=$PATH</arg>
            <arg>MMCS_SERVER_IP=$MMCS_SERVER_IP</arg>
            <arg>sbatch</arg>
            <arg>${ptp_rm:managed_file_for_script#value}</arg>
        ...

This all works fine under 5.0.1 and the remote shell command becomes:

tcsh -c /bin/sh -c 'echo "PID=$$ PIID=24" > /dev/pts/11; export "MESG2=World"; export "MESG=Hello World"; cd /vlsci/IBM/swail/; env - PATH=$PATH MMCS_SERVER_IP=$MMCS_SERVER_IP sbatch /vlsci/IBM/swail//3648df43-aae1-4226-ab56-2263458cb11cmanaged_file_for_script; '

Now when moving to 5.0.4 the remote shell command becomes:

tcsh -c /bin/sh -c 'echo "PID=$$ PIID=27" > /dev/pts/17; export "MESG2=World"; export "MESG=Hello World"; cd /vlsci/IBM/swail/&& env - PATH\=\$PATH MMCS_SERVER_IP\=\$MMCS_SERVER_IP sbatch /vlsci/IBM/swail//5252c4b2-de35-47e6-ade9-de855f30904dmanaged_file_for_script'

Notice the escape "\" before the equals and dollar signs for setting PATH and MMCS_SERVER_IP.  This is breaking the "env" command - the "env -" command allows you to execute a subsequent command with a cleared environment.  By using "env - PATH=$PATH sbatch ..." it allows me to clear the existing shell environment, set the PATH environment variable to the previous value (before the environment is cleared) and then execute the sbatch command.  This then provides a limited environment to the sbatch command which is required for the Blue Gene/P system.

With the escapes now in the command, the PATH environment variable is not set correctly and therefore the sbatch command is not found.  This in causing the job submission to fail.

I've looked at the recent differences in the PTP code between 5.0.1 and 5.0.4 and found the following in org.eclipse.ptp.remote.remotetools.core.RemoteToolsProcessBuilder:

1) In the class constructor a set of "trusted" characters is created - this include all alphanumeric characters plus / . _ -
2) In the "start" method the remote command is built and escapes any character NOT in the trusted set - see line 130

I believe this is how the "\"s are now appearing in the remote command and this is causing my job submission to fail.

I've also tried to set the "resolve=false" attribute for each of the "arg" lines in the JAXB file but this makes no difference.  I believe it might not be correct to escape all non-alphanumeric characters in the remote commands, but if this is felt to be necessary, then maybe the "resolve" attribute in the XML could override this to enable the remote command to be sent as desired.

Regards,
Simon Wail, Ph.D
HPC Specialist
IBM Research Collaboratory for Life Sciences - Melbourne


phone:
+61 3 9035-4341  fax: +61 3 8344-9130
address:
VLSCI, Gnd Floor, 187 Grattan St
Carlton   VIC   3010   Australia
email:
simon.wail@xxxxxxxxxxx






--
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309

Back to the top