8000 Minizip append mode doesn't work under Linux · Issue #250 · zlib-ng/minizip-ng · GitHub
[go: up one dir, main page]

Skip to content

Minizip append mode doesn't work under Linux #250

Closed

Description

@guwangfeng

Hi,

I tried minizip under Ubuntu16.04. I first built the libminizip using CMake, then build minizip.c using:

gcc minizip.c -g -o minizip -lminizipd -lz -lbsd

I first used
./minizip a.zip 1.txt
to create a.zip first. It worked well.

Then I used
./minizip -a a.zip 2.txt
to append 2.txt into a.zip.

But seems the "append" mode doesn't work, 1.txt disappered and there was only 2.txt in a.zip.

Did I miss something or something wrong in the minizip?

The following were the command I used:

wfgu-lnx@wfgu-lnx:~/minizip$ ./minizip a.zip 1.txt
Minizip 2.2.8 - https://github.com/nmoinvaz/minizip

Creating a.zip
Adding: 1.txt
wfgu-lnx@wfgu-lnx:~/minizip$ ./minizip -l a.zip
Minizip 2.2.8 - https://github.com/nmoinvaz/minizip

Length Method Size Ratio Date Time CRC-32 Name


  12  Defl:N       14 116%  04-12-18  16:51  af083b2d   1.txt

wfgu-lnx@wfgu-lnx:~/minizip$ ./minizip -a a.zip 2.txt
Minizip 2.2.8 - https://github.com/nmoinvaz/minizip

Creating a.zip
Adding: 2.txt
wfgu-lnx@wfgu-lnx:~/minizip$ ./minizip -l a.zip
Minizip 2.2.8 - https://github.com/nmoinvaz/minizip

Length Method Size Ratio Date Time CRC-32 Name


  28  Defl:N       28 100%  04-12-18  16:51  70fbfdee   2.txt

Activity

  1. guwangfeng commented on Apr 13, 2018

    @guwangfeng
    Author

    After I debugged this issue, I found that it's caused by that mode_fopen in mz_stream_posix_open should be "a+b" rather than "ab", otherwise reading central directory will fail, thus the exising central directory information will lose.

  2. guwangfeng commented on Apr 13, 2018

    @guwangfeng
    Author

    Later I found that if "a+b" mode is used, the central directory is correct, but the appended files cannot be extracted, I don't know what's wrong. Because I checked the code in mz_strm_posix.c and mz_strm_win32.c, seems their logic are the same.

  3. nmoinvaz commented on Apr 19, 2018

    @nmoinvaz
    Member

    Thanks it should be fixed now.

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

    fixedIssue or bug has been fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0