1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-12 08:26:33 +00:00

Ignore failure of locale.getdefaultlocale.

This was reported to be a problem with the en_NG (Nigerian English)
locale by Kayode Adesina and Olisemeka Omo.

http://seclists.org/nmap-dev/2012/q2/965
http://seclists.org/nmap-dev/2012/q3/270

The underlying Python bug is this:

http://bugs.python.org/issue6895
This commit is contained in:
david
2012-07-20 01:55:25 +00:00
parent f78b11d50e
commit 20742bdde0
2 changed files with 12 additions and 3 deletions

View File

@@ -1,5 +1,8 @@
# Nmap Changelog ($Id$); -*-text-*-
o [Zenmap] Fixed a crash when using the en_NG locale: "ValueError:
unknown locale: en_NG" [David Fifield]
o [NSE] Added http-get by Alex Weber. This script looks for a .git
repository directory accesible over HTTP and extracts useful
information from it.

View File

@@ -106,9 +106,15 @@ def get_locales():
if val:
locales = val.split(":")
break
loc, enc = locale.getdefaultlocale()
if loc is not None:
locales.append(loc)
try:
loc, enc = locale.getdefaultlocale()
if loc is not None:
locales.append(loc)
except ValueError:
# locale.getdefaultlocale can fail with ValueError on certain locale
# names; it has been seen with at least en_NG.
# http://bugs.python.org/issue6895
pass
return locales
def install_gettext(locale_dir):