Skip to content

Conversation

@jennybc
Copy link
Member

@jennybc jennybc commented Jul 27, 2024

Fixes #1961, closes #1962.

Analyzing the above gave me a new/different understanding of common ZIP file organization structures. I think I've got a better heuristic for setting exdir.

jennybc added 2 commits July 27, 2024 15:32
Fixes #1961, closes #1962.

Analyzing the above gave me a new/different understanding of common ZIP file organization structures. I think I've got a better heuristic for setting `exdir`.
@jennybc
Copy link
Member Author

jennybc commented Jul 27, 2024

In tests/testthat/ref/README.md I now have a good origin story for the different ways ZIP archives are organized:

  • "Explicit parent" is what you get with zip -r foo-explicit-parent.zip foo/.Note that foo/ is there, in its own right:

    ~/rrr/usethis/tests/testthat/ref % unzip -Z1 foo-explicit-parent.zip
    foo/
    foo/file.txt
    
  • "Implicit parent" is what you get with zip -r foo-implicit-parent.zip foo/*. This is the form reported in use_zip error in unzipping directory with a different name from the zipfile #1961. Note that the original existence of foo/ is evident from the filepath but also only from the filepath:

    ~/rrr/usethis/tests/testthat/ref % unzip -Z1 foo-implicit-parent.zip
    foo/file.txt
    
  • "No parent" is what you get with (cd foo && zip -r ../foo-no-parent.zip .). No evidence that file.txt ever lived in foo/:

    ~/rrr/usethis/tests/testthat/ref % unzip -Z1 foo-no-parent.zip
    file.txt
    

@jennybc jennybc merged commit 00341c1 into main Jul 27, 2024
@jennybc jennybc deleted the refactor-tidy-unzip branch July 28, 2024 16:29
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 this pull request may close these issues.

use_zip error in unzipping directory with a different name from the zipfile

2 participants