[issue1128] msilib.Directory.make_short only handles file names with a single dot in them

Mark Mc Mahon report at bugs.python.org
Sun Mar 27 06:13:24 CEST 2011


Mark Mc Mahon <mtnbikingmark at gmail.com> added the comment:

I looked at the existing patches - and noted that they went closer to how Windows does short files - but still left out some cases.

I believe the latest patch catches all cases.

from http://msdn.microsoft.com/en-us/library/aa368590(v=vs.85).aspx
    Short and long file names must not contain the following characters:
        slash (/) or (\)
        question mark (?)
        vertical bar (|)
        right angle bracket (>)
        left angle bracket (<)
        colon (:)
        asterisk (*)
        quotation mark (")

    In addition, short file names must not contain the following characters:
        plus sign (+)
        comma (,)
        semicolon (;)
        equals sign (=)
        left square bracket ([)
        right square bracket (])

    No space is allowed preceding the vertical bar (|) separator for the short file name/long file name syntax. Short file names may not include a space, although a long file name may. A space can exist after the separator only if the long file name of the file name begins with the space. No full-path syntax is allowed.

Though I wonder do we really need to check for or replace the first set of characters above - none are allowed in any file name, so if they are there it is probably a error in how the function was called!

I also tested speed of re.sub, comprehension ("".join(c for c in ...) and for loops - and for loops were the fasted (for the small set of characters being replaced).

I am not patching make_id() - because I have added a patch for that to issue2694.

Note - The attached patch will probably not apply cleanly - as it pre-supposes that the patch (http://bugs.python.org/file21408/make_id_fix_and_test.patch) from issue2694 is applied first (especially for the tests)

----------
nosy: +markm
Added file: http://bugs.python.org/file21420/msilib.make_short.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1128>
_______________________________________


More information about the Python-bugs-list mailing list