Submitter | Jeff Sickel |
---|---|
Date | Nov. 25, 2014, 7:59 a.m. |
Message ID | <98812a2981f627796276.1416905951@cagoan1.buf.io> |
Download | mbox | patch |
Permalink | /patch/6851/ |
State | Accepted |
Headers | show |
Comments
On Tue, 2014-11-25 at 02:59 -0500, Jeff Sickel wrote: > # HG changeset patch > # User David Eckhardt <David.Eckhardt@cs.cmu.edu> > # Date 1416904312 21600 > # Tue Nov 25 02:31:52 2014 -0600 > # Branch stable > # Node ID 98812a2981f6277962762f7c6b65b918bc32aaaa > # Parent 54cd545e2ec215cf1271f063cd6dea6835e892ef > factotum: convert Plan 9 quoted string to Python string These are queued for default, thanks. I tweaked the first one in-flight to use () rather than \ for line continuation.
Patch
diff -r 54cd545e2ec2 -r 98812a2981f6 hgext/factotum.py --- a/hgext/factotum.py Tue Nov 25 02:27:31 2014 -0600 +++ b/hgext/factotum.py Tue Nov 25 02:31:52 2014 -0600 @@ -72,9 +72,14 @@ l = os.read(fd, ERRMAX).split() if l[0] == 'ok': os.write(fd, 'read') - l = os.read(fd, ERRMAX).split() - if l[0] == 'ok': - return l[1:] + status, user, passwd = os.read(fd, ERRMAX).split(None, 2) + if status == 'ok': + if passwd.startswith("'"): + if passwd.endswith("'"): + passwd = passwd[1:-1].replace("''", "'") + else: + raise util.Abort(_('malformed password string')) + return (user, passwd) except (OSError, IOError): raise util.Abort(_('factotum not responding')) finally: