[Python-bugs-list] [ python-Bugs-738361 ] crash error in glob.glob; windows + strange directories

SourceForge.net noreply@sourceforge.net
Thu, 15 May 2003 09:06:09 -0700


Bugs item #738361, was opened at 2003-05-15 12:06
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=738361&group_id=5470

Category: Extension Modules
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Steven Scott (progoth)
Assigned to: Nobody/Anonymous (nobody)
Summary: crash error in glob.glob; windows + strange directories

Initial Comment:
I'm attaching a zip file containing a python file and
directory structure to test this.

I ran into this bug in real life work, so, as contrived
as the bug test may look, it happens.

I was writing a function which recurses through
directories and does stuff with the files it finds.

glob.glob() doesn't return any files inside a directory
named [_]

glob.glob() crashes on a directory named [A--_B].  I
tried a few different combinations of characters inside
brackets, but this was the only one I could get it to
crash on.

the crash happens during the regular expression
compilation, as probably can be surmised by seeing the
characters which cause it ( [] ).  it also may be a
combination of that and using \ as the directory
delimiter since this is win32.

  File "C:\temp\globbug\bug.py", line 5, in test
    fs = glob.glob( path + '\*' )
  File "C:\Python22\lib\glob.py", line 24, in glob
    list = glob(dirname)
  File "C:\Python22\lib\glob.py", line 37, in glob
    sublist = glob1(dirname, basename)
  File "C:\Python22\lib\glob.py", line 50, in glob1
    return fnmatch.filter(names,pattern)
  File "C:\Python22\lib\fnmatch.py", line 47, in filter
    _cache[pat] = re.compile(res)
  File "C:\Python22\lib\sre.py", line 179, in compile
    return _compile(pattern, flags)
  File "C:\Python22\lib\sre.py", line 229, in _compile
    raise error, v # invalid expression
sre_constants.error: bad character range

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=738361&group_id=5470