Title: msilib.make_id() is not safe for non ASCII characters.
Type: Stage: resolved
Components: Windows Versions: Python 3.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: loewis, markm, python-dev
Priority: normal Keywords: patch

Created on 2011-03-27 15:19 by markm, last changed 2011-03-27 19:11 by loewis. This issue is now closed.

File name Uploaded Description Edit
msilib.make_id_fix_and_tests2.patch markm, 2011-03-27 15:19 Fix msilib.make_id() for more non-id characters, and test. review
Messages (3)
msg132336 - (view) Author: Mark Mc Mahon (markm) * Date: 2011-03-27 15:19
msilib.make_id() currently ensure that any of the following characters are not in the resulting ID: " -+~;"

Per the Microsoft documentation the following list of characters are allowed.
"""The Identifier data type is a text string. Identifiers may contain the
ASCII characters A-Z (a-z), digits, underscores (_), or periods (.). However, every identifier must begin with either a letter or an underscore."""

If an file name contains any characters outside of the characters " -+~;" + string.ascii_letters + string.digits + "._" then it will be an invalid ID.

This includes many punctuation characters which are valid in file names but not ID's, and every unicode character which does not overlap with ASCII.

The attached patch tries to fix this - and it includes tests.
msg132357 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-27 19:09
New changeset ec84bd4c5ac4 by Martin v. Löwis in branch '2.7':
Closes #11696: Fix ID generation in msilib.

New changeset df66ce66834b by Martin v. Löwis in branch '2.7':
Add missing file from #11696.

New changeset f3d96d28a86e by Martin v. Löwis in branch '3.1':
Closes #11696: Fix ID generation in msilib.

New changeset 4dff2e436191 by Martin v. Löwis in branch '3.2':
merge #11696

New changeset c12e1ea49532 by Martin v. Löwis in branch 'default':
merge #11696
msg132358 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2011-03-27 19:11
Thanks for the patch. Please submit a contributor form if you haven't done so:
Date User Action Args
2011-03-27 19:11:28loewissetmessages: + msg132358
2011-03-27 19:09:51python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg132357

resolution: fixed
stage: resolved
2011-03-27 16:20:54pitrousetnosy: + loewis
2011-03-27 15:19:08markmcreate