BryanDavis has uploaded a new change for review.

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

Change subject: jsub: Strip trailing comments from jsubrc and embedded options
......................................................................

jsub: Strip trailing comments from jsubrc and embedded options

Update regex used to extract options from ~/.jsubrc and embedded
comments to strip trailing inline comments. The updated regex more
closely matches the prior perl jsub parsing behavior.

Bug: T138178
Change-Id: Ifbb2a62fc5bf192defae32c9f6146aacc83431a4
---
M jobutils/bin/jsub
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/toollabs 
refs/changes/61/295361/1

diff --git a/jobutils/bin/jsub b/jobutils/bin/jsub
index e00d9d4..88817d1 100755
--- a/jobutils/bin/jsub
+++ b/jobutils/bin/jsub
@@ -475,7 +475,7 @@
         'JOBUTILS_JSUBRC', os.path.join(homedir(), '.jsubrc'))
     if os.path.exists(jsubrc):
         args = []
-        pat = re.compile(r'^(?P<opt>-[a-z]+)(?:\s+(?P<arg>.+)|\s*)$')
+        pat = re.compile(r'^(?P<opt>-[a-z]+)(?:\s+(?P<arg>[^#\s]+))?')
         with open(jsubrc, 'r') as fh:
             for line in fh:
                 m = pat.match(line)
@@ -513,7 +513,7 @@
     This mostly matches the behavior of SGE's qsub for non-binary programs.
     See '-C prefix_string' in `man qsub` for more ugly details.
     """
-    pat = re.compile(r'\s*(?P<opt>-[a-z]+)(?:\s+(?P<arg>.+)|\s*)')
+    pat = re.compile(r'\s*(?P<opt>-[a-z]+)(?:\s+(?P<arg>[^#\s]+))?')
     args = []
     with open(namespace.program, 'r') as fh:
         for line in read_script_comments(fh):

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbb2a62fc5bf192defae32c9f6146aacc83431a4
Gerrit-PatchSet: 1
Gerrit-Project: labs/toollabs
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to