r-lib / zip

Platform independent zip compression via miniz
https://r-lib.github.io/zip/
Other
83 stars 19 forks source link

Fedora 37: corrupted results from unzip #99

Closed skeydan closed 1 year ago

skeydan commented 1 year ago

Hi,

on some publicly accessible zip file (see below), I get strangely corrupted results. Corruptions are strange in that a (truncated) directory name is created (genet-200; expected would be extraction to the directory where the zip file is in), and that at least one file is empty which shouldn't be. (There may be additional corruptions, but these were noticeable immediately.)

See code to produce and some console reporting below.

Let me know if you have any questions. Thanks!

url <- "http://cs231n.stanford.edu/tiny-imagenet-200.zip"
dir <- "/tmp/unzip"
dir.create(dir)
path <- fs::path(dir, basename(url))
download.file(url, path)
zip::unzip(path, exdir = dir)
# cmp 
# utils::unzip(path, exdir = dir)
$ pwd
/tmp/unzip
$ ll
total 242288
drwx------. 7 xxx xxx       140 4659053606417203200 genet-200
-rw-r--r--. 1 xxx xxx 248100043 May  8 16:19 tiny-imagenet-200.zip

# after unpacking with zip::unzip
$ ll genet-200/
test/      train/     val/       wnids.txt/ words.txt/ 
$ ll genet-200/val/
images/              val_annotations.txt/ 
$ ll genet-200/val/val_annotations.txt/
total 0

# after unpacking with utils::unzip
$ ll
total 242288
drwx------. 7 xxx xxx       140 4659053606417203200 genet-200
drwxr-xr-x. 5 xxx xxx       140 May  8 17:12 tiny-imagenet-200
-rw-r--r--. 1 xxx xxx 248100043 May  8 16:19 tiny-imagenet-200.zip
$ ll tiny-imagenet-200
tiny-imagenet-200/     tiny-imagenet-200.zip  
$ ll tiny-imagenet-200/val/val_annotations.txt 
-rw-r--r--. 1 xxx xxx 347377 May  8 17:12 tiny-imagenet-200/val/val_annotations.txt
dfalbel commented 1 year ago

@skeydan Could this be related to #98 ? Does the problem reproduce when torch is not attached?

skeydan commented 1 year ago

@dfalbel you are correct! It does not.

gaborcsardi commented 1 year ago

OK, so this is a duplicate of #98, right?

skeydan commented 1 year ago

Yes, please feel free to close!

gaborcsardi commented 1 year ago

This should be fixed now, can you please try?

skeydan commented 1 year ago

works! thanks!