New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trace module compares directories as strings (--ignore-dir) #55105
Comments
This is code from recent trace.py (http://svn.python.org/view/python/branches/release27-maint/Lib/trace.py?view=markup): trace.py:169: Directories comparison like "filename.startswith(d + os.sep)" works incorrect on case-insensitive filesystems (such as NTFS on Windows). This leads to confusing results on Windows: See attached test files and log for details. |
Workaround for people on Windows who don't wan't to modify trace.py: |
It's due to the os.path.normpath not normalizing case. Here is the patch. Also affects 3.x |
bpo-10908 is dealing with this and other issue re ignored dirs. |
SilentGhost, thanks for the patch! I can confirm, that adding os.path.normcase fixes issues with different cases of files. I believe there also may be issue with FAT's long file name mangling, like "C:\PROGRA~1\python26\" instead of "C:\Program Files\python26\". But never experienced such issue with Python. |
Sorry I was wrong - patch don't fix original issue. Case should be normalized not only for directories provided through --ignore-dir, but also for directories obtained from __file__. In my tests on Windows Ignore.names(self, filename, modulename) receives `filename''s argument like: Attaching patch fixes this issue for me (for Python 2.7 from http://svn.python.org/projects/python/branches/release27-maint, patch attached by SilentGhost is for 3.X I think). |
Vladimir, superseder's patch fixes that too. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: