D6775: py3: convert hg executable path to bytes in missing case in procutil

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Aug 30 02:55:15 EDT 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We (Google) noticed this in our tests when we use chg and a hg wrapper
  script not called 'hg'. The executable then ended up being a native
  string, which then failed in chgserver when trying to convert the
  environment dict to a byte string.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6775

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -246,7 +246,7 @@
             _sethgexecutable(pycompat.fsencode(mainmod.__file__))
         else:
             exe = findexe('hg') or os.path.basename(sys.argv[0])
-            _sethgexecutable(exe)
+            _sethgexecutable(pycompat.fsencode(exe))
     return _hgexecutable
 
 def _sethgexecutable(path):



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list