How are compression options specified?

Issue #64 new
Former user created an issue

In the description of fuse-zip, it says it supports "Compression methods: store (no compression), deflate, bzip2."

Nowhere in the description or the man page does it show how to choose the compression algorithm that will be used for new data created in a mounted fuse-zip filesystem.

Comments (3)

  1. Alexander Galanin repo owner

    fuse-zip currently does not have options to specify compression level or compression method for new files. Level and method are auto-selected by libzip (medium compression and deflate method).

  2. Sobel-Sorenson, Chandler - (scar)

    I figured it would work if I created an archive with bzip2 compression first, and I was deceived into believing this even after adding data to the archive and writing it out/unmounting.  However, it seems libzip is tricksy because I checked again later and the archive was converted back to deflate compression!  I verified this misbehavior just now.  ℰ.ℊ.,

    $ dd if=/dev/urandom of=bar.c
    ^C163005+0 records in
    163005+0 records out
    83458560 bytes (83 MB, 80 MiB) copied, 1.65683 s, 50.4 MB/s
    $ zip -9 -Zb foo bar.c
      adding: bar.c (bzipped 0%)
    $ file foo.zip
    foo.zip: Zip archive data, at least v4.6 to extract, compression method=bzip2
    $ mkdir foo
    $ fuse-zip foo.zip foo
    $ cd foo
    $ dd if=/dev/urandom of=foo.c
    ^C64096+0 records in
    64096+0 records out
    32817152 bytes (33 MB, 31 MiB) copied, 2.24336 s, 14.6 MB/s
    $ ls -l
    total 113551
    -rw-r--r-- 1 scar scar 83458560 Jan 16 20:37 bar.c
    -rw-r--r-- 1 scar scar 32817152 Jan 17 01:03 foo.c
    $ cd ..
    $ ls -l foo.zip 
    -rw-r--r-- 1 scar scar 83827896 Jan 16 20:39 foo.zip
    $ fusermount -u foo
    $ ls -l foo.zip 
    -rw-r--r-- 1 scar scar 116650200 Jan 17 01:05 foo.zip
    $ file foo.zip
    foo.zip: Zip archive data, at least v4.6 to extract, compression method=bzip2
    $ fuse-zip foo.zip foo
    $ cd foo
    $ rm bar.c 
    rm: remove regular file 'bar.c'? y
    $ cd ..
    $ fusermount -u foo
    $ ls -l foo.zip
    -rw-r--r-- 1 scar scar 32822326 Jan 17 01:07 foo.zip
    $ file foo.zip 
    foo.zip: Zip archive data, at least v2.0 to extract, compression method=deflate
    $ 
    

    😐 Now that’s just naughty.

    So it’s a bug I should report to libzip team then?

    I wonder if using another library is feasible?  Not sure how that all works, but Pkware seems to have the spec that has all the additional compression methods.  The Library of Congress has an interesting entry for Pkware’s format, but I couldn’t quite tell if the needed code is available or not!

  3. Alexander Galanin repo owner

    fuse-zip keeps unmodified compressed files as is on unmount. Looks like file is checking only the first file in the archive. Since the first file was bar.c, the compression method are determined as bzip2. Once you removed this file, the tool started to determine compression method by looking at foo.c which is compressed using deflate method.

    fuse-zip integrated with libzip too tight so it’s hard to replace. At 2008 only libzip was good enough to cover all my needs but maybe something new was created during this time.

  4. Log in to comment