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

File Position limited to UInt32 ? #95

Open
ThummeTo opened this issue Nov 8, 2022 · 3 comments
Open

File Position limited to UInt32 ? #95

ThummeTo opened this issue Nov 8, 2022 · 3 comments

Comments

@ThummeTo
Copy link

ThummeTo commented Nov 8, 2022

When adding many larger files via addfile, I run into an exception:

ERROR: LoadError: InexactError: trunc(UInt32, 4320522198)
Stacktrace:
  [1] throw_inexacterror(f::Symbol, #unused#::Type{UInt32}, val::Int64)
    @ Core .\boot.jl:614
  [2] checked_trunc_uint
    @ .\boot.jl:644 [inlined]
  [3] toUInt32
    @ .\boot.jl:728 [inlined]
  [4] UInt32(x::Int64)
    @ Core .\boot.jl:768
  [5] addfile(w::ZipFile.Writer, name::String; method::UInt16, mtime::Float64)
    @ ZipFile C:\Users\thummeto\.julia\packages\ZipFile\6aqG6\src\ZipFile.jl:610

The corresponding codeline looks indeed like this:

f = WritableFile(w._io, name, UInt16(method), dostime, dosdate,
        UInt32(0), UInt32(0), UInt32(0), UInt32(position(w._io)),
        Int64(-1), w._io, false)

So position(w._io) is limited to UInt32. Is this a design limit or should it be possible to zip larger files?

Thanks and best regards!

@ssingh13-rms
Copy link

ssingh13-rms commented Apr 2, 2023

@ThummeTo I ran into the same issue trying to ZIP a large CSV (5+ GB).
I've opened #99 that should hopefully fix it but I haven't tested it thoroughly.
Would you be able to run it for your file? We can work together to increase support for larger files!
CC: @fhs

@ThummeTo
Copy link
Author

ThummeTo commented Apr 3, 2023

I can check that soon (best think would be to define a MWE that writes large nonsense-files). I don't know if it's at easy as replacing Uint32 with UInt64, propably there are limitations in the underlaying library to Int32 ... but why not try it like in your PR ...

@nhz2
Copy link

nhz2 commented Apr 15, 2023

To save larger files, ZIP64 needs to be used, see https://en.wikipedia.org/wiki/ZIP_(file_format)#ZIP64

Just replacing the UInt32 with UInt64 won't work. #88 Added support for reading ZIP64, but not writing yet. So ZIP64 support for writing still needs to be worked on.

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.

3 participants