Pop quiz: what is wrong with this tar command?
Published on , 157 words, 1 minutes to read
It's stupider than you think

Pop quiz: what is wrong with this tar command?
tar cf ../iosevka-iaso.tgz .
$ tar xzf iosevka-iaso.tgz
gzip: not a compressed stream
The thing I messed up was not adding z to the tarball creation command. I needed to do:
tar czf ../iosevka-iaso.tgz .
This happens because GNU tar looks at file extensions to try to determine the user's intent. If you do tar xf foo.tgz or tar xf foo.tar.gz, it will invoke gzip to decompress the tarball for you. This is intended behavior, but that same logic doesn't run when you create a tarball.
I lost 15 minutes to this today and feel that I need to let y'all know so you can learn from my suffering.
Facts and circumstances may have changed since publication. Please contact me before jumping to conclusions if something seems wrong or unclear.
Tags: