Bugzilla – Bug 3706
Pre-WS Condor jobmanager performs incorrect escape of dollar in command line
Last modified: 2005-10-31 12:03:00
You need to log in before you can comment on or make changes to this bug.
The Condor jobmanager seems to insert a backslash into the command line incorrectly if the user tries to pass a dollar sign to the command. This can be observed with a simple echo command run from globus-job-run. The same globus-job-run command works OK under the fork jobmanager, and in earlier (VDT) releases, the PBS jobmanager works OK too. The same error occurs with Condor jobmanagers in the VDT release (which is using a pre-WS GRAM older than that of GT4). Here are a few examples to show and reproduce the problem: # failure - the \ in the output below should not be there: $ globus-job-run terminable:2120/jobmanager-condor /bin/echo 'x $y x' x \$y x $ # correct on GT4 pre-WS fork JM: $ globus-job-run terminable:2120/jobmanager-fork /bin/echo 'x $y x' x $y x $ # correct on pre-GT4 pre-WS fork JM $ globus-job-run terminable/jobmanager-fork /bin/echo 'x $y x' x $y x $ # correct on pre-GT4 pre-WS PBS JM: $ globus-job-run tp-osg/jobmanager-pbs /bin/echo 'x $y x' ---------------------------------------- Begin PBS Prologue Tue Aug 30 13:26:56 CDT 2005 Job ID: 69943.tp-mgt Username: wilde Group: ci-users Nodes: tp-c120 End PBS Prologue Tue Aug 30 13:26:57 CDT 2005 ---------------------------------------- x $y x ---------------------------------------- Begin PBS Epilogue Tue Aug 30 13:27:02 CDT 2005 Job ID: 69943.tp-mgt Username: wilde Group: ci-users Job Name: STDIN Session: 28977 Limits: neednodes=1,nodes=1,walltime=24:00:00 Resources: cput=00:00:00,mem=0kb,vmem=0kb,walltime=00:00:01 Queue: dque Account: Nodes: tp-c120 Killing leftovers... End PBS Epilogue Tue Aug 30 13:27:03 CDT 2005 ---------------------------------------- $
I think this is a result of a condor bug. I am pretty sure that condor cannot handle a '$' in the argument directive. Jaime can you confirm?
If you use griodine to submit, you can source /opt/globus/set-globus.sh to get access to some fairly recent GT4 clients. As for Stu's comment, I would expect the weird quoting to happen in the jobmanager Perl scripts - aren't they part of Globus? Also, running Mike's arguments through plain Condor, no Globus, using a vanilla universe (as the jobmanager does) yields correct results. Thus, I strongly suspect the Globus jobmanager-condor perl module.
ok - thanks. we'll take a look.
The submit routine in condor.pm is explicitly escaping dollar-sign, backslash, double-quote, and back- tick. Double-quote is the only character you need to escape.
In reference to comment #4 from Jaime: But condor.pm must be doing handling the escape of $ differently from the other characters you list (I would claim "incorrectly") as in the following examples: $ globus-job-run evitable/jobmanager-condor /bin/echo x \' x x ' x $ globus-job-run evitable/jobmanager-condor /bin/echo x $ x x \$ x $ The "$" should be reaching the echo command with no extra "\" prepended, as the "'" does. I suspect its putting in the \ expecting some other layer of evaluation to be taking it off, but that is not happening.
Mike accidentally used ' which was not in Jaime's list. But backslash is in his list: $ echo x \\ x x \ x $ globus-job-run griodine.uchicago.edu:2120/jobmanager-condor /bin/echo x \\ x x \\ x As Jaime said, there are some extra backslashes going around. I have this nagging feeling as if I may have caused this during my NFS fixes two years ago. I'd like to check the CVS.
There was no activity on this bug for a month now. Will it be fixed in the next release? Do you want me to elevate it to a blocker, since the quote/escaping strategy produces the wrong thing? Do you want me to make a first pass to suggest fixes?
I've already said how to fix it. Has anyone made the changes?
If not, we should notify Alain, so VDT can ship a fixed version at least for the condor.pm file. The VDT release is immanent, and I am loath to see "broken" stuff on OSG.
Created an attachment (id=712) [details] replacement condor.in before gpt-postinstall or make install Since nobody is going to do anything about this bug, here is the patched version of $GLOBUS_LOCATION/setup/globus/condor.in. It should be installed before running either gpt-postinstall or make install. I also have a patched version of the installed $GLOBUS_LOCATION/lib/perl/Globus/GRAM/JobManager/condor.pm, if anybody needs it. [Note that the first backslash is always the local shell escape] $ gjr gk/jobmanager-fork -l /bin/echo x \\ x \\\"x\\\" \'\$x\' \`x\` x \ x \"x\" '$x' `x` $ gjr gk/jobmanager-condor -l /bin/echo x \\ x \\\"x\\\" \'\$x\' \`x\` x \ x "x" '$x' \`x\` This fixes most. However, I am still not 100% happy about the way the dquotes are handled. Condor cannot handle dquotes without backslashes in front of them in the submit file, and as we can see, the remote Condor then removes the backslashes in front of the dquotes. It appears as if the Condor jobmanager should escape dquotes, which is contradictory to Jaime's statement. Jaime?
Your fix escapes back-tick, but not double-quote. It should the other way around.
Created an attachment (id=713) [details] replacement with proper escaping Thanks, Jaime. $ /bin/echo x \\ x \\\"x\\\" \'\$x\' \`x\` x \ x \"x\" '$x' `x` $ gjr gk/jobmanager-fork -l /bin/echo x \\ x \\\"x\\\" \'\$x\' \`x\` x \ x \"x\" '$x' `x` $ gjr gk/jobmanager-condor -l /bin/echo x \\ x \\\"x\\\" \'\$x\' \`x\` x \ x \"x\" '$x' `x` This is finally as it should be. Stu, When will GT4 include this patch? Alain, will this patch make it into VDT?
Jens, I don't understand part of your condor.in. When I do a diff, I see: @@ -520,9 +517,8 @@ my $job_id = $description->jobid(); my $count = 0; - if ($job_id =~ m/(\d+\.\d+)\.\d+/) { - $job_id = $1; - } + $job_id =~ s/,/ /g; + $job_id =~ s/(\d+\.\d+)\.\d+/$1/g; Why did you make this change? Is it important, or coincidental to your testing? By the way, this will make it into VDT 1.3.8, which we hope to release "soon". We'll leave the defintion of "soon" to be purposefully vague, but hopefully less than a month.
I've checked out last night from Globus's CVS where the fix of the quoting is still not in, and it does have the weird substitutions you point out. I do suspect that you have at your hand yet another bug, and frankly, I don't know what the "right" fix is for it. My posting of the module uses the vanilla from GT-CVS condor.pm. Maybe this is from some of the VDT patches to Globus? Looking at the module, though, I'd say that your version provides a slightly "safer" jobid, if the original jobid returned from $description->jobid() is for some reason longer or scrambled. However, if it is completely scrambled for some reason (unfathomable, but not impossible), your code version will continue with an invalid job id, as does the no-if-subst version. The "right" fix is probably something else completely. You could ask Jaime's opinion on it.
Jaime didn't know why that bit was needed, though it's not clearly wrong. I'll patch the VDT, but I'll just do that patch to fix the quoting. It will be in VDT 1.3.8, which we hope will be released within a few weeks.
Sut, the branch check-out from the 24th still provides the wrong quoting. Can you please assign this fix to someone?
I committed changes based on the attached condor.in to both the trunk and globus_4_0_branch.