[ python-Bugs-1491431 ] glob_to_re problems

SourceForge.net noreply at sourceforge.net
Fri May 19 09:55:00 CEST 2006


Bugs item #1491431, was opened at 2006-05-19 00:55
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=1491431&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Wayne Davison (wayned)
Assigned to: Nobody/Anonymous (nobody)
Summary: glob_to_re problems

Initial Comment:
The regex substitution in distutils.filelist.glob_to_re
fails to do the right thing in a couple cases:

1. it fails to translate a dot after an even number of
backslashes.

2. it fails to translate multiple dots in row.

For example:

foo\\*   ->  foo\\.*$
foo????  ->  foo[^/].[^/].$

The following substitution fixes these problems:

 re.sub(r'((?<!\\)(\\\\)*)\.', r'\1[^/]', re_pattern)

This allows the dot to be preceeded by an even number
of backslashes (including 0) and it utilizes a negative
look-behind assertion so that adjacent dots are handled.

This problem is present in the svn code, and appears to
be identical in versions 2.4.2 and 2.3.5 (the only two
versions I had around to check).

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

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


More information about the Python-bugs-list mailing list