The philosophical beauty of Unix and compressing files



  • Question: Why are tar and gzip almost always used together, and not just gzip? Is there any advantage to that method?

    In many ways (and not without its flaws), this is almost a pinnacle in composability, modularity, loose coupling and high cohesion. If you understand these four (and I mean really understand), you understand, it will be obvious why tar and gzip work like that in pairs.

    Notice he never actually answers the question other than "it's obvious!"

    As attributed to Voltaire, "If you would converse with me, first you must define your terms.". Second, yes the pipe and filters architecture falls short in specific cases, just like any other architecture, regardless of its beauty.

    Do we really need to quote Voltaire?!

    and you were given a technical answer.

    No, he was given a rambling philosophical one.



  • @rc4 said:

    Notice he never actually answers the question other than "it's obvious!"

    ...did you read the paragraphs before it?

    Gzip is in charge of doing one and only one thing well: (un)compressing. Of what? Of one thing and one thing only: a single file of any type... and that includes a file created with tar.

    Note the part directly before the bolded part... the part that says single file.



  • No, sorry, I must have gotten lost in plato's cave sometime before he gave that needlessly rambling answer.

    Don't be a :barrier: to my 😆, you ⛽⌛:manhole:



  • Wow, luis.espinal is like the world's douchiest condescending jackass.

    I like how everybody else (not EVERYBODY but a lot) on that page point out that .tar.gz is actually a really shitty format compared to plain ol' .zip, and it's mostly just used out of habit at this point.



  • I'd flag it for bloviation, but I don't have enough FORUMPOINTZZZ on Super Loser to cast flags.



  • @blakeyrat said:

    .tar.gz is actually a really shitty format compared to plain ol' .zip

    But... but... But .zip does two things! That's not the Unix way!



  • I'm not surprised... tar.gz was supplanted by tar.bz2 some time ago (and even somewhat by .7z since then), but people stick to what they know.


  • Winner of the 2016 Presidential Election

    @blakeyrat said:

    plain ol' .zip

    You mean, the file format of which you never know whether you're going to be able to unpack it correctly on your target system?

    Every time I have a problem with 64-bit zips, I want to kill someone.



  • Just FYI, each component file in a tar file is by default zero-padded out to 10kB boundaries. Imagine the effect on, say, a Linux kernel source tree, even compared to compressing each file and tar'ing them together.

    You do not need to explain to me the reason why running a compressor on a tar file will result in size reduction, nor the historical reason for this design choice in tar, nor do you need to follow up by anything else than cogent well-reasoned variants of "oh that's cool I never knew that, thank you so very much, I'm clicking like on your post". It seems every time I say something here some kind soul feels it necessary to explain my own post back to me.



  • I'd like to know why tho, and you are making me Google like a peasant..



  • And the answer was.. Eh.. Because tapes and physical limits..



  • Who are you talking to? Did you forget to log out of an alt account? I am so confused.

  • I survived the hour long Uno hand

    @swayde said:

    you are making me Google

    Presumably google knew the answer


  • Trolleybus Mechanic

    Are you still working with a bunch of Windows XP machines? If so, why not install 7zip or something? I don't think I've ever had trouble with Zip64. At work we did run into the lack of Zip64 support in Java 6. The first clue was the 4.5GB file had an encoded size of 500MB instead of throwing an exception...



  • @mikehurley said:

    If so, why not install 7zip or something?

    Yeah, why don't you install shell extensions on your client's computer?


  • FoxDev



  • @asdf said:

    Every time I have a problem with 64-bit zips, I want to kill someone.

    Does the rage cause you to let out a primal rar?


  • Winner of the 2016 Presidential Election

    @mikehurley said:

    Are you still working with a bunch of Windows XP machines?

    I'm not. But sometimes you don't have the target system under control (shared host with old 32-bit Debian version whose zip binary doesn't support ZIP64). Or you're on a Mac. Or you have to work with libraries that still don't support ZIP64 in their latest version. Actually, that doesn't only happen sometimes, but it still happens to me way too often.

    @mikehurley said:

    The first clue was the 4.5GB file had an encoded size of 500MB instead of throwing an exception...

    And that's the worst thing about it: Sometimes you wonder why a program crashes reading a file that you extracted from a ZIP. I debug my code, check whether I supplied the correct options, google for bugs, etc. And it always takes me some time to figure out that I tried to unzip a ZIP64 using a library/program that doesn't support it and that the extracted file itself is broken. If that operation would at least fail with an error, it wouldn't annoy me half as much.


  • Winner of the 2016 Presidential Election

    @Lawrence said:

    Just FYI, each component file in a tar file is by default zero-padded out to 10kB boundaries.

    But that doesn't matter when you gzip afterwards, does it? See, ...

    @Lawrence said:

    You do not need to explain to me the reason why running a compressor on a tar file will result in size reduction

    ... oh. Nevermind then.

    Sorry, but I couldn't not reply to such a passive-aggressive post.


  • Trolleybus Mechanic

    @asdf said:

    @mikehurley said:
    The first clue was the 4.5GB file had an encoded size of 500MB instead of throwing an exception...

    And that's the worst thing about it: Sometimes you wonder why a program crashes reading a file that you extracted from a ZIP. I debug my code, check whether I supplied the correct options, google for bugs, etc. And it always takes me some time to figure out that I tried to unzip a ZIP64 using a library/program that doesn't support it and that the extracted file itself is broken. If that operation would at least fail with an error, it wouldn't annoy me half as much.

    What was really strange is our customers had errors only if they used certain unzippers, don't remember which. Others decompressed everything ok but showed the funny size in its GUI.


  • BINNED

    Zip was not very popular because of IP:

    7zip changed everything, no one payed for WinZip anymore.


  • Fake News

    :rimshot: is getting quite the workout 'round here these days.

    You know what, I should zip it. It's like I'm tarring everything with the same brush.



  • @lolwhat said:

    tarring everything

    That's my job.



  • And I got the feathers!



  • You can use the feathers to pad that the .tar.gz file out to be the same length as the zip file you mentioned.


Log in to reply