Patchwork ***UNCHECKED*** D7208: fsmonitor: normalize hostname to bytes

login
register
mail settings
Submitter phabricator
Date Nov. 4, 2019, 4:27 p.m.
Message ID <8665e427a35385eb61785e1f2d3c094a@localhost.localdomain>
Download mbox | patch
Permalink /patch/42718/
State Not Applicable
Headers show

Comments

phabricator - Nov. 4, 2019, 4:27 p.m.
Closed by commit rHG8a9e53b974ee: fsmonitor: normalize hostname to bytes (authored by indygreg).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7208?vs=17506&id=17524

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7208/new/

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

AFFECTED FILES
  hgext/fsmonitor/state.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/fsmonitor/state.py b/hgext/fsmonitor/state.py
--- a/hgext/fsmonitor/state.py
+++ b/hgext/fsmonitor/state.py
@@ -14,6 +14,7 @@ 
 
 from mercurial.i18n import _
 from mercurial import (
+    encoding,
     pathutil,
     util,
 )
@@ -81,7 +82,7 @@ 
                 self.invalidate()
                 return None, None, None
             diskhostname = state[0]
-            hostname = socket.gethostname()
+            hostname = encoding.strtolocal(socket.gethostname())
             if diskhostname != hostname:
                 # file got moved to a different host
                 self._ui.log(
@@ -127,7 +128,7 @@ 
 
         with file:
             file.write(struct.pack(_versionformat, _version))
-            file.write(socket.gethostname() + b'\0')
+            file.write(encoding.strtolocal(socket.gethostname()) + b'\0')
             file.write(clock + b'\0')
             file.write(ignorehash + b'\0')
             if notefiles: