Tim Landscheidt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/63165


Change subject: Fix "jsub -continuous" quoting issues.
......................................................................

Fix "jsub -continuous" quoting issues.

"jsub -continuous" failed if either an argument to an option
or a part of the command line to be executed contained "'"s.
This fixes bug 48334 by using 3-argument open for the former
and String::ShellQuote for the latter.

Bug:48334
Change-Id: I5198d2ee0592f8756905a18139ad2f50fa1cba84
---
M packages/jobutils/usr/local/bin/jsub
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/toollabs 
refs/changes/65/63165/1

diff --git a/packages/jobutils/usr/local/bin/jsub 
b/packages/jobutils/usr/local/bin/jsub
index 756ee1d..2d5b47d 100755
--- a/packages/jobutils/usr/local/bin/jsub
+++ b/packages/jobutils/usr/local/bin/jsub
@@ -1,5 +1,7 @@
 #! /usr/bin/perl
 
+use String::ShellQuote;
+
 my %qsubargs = (
        '-a' => 1, '-b' => 1, '-cwd' => 0, '-e' => 1, '-hard' => 0, '-i' => 1, 
'-j' => 1,
        '-l' => 1, '-now' => 1, '-N' => 1, '-o' => 1, '-p' => 1, '-q' => 1, 
'-soft' => 0,
@@ -111,9 +113,9 @@
 
 if($continuous) {
   push @args, '-q', 'continuous';
-  open QSUB, "|/usr/bin/qsub '".join("' '", @args)."'" or die "\[$now\] unable 
to start qsub: $!\n";
-  print QSUB "#! /bin/bash\n";
-  print QSUB "while ! '$prog' '".join("' '", @ARGV)."' ; do\n";
+  open QSUB, '|-', '/usr/bin/qsub', @args or die "\[$now\] unable to start 
qsub: $!\n";
+  print QSUB "#!/bin/bash\n";
+  print QSUB "while ! " . shell_quote($prog, @ARGV) . "; do\n";
   print QSUB "  sleep 5\n";
   print QSUB "done\n";
   close QSUB;

-- 
To view, visit https://gerrit.wikimedia.org/r/63165
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5198d2ee0592f8756905a18139ad2f50fa1cba84
Gerrit-PatchSet: 1
Gerrit-Project: labs/toollabs
Gerrit-Branch: master
Gerrit-Owner: Tim Landscheidt <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to