wummel / patool

patool is a portable command line archive file manager
http://wummel.github.io/patool/
GNU General Public License v3.0
404 stars 68 forks source link

Specifying .tar.zst as an extension doesn't use zstandard for compression #162

Closed maxigaz closed 4 months ago

maxigaz commented 4 months ago

I'm using patool 2.2.0 on Arch Linux and I have a directory which holds data that is around 300 MB in size. If I try to archive and compress it with patool create "output.tar.zst" "/tmp/somedata", a regular tar archive is created without any compression applied. (The output file is also ~300 MB big.)

Here's the output of patool -v create "output.tar.zst" "/tmp/somedata":

INFO patool: Creating /tmp/output.tar.zst ...
INFO patool: running /usr/bin/tar --force-local --help
INFO patool:     with stderr='-3', input=''
INFO patool: running /usr/bin/tar --create --force-local --file "/tmp/output.tar.zst" -- "/tmp/somedata"
INFO patool:     with input=''
/usr/bin/tar: Removing leading `/' from member names
INFO patool: ... /tmp/output.tar.zst created.

In comparison, here's the output of patool -v create "output.tar.xz" "/tmp/somedata":

INFO patool: Creating /tmp/output.tar.xz ...
INFO patool: running /usr/bin/tar --force-local --help
INFO patool:     with stderr='-3', input=''
INFO patool: running /usr/bin/tar --create -J --force-local --file "/tmp/output.tar.xz" -- "/tmp/somedata"
INFO patool:     with input=''
/usr/bin/tar: Removing leading `/' from member names
INFO patool: ... /tmp/output.tar.xz created.

According to the output above, the option -J is used with the tar command, which enables compression with xz (according to man tar). And sure enough, the output size is only about 29 MB this time.

So, I believe the problem could be fixed by including the tar option --zstd when .tar.zst is detected as an extension and patool create is evoked.

Edit: I've taken a look at the source code and found this part. I was hoping that adding an additional elif statement for zst would make a difference, but after running python setup.py install --home /tmp/patool-install (using a temporary install location just for testing) and then the newly created bin/patool gives me the same result as before.

wummel commented 4 months ago

A new version 2.3.0 of patool has been released on 26.06.2024. Therefore this bug will be closed. If you think this issue is not solved, please open a new issue.