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

allow passing flags to zip_open via open #48

Open
brentp opened this issue Oct 22, 2019 · 5 comments
Open

allow passing flags to zip_open via open #48

brentp opened this issue Oct 22, 2019 · 5 comments

Comments

@brentp
Copy link

brentp commented Oct 22, 2019

AFAICT, files larger than 4.2 GB are not actually supported because we need to pass: ZIP_CM_DEFLATE64 to zip_open, but that's not possible via zip.open

I can open a PR changing:

proc open*(z: var ZipArchive, filename: string, mode: FileMode = fmRead): bool =

to

proc open*(z: var ZipArchive, filename: string, mode: FileMode = fmRead, flags:int32=0): bool =

here is the code I am using to check the problem. should fail for any file > 4.2GB.

import zip/zipfiles
import zip/libzip

var z:ZipArchive

# 5 GB zip file
var path  = "gnomad.v3.genome.zip"

if not z.open(path):
  # does not open and no way ? to get err value
  echo "couldn't open"

import zip/libzip

var err:int32
var flags:int32

flags = ZIP_CM_DEFLATE64

var w = zip_open(path, 0, addr(err))
# gives not a zip archive
echo err


err = 0
w = zip_open(path, flags, addr(err))
# gives 0
echo err
@brentp
Copy link
Author

brentp commented Oct 22, 2019

just adding that flag causes zip_open not to error, but it doesn't resolve the underlying issue. not sure how to fix.

@Araq
Copy link
Member

Araq commented Oct 23, 2019

can't we always add this flag in the implementation? Why expose this silly non-sense to zip's users.

@brentp
Copy link
Author

brentp commented Oct 23, 2019

that seems fine, but I can't get it to work even with that flag. the file will open, but I can't extract. I'll look into it more.

@brentp
Copy link
Author

brentp commented Oct 23, 2019

http://home.chpc.utah.edu/~u6000771/gnomad.v3.genome.zip

here is a test archive.
the first file in the archive has a compressed size > 4.2GB. which i think is creating additional problems.

@bung87
Copy link
Contributor

bung87 commented May 14, 2020

https://github.com/nih-at/libzip/blob/178c445ef82beae9670ca68668865082eb0e1e91/lib/zip.h#L157
ZIP_CM_DEFLATE64
commented as Reserved for Tokenizing compression algorithm so may not the right use here

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

No branches or pull requests

3 participants