Fix bug #16098: wmllint enters infinite loop during spellcheck

This commit is contained in:
Eric S. Raymond 2010-06-01 22:03:37 +00:00
parent 47c2092dc9
commit dd1f83f1eb
2 changed files with 5 additions and 1 deletions

View file

@ -13,6 +13,10 @@ l10n_directories = ("l10n",)
resource_extensions = map_extensions + image_extensions + sound_extensions
image_reference = r"[A-Za-z0-9{}.][A-Za-z0-9_/+{}.-]*\.(png|jpg)(?=(~.*)?)"
def is_root(dirname):
"Is the specified path the filesysten root?"
return dirname == os.sep or (os.sep == '\\' and dirname.endswith(':\\'))
def pop_to_top(whoami):
"Pop upward to the top-level directory."
upwards = os.getcwd().split(os.sep)

View file

@ -1980,7 +1980,7 @@ def spellcheck(fn, d):
# and for all directories above it.
up = fn
while True:
if not up or up == os.sep:
if not up or is_root(up):
break
else:
local_spellings += declared_spellings.get(up,[])