[PATCH] clone on Windows: abort on reserved filenames (1st update)

Mads Kiilerich mads at kiilerich.com
Wed Jun 11 15:08:34 CDT 2008


Adrian Buehlmann wrote, On 06/11/2008 05:25 PM:
>> +_reserved_filenames = '''CON PRN AUX NUL
>> +    COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9
>> +    LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9'''.split()
>> +def validpathname(path):
>> +    for n in path.split('/'):
>> +        if n.upper() in _reserved_filenames:
>> +            return False
>> +    return True
>>     

Do you have a reference to the source for _reserved_filenames? 
http://swarajk1.blogspot.com/2007/12/invalid-file-name-list-can-you-do-it.html 
hints that there could be other. And 
http://www.cygwin.com/cygwin-ug-net/using-specialnames.html hints that 
they are invalid even with an extension.

And how about invalid characters? And trailing spaces and dots. And 
MAX_PATH.

Existing (tracked or untracked) file with different casing could also be 
said to create invalid path names dynamically. On Mac there is also 
unicode normalization.

Perhaps it would be better just to try to create the file, and if it 
fails then give a nice message.

/Mads
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3435 bytes
Desc: S/MIME Cryptographic Signature
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20080611/caa32d40/attachment.bin 


More information about the Mercurial-devel mailing list