Re: [PATCH 03 of 11] py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes

2018-02-23 Thread Yuya Nishihara
On Fri, 23 Feb 2018 23:45:16 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pul...@gmail.com>
> # Date 1519386265 -19800
> #  Fri Feb 23 17:14:25 2018 +0530
> # Node ID dbcf3a406cf79d296d7e29ea2786fd647facd367
> # Parent  70c096e42cb8a63a62efe69b87cd7ccc5c539dba
> py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes
> 
> diff --git a/hgext/acl.py b/hgext/acl.py
> --- a/hgext/acl.py
> +++ b/hgext/acl.py
> @@ -200,6 +200,7 @@ from mercurial import (
>  error,
>  extensions,
>  match,
> +pycompat,
>  registrar,
>  util,
>  )
> @@ -340,7 +341,7 @@ def hook(ui, repo, hooktype, node=None, 
>  user = urlreq.unquote(url[3])
>  
>  if user is None:
> -user = getpass.getuser()
> +user = pycompat.bytestr(getpass.getuser())

getuser() may return non-ASCII characters. Last time we've fixed posix.getuser()
by applying fsencode() because of the implementation detail of Python 3.
Perhaps we can switch this to util.getuser().
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 03 of 11] py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes

2018-02-23 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1519386265 -19800
#  Fri Feb 23 17:14:25 2018 +0530
# Node ID dbcf3a406cf79d296d7e29ea2786fd647facd367
# Parent  70c096e42cb8a63a62efe69b87cd7ccc5c539dba
py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes

diff --git a/hgext/acl.py b/hgext/acl.py
--- a/hgext/acl.py
+++ b/hgext/acl.py
@@ -200,6 +200,7 @@ from mercurial import (
 error,
 extensions,
 match,
+pycompat,
 registrar,
 util,
 )
@@ -340,7 +341,7 @@ def hook(ui, repo, hooktype, node=None, 
 user = urlreq.unquote(url[3])
 
 if user is None:
-user = getpass.getuser()
+user = pycompat.bytestr(getpass.getuser())
 
 ui.debug('acl: checking access for user "%s"\n' % user)
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel