changeset 43096:813aa8cc55d4

patchbomb: use procutil.shellquote() instead of shlex to escape email address This basically backs out 2cc453284d5c, and inserts procutil.shellquote() instead. I don't care about Windows compatibility here, but shlex.quote() can't handle byte strings on Python 3.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 02 Oct 2019 07:35:22 +0900
parents fb41ea2ea076
children 27c4f93d07a9
files mercurial/mail.py mercurial/pycompat.py mercurial/utils/procutil.py
diffstat 3 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/mail.py	Mon Oct 07 11:52:58 2019 -0400
+++ b/mercurial/mail.py	Wed Oct 02 07:35:22 2019 +0900
@@ -168,9 +168,10 @@
 def _sendmail(ui, sender, recipients, msg):
     '''send mail using sendmail.'''
     program = ui.config(b'email', b'method')
-    stremail = lambda x: (
-        procutil.quote(stringutil.email(encoding.strtolocal(x)))
-    )
+
+    def stremail(x):
+        return procutil.shellquote(stringutil.email(encoding.strtolocal(x)))
+
     cmdline = b'%s -f %s %s' % (
         program,
         stremail(sender),
--- a/mercurial/pycompat.py	Mon Oct 07 11:52:58 2019 -0400
+++ b/mercurial/pycompat.py	Wed Oct 02 07:35:22 2019 +0900
@@ -337,11 +337,9 @@
         ret = shlex.split(s.decode('latin-1'), comments, posix)
         return [a.encode('latin-1') for a in ret]
 
-    shlexquote = shlex.quote
 
 else:
     import cStringIO
-    import pipes
 
     xrange = xrange
     unicode = unicode
@@ -408,7 +406,6 @@
     sysplatform = sys.platform
     sysexecutable = sys.executable
     shlexsplit = shlex.split
-    shlexquote = pipes.quote
     bytesio = cStringIO.StringIO
     stringio = bytesio
     maplist = map
--- a/mercurial/utils/procutil.py	Mon Oct 07 11:52:58 2019 -0400
+++ b/mercurial/utils/procutil.py	Wed Oct 02 07:35:22 2019 +0900
@@ -77,7 +77,6 @@
 spawndetached = platform.spawndetached
 sshargs = platform.sshargs
 testpid = platform.testpid
-quote = pycompat.shlexquote
 
 try:
     setprocname = osutil.setprocname