This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: distutils.filelist.glob_to_re fails
Type: behavior Stage: test needed
Components: Distutils, Library (Lib) Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: tarek Nosy List: tarek, wayned
Priority: normal Keywords:

Created on 2006-05-19 07:55 by wayned, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg60915 - (view) Author: Wayne Davison (wayned) Date: 2006-05-19 07:55
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).
msg85573 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-04-05 21:52
fixed in r71280 and r71284
backported in r71281 and r71285
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43376
2009-04-05 21:52:36tareksetstatus: open -> closed

messages: + msg85573
versions: + Python 3.1, Python 2.7
2009-03-21 02:46:21ajaksu2setassignee: tarek
versions: + Python 2.6, Python 3.0
components: + Distutils

nosy: + tarek
title: glob_to_re problems -> distutils.filelist.glob_to_re fails
type: behavior
stage: test needed
2006-05-19 07:55:00waynedcreate