From d5138b3237d27d0a2b3613017cc56b6471f6104a Mon Sep 17 00:00:00 2001 From: david-sarah Date: Thu, 20 Jan 2011 00:48:27 -0800 Subject: [PATCH] src/allmydata/util/iputil.py: loosen regexps and ensure that 'LANG=en_US.UTF-8' is set in the environment, to minimize problems with localized output of IP-address-finding tools. refs #1274 --- src/allmydata/util/iputil.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/allmydata/util/iputil.py b/src/allmydata/util/iputil.py index efec11c9..5b328c5c 100644 --- a/src/allmydata/util/iputil.py +++ b/src/allmydata/util/iputil.py @@ -176,12 +176,12 @@ _win32_re = re.compile('^\s*\d+\.\d+\.\d+\.\d+\s.+\s(?P
\d+\.\d+\.\d+\.\ # These work in Redhat 6.x and Debian 2.2 potato _linux_path = '/sbin/ifconfig' -_linux_re = re.compile('^\s*inet addr:(?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) +_linux_re = re.compile('^\s*inet \w*:?(?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) # NetBSD 1.4 (submitted by Rhialto), Darwin, Mac OS X _netbsd_path = '/sbin/ifconfig' _netbsd_args = ('-a',) -_netbsd_re = re.compile('^\s+inet (?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) +_netbsd_re = re.compile('^\s+inet \w*:?(?P
\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S) # Irix 6.5 _irix_path = '/usr/etc/ifconfig' @@ -232,7 +232,8 @@ def _synchronously_find_addresses_via_config(): return [] def _query(path, args, regex): - p = subprocess.Popen([path] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + env = {'LANG': 'en_US.UTF-8'} + p = subprocess.Popen([path] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env) (output, err) = p.communicate() addresses = [] -- 2.45.2