Skip to content
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

glob("*") still not returning any matches with ZipFileSystem #1448

Closed
olemke opened this issue Dec 6, 2023 · 5 comments · Fixed by #1454
Closed

glob("*") still not returning any matches with ZipFileSystem #1448

olemke opened this issue Dec 6, 2023 · 5 comments · Fixed by #1454

Comments

@olemke
Copy link

olemke commented Dec 6, 2023

PR #1445 did not fix the problem described in #1443.

The testcase provided in #1443 still does not return any matches with 2023.12.1:

➜ python zipglob.py
[]
{'date': '2023-12-05T10:09:44-0500', 'dirty': False, 'error': None, 'full-revisionid': 'b6536bef07abe21d4eecdc690048c30b523c20f7', 'version': '2023.12.1'}
@martindurant
Copy link
Member

Is the test case added in the PR not essentially the same?

@olemke
Copy link
Author

olemke commented Dec 7, 2023

The different ways used to create the zip file appear to be the culprit. When I use the zip commandline tool to create the file, it not only lists the file, but also has an entry for the directory itself.

Contents of zipfile created in the testcase (written to disk instead of memory):

➜ unzip -l out.zip
Archive:  out.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        4  01-01-1980 00:00   adir/afile
---------                     -------
        4                     1 file

Contents of zipfile created with the zip commandline tool (zip -r out2.zip adir):

➜ unzip -l out2.zip
Archive:  out2.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  12-07-2023 07:52   adir/
        4  01-01-1980 00:00   adir/afile
---------                     -------
        4                     2 files

The presence of the extra entry for the directory causes the glob function to fail.
Only adding the file itself instead of the directory with the zip command zip out3.zip adir/* confirms this. Without the additional directory entry, glob also works fine for this file.

@martindurant
Copy link
Member

Thats for digging, that's good information. I'm not sure when I'll have a moment to work on this point again (unless you have plans).

@olemke
Copy link
Author

olemke commented Dec 7, 2023

No worries, come back to it when you have the time. I'll just stick with 2023.10.0 for now.

@martindurant
Copy link
Member

Python ZipFile only added mkdir() in 3.11 https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile.mkdir :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants