# HG changeset patch # User David Eckhardt # Date 1416904312 21600 # Node ID c834c0194dbb3771a7e98e007cfa3b8e2e389efb # Parent d66547df82075ae320d62457ffd82b75d1cb0307 factotum: convert Plan 9 quoted string to Python string diff -r d66547df8207 -r c834c0194dbb 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: