From: david-sarah Date: Thu, 20 Jan 2011 08:48:27 +0000 (-0800) Subject: src/allmydata/util/iputil.py: loosen regexps and ensure that 'LANG=en_US.UTF-8' is... X-Git-Tag: allmydata-tahoe-1.8.2b1~28 X-Git-Url: https://git.rkrishnan.org/nxhtml.html?a=commitdiff_plain;h=d5138b3237d27d0a2b3613017cc56b6471f6104a;p=tahoe-lafs%2Ftahoe-lafs.git 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 --- 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 = []