marcosnils / bin

Effortless binary manager
MIT License
648 stars 45 forks source link

Fix XZed binaries similar to bzip2ed binaries #119

Closed korpa closed 2 years ago

korpa commented 2 years ago

Fix XZed binaries similar to bzip2ed binaries.

Similar to #117

marcosnils commented 2 years ago

hey @korpa , how did you test this? Not sure if this is required for xz since XZ is different that bz2 in the sense that xz does suppor file listing.

korpa commented 2 years ago

I haven't tested it in real, but my assumption was that it works similar to bzip2 because I did following in a shell:

$ touch test-xz.txt
$ xz test-xz.txt
$ ls test-xz.txt.xz
test-xz.txt.xz
$ unxz test-xz.txt.xz
$ ls test-xz.txt
test-xz.txt
marcosnils commented 2 years ago

I haven't tested it in real, but my assumption was that it works similar to bzip2 because I did following in a shell:

Hmmm.. intersting.. I see that xz(1) has an option -l to list information about files that bzip2 doesn't have. So I thought it could be holding metadata about files but that doesn't seem to be the case.

korpa commented 2 years ago

Now I was unsure if xz may be used like bzip2 on the one hand and like zip on the other hand. But checking https://www.kernel.org I say, that the use tar.xz for the kernel (https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.6.tar.xz).

Furthermore I check the help of xz:

-l, --list          list information about .xz files
$ xz -l test-xz.txt.xz
Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename
    1       0         32 B          0 B    ---  CRC64   test-xz.txt.xz

It really only lists compression infos. So I think my fix is right. But never the less, it would be good to have real world example to test.

Thanks that you already merged it.