pyinstaller icon indicating copy to clipboard operation
pyinstaller copied to clipboard

Inconsistent TOC subtraction behavior when entry's type is not specified

Open rokm opened this issue 3 years ago • 0 comments

For TOC entries with typecode BINARY or DATA, unique_name does os.path.normcase on their name. In Windows, the effect of this is to lowercase the names. This means that on Windows if you try to remove a module with subtraction, giving its name with the same casing as it appears on disk, it will fail:

toc = TOC([('m1', None, None), ('m2', None, None), ('BadModule', None, 'BINARY')])
toc -= [('BadModule', None, None)]
print(toc)
# On Windows: -> [('m1', None, None), ('m2', None, None), ('BadModule', None, 'BINARY')]
# On Linux:   -> [('m1', None, None), ('m2', None, None)]

Originally posted by @plu5 in https://github.com/pyinstaller/pyinstaller/issues/6669#issuecomment-1065963542

rokm avatar Mar 19 '22 12:03 rokm