Skip to content

File Position limited to UInt32 ? #95

Open

Description

@ThummeTo

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!

Activity

  1. ssingh13-rms commented on Apr 2, 2023

    @ssingh13-rms

    @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

  2. ThummeTo commented on Apr 3, 2023

    @ThummeTo
    Author

    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 ...

  3. nhz2 commented on Apr 15, 2023

    @nhz2

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions