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.

Author markm
Recipients BreamoreBoy, amaury.forgeotdarc, atuining, brian.curtin, cgohlke, hnrqbaggio, janssen, loewis, markm, tim.golden
Date 2011-03-27.04:13:22
SpamBayes Score 4.430293e-05
Marked as misclassified No
Message-id <1301199204.67.0.430903527903.issue1128@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2011-03-27 04:13:24markmsetrecipients: + markm, loewis, amaury.forgeotdarc, atuining, janssen, tim.golden, brian.curtin, hnrqbaggio, cgohlke, BreamoreBoy
2011-03-27 04:13:24markmsetmessageid: <1301199204.67.0.430903527903.issue1128@psf.upfronthosting.co.za>
2011-03-27 04:13:24markmlinkissue1128 messages
2011-03-27 04:13:23markmcreate