-
Notifications
You must be signed in to change notification settings - Fork 19
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
Bugfix list zip #68
Bugfix list zip #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bugfix must include a test (case) that reproduces the bug.
Also, this introduces non-compat change on trailing slash, so it would be nice mentioned somewhere at the release time |
This commit refactors the test code to use expected_list to improve readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code seems good at a glance, but it's actually still broken.
$ unzip -l tmp3.zip
Archive: tmp3.zip
Length Date Time Name
--------- ---------- ----- ----
0 2019-10-04 10:13 tmp/
62672 2019-09-13 10:53 tmp/tmp.zip
0 2019-10-04 10:13 tmp/in/
62980 2019-10-04 10:13 tmp/in/tmp2.zip
--------- -------
125652 4 files
>>> import chainerio as chio
>>> z = chio.open_as_container('tmp3.zip')
>>> list(z.list('tmp', recursive=True))
['tmp/', 'tmp/tmp.zip', 'tmp/in/', 'tmp/in/tmp2.zip']
>>> list(z.list('tmp/in', recursive=True))
['tmp/', 'tmp/tmp.zip', 'tmp/in/', 'tmp/in/tmp2.zip']
>>> list(z.list('tmp//in', recursive=True))
['tmp/', 'tmp/tmp.zip', 'tmp/in/', 'tmp/in/tmp2.zip']
>>> list(z.list('tmp//in'))
[]
I think the double-slash bug also resides in HDFS listing code, which also does prefix matching.
A few more examples:
|
For the recursive case, it is known and supposed to be fixed in #72, which has conflicts with this PR and will be rebased after this is merged |
I do not think double-slash bug exists in hdfs list as it is not using "prefix matching" as we did here.
It first checks the state of the file and used the "converted and normalized path" as the prefix. |
This PR fixes the two bugs mentioned in #66
Closes #66