r/programming • • Mar 12 '21

7-Zip developer releases the first official Linux version

https://www.bleepingcomputer.com/news/software/7-zip-developer-releases-the-first-official-linux-version/
5.0k Upvotes

377 comments sorted by

1.1k

u/macrocephalic Mar 12 '21

It actually makes me feel a bit better about myself that the writer of a piece of software, which is pretty much standard throughout the IT world, had trouble getting his software ported over to Linux.

504

u/Chudsaviet Mar 12 '21

It used lots of Windows specific APIs.

262

u/AyrA_ch Mar 12 '21

Everything that runs on Windows and does things beyond stdio uses Windows specific APIs.

I can imagine that things like drag and drop were an absolute nightmare to port to Linux. If the UI was written in GDI+ that likely took a long time to port over to a cross platform library too.

143

u/mudkip908 Mar 12 '21

There is no GUI, at least in this initial release.

113

u/BarMeister Mar 12 '21

Which, if it were up to me, it'd remain that way simply because it's an effort better spent elsewhere, specially considering the circumstances and the cultural difference between Windows and Linux. The Rarlab people got it right.

73

u/mudkip908 Mar 12 '21

I don't know about you, but I really appreciate a graphical interactive tree view like Ark has when browsing archives, and I think an official port of 7zFM to Linux would be pretty cool.

53

u/orbjuice Mar 12 '21

So build a UI that interfaces with the CLI tool. That’s the Unix philosophy anyway, right? Small composable programs that can be chained together?

115

u/mudkip908 Mar 12 '21

The Unix philosophy of text parsing at every step is overrated and error-prone. I think making a program that links against lib7z.so or whatever it's called is a better idea.

→ More replies (4)
→ More replies (1)

3

u/jasie3k Mar 12 '21

The Rarlab people got it right.

How so?

12

u/Hexada Mar 12 '21

No offense, but this type of thought process is part of why Linux has never become mainstream

→ More replies (5)

34

u/[deleted] Mar 12 '21

[removed] — view removed comment

16

u/MINIMAN10001 Mar 12 '21

Windows user here. Electron is a plight on the world.

It's too heavy weight for such a simple tool.

→ More replies (7)
→ More replies (2)

13

u/Hjine Mar 12 '21

an absolute nightmare to port to Linux

even in native Linux application it's nightmare, you'll need to look around lot of GTK2/3+ codes to add ability fro drag and drop same sht with QT5, I tried once to create simple cross-platform application on Windows drag and drop were done easy on Linux I just give up

0

u/[deleted] Mar 12 '21

[deleted]

71

u/ryuzaki49 Mar 12 '21

(Which I should be doing anyways)

Why? Is it against the law doing other than terminal stuff?

74

u/duxdude418 Mar 12 '21 edited Mar 12 '21

Very much this.

There is this bizarre notion that if you’re on Linux you must be doing things the Linux Way by doing everything my from a terminal and using Vim or Emacs as your text editor. I get it; sometimes there’s a productivity gain, automation need, or environment constraint that necessitates this. But it seems like masochism to do that for something like unzipping an archive.

It’s okay to use a GUI when the efficiency difference is on the margins if the ergonomics are much better.

19

u/folkrav Mar 12 '21

Honestly, I'm a huge terminal fan, I basically always have a terminal window opened somewhere. But that's just me - it has everything to do with how I'm used to use my computer, the tasks I want to accomplish and the tools I decide to use to complete them.

For unzipping archives I admittedly never remember the tar flags for extracting whatever type lol, so no, CLI tools aren't any "easier" than a GUI for sure. I do have a handy alias that uses the right command depending on the file extension though, so there's that lol

I just don't understand why people feel like they can judge other people's workflow. If it works for them, it works for them. If they feel the need to optimize it or make it more "efficient" in some way, they can do it. Who the hell am I to tell them that they can't point and click, or that it's inferior in any way? That's the whole point of FOSS: freedom - including freedom of choice, of doing things the way you want, of using the software you prefer, etc.

15

u/OriRig Mar 12 '21

For unzipping archives I admittedly never remember the tar flags for extracting whatever type lol

I don't think anybody does. 😅

→ More replies (9)

12

u/ESCAPE_PLANET_X Mar 12 '21

Tab complete inside of commands is amazing.

→ More replies (4)
→ More replies (7)
→ More replies (5)

7

u/Rocco03 Mar 12 '21

"My GUI tools suck, so terminal tools must always be the superior option."

It's a sour grapes mentality.

→ More replies (2)

4

u/twigboy Mar 12 '21 edited Dec 09 '23

In publishing and graphic design, Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content. Lorem ipsum may be used as a placeholder before final copy is available. Wikipediae5bt0r083qo0000000000000000000000000000000000000000000000000000000000000

→ More replies (4)
→ More replies (3)

50

u/[deleted] Mar 12 '21

All good software is the product of hard work. Your impression of these top developers being gods that shit out programs before breakfast is wrong. The only difference is normally you don't see the hard work that has gone into a polished product.

6

u/DrunkensteinsMonster Mar 13 '21

This is a great comment. You can extend it to most fields as well. People don’t produce amazing things without a ton of grinding and hard work. Anything that comes easy isn’t worth doing.

14

u/amanuense Mar 12 '21

I once tried to port 7zip to symbian (yes symbian). One of the problems i had with the original 7zip code was the overuse of macros. The code is very easy to read but my God it was frustrating to get something debugged.

Abandoned the project after organizing a team of engineers. the company I used to work decided that open software = free labor. They said we could use up to 10 % of out time to work on open source but the code will be company property. And could not be shared outside the company... I made sure all engineers in the company knew about this. The company cancelled their "open software" policy in a couple of weeks.

1

u/[deleted] Mar 14 '21

symbian (yes symbian)

May the NewLC be with you!

116

u/lelanthran Mar 12 '21

I expect he tied every tiny part of the initial program to Win32 APIs (using CreateFile() instead of fopen(), etc). If he had only tied the GUI stuff to Win32 calls it might have been easier, but he probably didn't expect it to run on anything other than the current target when he started it, so it's quite understandable. [see EDIT]

My strategy when writing x-platform is to write it for Linux first, then port it to Windows, writing any functions that Windows is missing (putenv(), some of the POSIX stuff, etc).

[EDIT: A post further down says that it is not what I thought; apparently it was a problem with parsing different file formats?]

Doing it the other way around is way too much work.

87

u/TheThiefMaster Mar 12 '21

If you develop for either system as a primary then the port to the other won't take full advantage of the other system. Windows has some really high performance threaded IO APIs for instance (e.g. IO completion ports). Linux has fork() in its toolkit - which requires a very different design to use to full advantage compared to what you might do on Windows - and so on.

For basic app stuff, it's easier to build on someone else's work and just use a cross-platform API, and avoid platform specific stuff - but you do end up leaving advantages of either platform on the table in the process.

20

u/[deleted] Mar 12 '21

Linux now (decades after…) has IOCP alternative in form of io_uring.

3

u/Tanyary Mar 12 '21

that's a risk a lot of developers are willing to take. i highly doubt you are using x86 intrinsics for your pet projects, hell you probably don't even check cpuid! because it is so utterly meaningless in most applications it's insane. while i personally dislike electron, it truly is the way forward to fast* and write once software. *fast enough

24

u/Jonne Mar 12 '21

Isn't the 'hard' part of 7zip the lzma compression algorithm? How many os-specific API's do you need for that? Couldn't you take the source code for gz, swap in your algorithm and call it a day?

Either way, I'm not about to switch to the 'official' version unless it's open source.

47

u/hippydipster Mar 12 '21

If you do it right, you can couple your simple app to hundreds and hundreds of pointless dependencies

34

u/folkrav Mar 12 '21

Found a node dev

22

u/cogman10 Mar 12 '21

The lzma part has been available to linux for a while with the command line under the xz application.

Guis for linux are a PITA to make well. Pretty much every decision you make is going to upset people. "I pick QT" oh, well now a bunch of people are pissed because of the QT bloat on their Gnome desktop. "I pick GTK". Ok, now a bunch of people are pissed because of bloat from having GTK on their KDE desktop. "Ok, I chose using X.11 directly", Now you are pissed because that's a daunting problem and everyone is pissed because they are using Wayland or XOrg or FreeX86 or whatever and it turns out you used one or more APIs not compatible with them.

No joke, it can be a lot easier to make a gui by targeting the windows API and using wine libs to do the heavy lifting.

Is it any wonder why cross platform folk have said "To hell with all this, I'm just using electron".

The alternative that I've seen pretty frequently is simply having multiple releases targeting multiple platforms or just accepting you are pissing off someone by your choice. There will be a Foo-QT and Foo-GTK release.

That, or you use ncurses and make your app gui and console gui :D. That's why people keep making console guis. Because, relatively speaking, the console is a lot easier to target for a gui and people are far more forgiving of a bad console UX experience.

4

u/Swedneck Mar 13 '21

There's nothing preventing you from just telling people to rewrite the GUI if they find it so important, having something is much more important than pleasing people you know aren't pleasable.

→ More replies (1)

3

u/chugga_fan Mar 12 '21

Either way, I'm not about to switch to the 'official' version unless it's open source.

Good news: it is! Look on their website and you'll find a source code download.

1

u/Sunius Mar 13 '21

using CreateFile() instead of fopen(), etc)

My strategy when writing x-platform is to write it for Linux first, then port it to Windows, writing any functions that Windows is missing (putenv(), some of the POSIX stuff, etc).

Unfortunately doing this often results in software that doesn't play nice with the Windows does things. For instance, you shouldn't use fopen because it doesn't work with paths that have non-ascii characters in them.

The best way to write a cross platform application is to make an abstraction layer that calls into appropriate platform specific APIs underneath.

171

u/SirClueless Mar 12 '21

Well I will say that as powerful a piece of software as 7-zip is, ergonomics and packaging are not its strong suit.

353

u/Carighan Mar 12 '21

It's a tiny installer with no frills attached that doesn't also try to install Chrome/whatever, and is done in seconds.

I don't know, if anything that ought to be a model for most apps, no?

60

u/SirClueless Mar 12 '21

It's gotten better over the years. It wasn't always this way.

Back in the old days what you got when you installed 7-zip was three cryptically named binaries, 7z.exe, 7zG.exe and 7zFM.exe, with no context menu entries or filetype associations. You couldn't even use "Open with..." in the context menu easily -- you'd have to manually browse to the "C:\Program Files\7-zip" directory and choose the right one of those three programs (7zFM -- if you chose something else it just... didn't work and the filetype would be associated with the wrong thing). As a result people had to ask basic questions like this one to learn how to use the software.

I think what happened is that Igor is a brilliant and well-intentioned guy who wrote a fantastic compression algorithm/file-format and one of the fastest implementations on windows of several decompression algorithms including, notably, .rar. And when WinRAR went to shit and sold out and became adware, 7-zip didn't and became unexpectedly popular. I have a lot of respect for Igor for keeping his integrity and slowly turning 7-zip into a fantastic and best-in-class utility that I use all the time.

7

u/Carighan Mar 12 '21

Ouff, you're right of course but wow that was a long long time ago.

And yeah back in the days most would use 7z only indirectly as part of another Multi-Format archiver. But it's been forever since 7z got a proper installer and in fact if you're not on an admin account it now works better than some alternatives that still can't wrap their code around how it works on non-admin accounts.

→ More replies (1)

63

u/Danthekilla Mar 12 '21

I love it's packaging, simple, fast, reliable.

3

u/krzyk Mar 12 '21

Standard? I saw 7zipnonly twice in my life both cases were my wife received 7z from secretary at school.

Zip is standard and tar.gz is, but 7z?

7

u/Sunius Mar 13 '21

.tar.gz is practically unheard of in the Windows world. 7z is popular because it compresses all files together just like .tar.gz (and unlike .zip which stores each file separately).

1

u/krzyk Mar 13 '21

Zip compresses multiple files just like tar.gz and 7z (and any other compressor that doesn't relay on tar)

2

u/Sunius Mar 13 '21

Zip compresses each file individually before merging them into one archive. That means it cannot reuse data from previous file for each subsequent file compression and it results in much larger archive sizes for large directory structures.

Here's an experiment for you: take two identical large files. Create 4 archives:

  1. 7z with a single file

  2. 7z with both files

  3. zip with a single file

  4. zip with both files

You'll notice that both 7z archives are almost identical in size, whereas the zip file that contains two identical files will be 2x larger than the one that only contains one.

6

u/bread-dreams Mar 12 '21

yeah i don't know what this guy is talking about. zip and tar.gz files are the most often encountered by far imo.

6

u/Cadoc7 Mar 13 '21

Depends on your domain. 7z is super common in the video game modding and emulator worlds.

2

u/krzyk Mar 13 '21

Ok, but e.g. nexus mods provide zips AFAIR.

→ More replies (2)
→ More replies (31)

356

u/[deleted] Mar 12 '21

Here's the tweet mentioned at the bottom. He said there's nothing inherently wrong with the codebase, as most known vulnerabilities have been patched, it's about it being a parser for a lot of file formats. So don't worry, there's nothing wrong with it.

Tweet

89

u/[deleted] Mar 12 '21

[removed] — view removed comment

94

u/xmsxms Mar 12 '21

A sandbox on Linux doesn't necessarily require a VM or docker container. The program itself can use chroot, setuid etc to reduce the potential impact of a bug.

181

u/[deleted] Mar 12 '21

No it's not. A huge number of vulnerabilities in C-like code comes from parsing things. You then get logic errors, buffer overflows, integer overflows and the like when parsing binary formats like compressed data. As all programs usually run as the user, you need to protect everything that is accessible with these privileges. Sandboxes essentially mean asking the OS to never give the program more access than what it asks for in the very beginning. Top down sandboxing using namespaces and whatever the analog on Windows is is so a good practice. Why should an archiver operating on two specific folders be able to delete your letters?

5

u/[deleted] Mar 12 '21

Is Rust supposed to be better at avoiding these types of bugs in the first place?

7

u/Radixeo Mar 12 '21

Rust won't neccesarily prevent a bug in the parser, but any bugs shouldn't give allow an attacker to take over the process.

The problem with C is that a bug in the parser has a higher chance of being exploitable by an attacker, which might allow them to take over the 7zip process and run code on your machine.

That said, rust's type system is pretty powerful. That would allow programmers to model the potential states of the parser better than they could in C, which would help reduce the number of bugs in the parser.

18

u/perolan Mar 12 '21

I don't know what your background is in and I don't want to presume, but I've worked on everything from pcap analyzers that break down protocols to drivers and assemblers. Input validation is obviously crucial, but with relative care all of these things can be mitigated. Nothing about an archiver program screams "need to be sandboxed" and the issues you mentioned can be present in literally any program if the developer makes a mistake. It really seems like extreme overkill to me and my default stance is that I can't trust the user to not be modifying my memory at runtime because all users are malicious by default

5

u/SpAAAceSenate Mar 12 '21

But we're not worried about the user messing with the program. We're worried about untrusted user input (a zip file received from someone else) cussing naughty behavior of the parsing program. While it's theoretically possible to write a perfect program devoid of any exploits, history has demonstrated that humans are notoriously poor at anticipating and guarding against the entire set of potential issues. While a zip parser is significantly less complex than, say, a browser, there's still a rich history of experienced developers getting it wrong.

Furthermore, prevailing security wisdom is "principle of least access". In an ideal world every process should only have the least possible access necessary for it to still perform it's task.

Basically, it feels like you're making the equivalent argument of "seatbelts seem like overkill, it's possible to drive without screwing up, just do that". Yet somehow, I think you probably still wear your seatbelt.

→ More replies (1)

0

u/[deleted] Mar 12 '21

[deleted]

→ More replies (4)

31

u/[deleted] Mar 12 '21

[removed] — view removed comment

14

u/[deleted] Mar 12 '21

Most of Docker's security bonuses can be replicated through a set of API calls. A parser can fork itself and have the fork drop all syscalls it doesn't need, restrict its access to specific directories, drop its user ID, etc. No need for a parser to spawn a bash shell or run a telnet daemon, for example.

Furthermore, a lot of system tools come with sandboxing by default through stuff like selinux / apparmor to prevent trouble. An archiving tool that can extract to any location wouldn't be sandboxable like that, but for most system tools protecting the parser like that is a very useful security measure that doesn't take too much effort to implement.

There are also libraries to aid developers in this process. For example, Google has released a sandboxing API that can be used to protect only the sensitive parts. It's also possible without dependencies through the seccomp, cgroups and other such system level protections.

If you, as a user, would like to sandbox a program, you can use firejail. Firejail already has some defensive policies for archiving software. For any random command, there's the sandbox utility though I have no experience with that.

Of course, most sandboxes have seen escapes so no sandbox is perfectly safe. I've considered experimenting with something like Amazon Firecracker to run commands in full-on virtual machines with some shared file system directory for the best security separation I can think of, but haven't had the time yet.

2

u/gmes78 Mar 12 '21

If you, as a user, would like to sandbox a program, you can use firejail.

Or Bubblewrap, which uses the APIs you mentioned, as is what's used in Flatpak.

26

u/[deleted] Mar 12 '21

systemd-run or firejail. An extractor usually has an input, an output, and possibly temporary storage. You would make the path of the source file visible and readable but only read-only, or generally expose all of the fs read only, except: You would create a tmpfs mount using a namespace at the temp file location for the process to write temp stuff to. You would allow writes to the output file on the real file system / shared namespace.

Another way would be privdrop, for example creating a reader process using seccomp or pledge, and a write only process.

10

u/[deleted] Mar 12 '21 edited Mar 12 '21

I’m not too sure, but I think Linux implements the pledge syscall. It might be BSD though.

Edit: yep, it was BSD

20

u/rammstein_koala Mar 12 '21

OpenBSD is the origin of pledge, on Linux there is seccomp which is sort of similar. Although I think there were some discussions about a port of pledge at some point.

2

u/[deleted] Mar 12 '21

You can drop a bit from C (one example would be starting thread and chrooting, so you can still talk with main thread via ipc but can't modify user data), but I'm not sure whether it is to degree that proper sandboxing would need

→ More replies (1)

11

u/[deleted] Mar 12 '21

.... no it isn't. There have been so many parser bugs over years that sandboxing at least the part of the code that does the parsing is not excessive effort but something you should probably do.

Now ideally that should be up to program doing the parsing but that's not exactly as easy, altho certainly a worthy effort

18

u/barsoap Mar 12 '21

Parsing can easily lead to weird machine exploits, especially if you can't use a proper parsing framework because the format is an informally-specified heap of hysterical raisins with no formalism in sight. Heck zip parsing might be turing-complete for all I know, I wouldn't be terribly surprised.

10

u/thegoatwrote Mar 12 '21 edited Mar 13 '21

Actually, yeah. Video codecs, de-serializers, and decompression utilities are inherently vulnerable to attack because they will use a fixed code base that’s likely to be reverse-engineered to process data from a variety of sources. They’re a very likely target of attack.

1

u/qbxk Mar 12 '21

any user input is tainted and must be assumed hostile

1

u/chucker23n Mar 13 '21

So anything that parses multiple formats should be sandboxed because “parsing is hard”?

Yes.

It’s an excellent example of where sandboxing can be effective. In a video player, have one process do just the GUI, one process just the parsing and one process just the networking. Don’t give the parser network access. Don’t give the fetcher file system access.

125

u/soul_of_rubber Mar 12 '21

I absolutely love 7zip on windows, but how would it compare to gzip on Linux? Does anybody have some data on what would be better? I'm generally interested

151

u/futlapperl Mar 12 '21 edited Mar 12 '21

gzip appears to use the Deflate algorithm. 7z, by default, uses LZMA2, which according to Wikipedia, is an improved version of Deflate. So based on my limited research, 7z should be better. Haven't got any benchmarks, but I think I'll get around to performing some today.

Edit: Someone's tested various algorithms including the aforementioned ones and uploaded a write-up.

105

u/Chudsaviet Mar 12 '21

There is already pretty standard Unix-style (stream) compressor XZ, which uses the same LZMA2.

49

u/futlapperl Mar 12 '21

.xz doesn't seem to be an archive format, instead only supporting single files, so you have to .tar everything first. This explains the common .tar.xz extension. 7z combines those two steps, but so does every other archiving program. Not sure if there are any notable advantages.

130

u/Kissaki0 Mar 12 '21

A 7z will not retain Linux file permissions.

Combining tar with an additional compression is prevalent on Linux. It's also in line with the Unix philosophy of combining/piping programs together.

Tar has a parameter to do the xz step too on compression, and it's no problem on extraction either. So really it's mostly transparent to the user that it's a two layered file compression.

32

u/futlapperl Mar 12 '21

A 7z will not retain Linux file permissions.

Ah, interesting! That's useful to know.

And yeah, I agree, tar sticks to the Unix philosophy of "Do one thing, but do it well." better than 7z.

17

u/Kissaki0 Mar 12 '21

And yeah, I agree, tar sticks to the Unix philosophy of "Do one thing, but do it well." better than 7z.

It’s kind of ironic though how in the next sentence I said tar can do that with a parameter. ;-)

Manually piping and combining things is not very viable to end users. A parameter on a program is much easier to use. Even if the technical implementation will be separated again, the user interface isn’t. I don’t even know if tar embedded the other compression libs statically or uses shared libs or the other binaries.

40

u/Tm1337 Mar 12 '21

I don't want to shoehorn this in, but it is as relevant as it gets.

https://xkcd.com/1168/

→ More replies (1)

24

u/barsoap Mar 12 '21

It took literal ages until GNU came around and made tar's x option auto-detect the presence of compression. Before that you had to additionally specify z or j for gz and bzip2, xz is J I think auto-detect has been available for about as long as that.

Hmm. I just tried it, at some point it must also have stopped to operate on /dev/tape if you don't specify a file.

→ More replies (7)
→ More replies (3)

21

u/spider-mario Mar 12 '21

7-zip lets you choose which files to compress together and with which method. For example, you can have an archive with a bunch of HTML files compressed together with LZMA + a big text file compressed on its own with PPMd + a few PDFs stored without compression. You can then read the TOC without decompressing anything, and if you only need one of the HTML files, you need to decompress the LZMA block that contains them, but you don’t need to care about the PDFs or the PPMd text file. You have flexibility from “each file compressed separately” (.zip) to “everything compressed together” (.tar.whatever), though still at file boundaries I believe.

→ More replies (1)

12

u/Chudsaviet Mar 12 '21

This is exactly what I meant when saying XZ is Unix-style stream compression. In Unix world, its more an advantage I think.

5

u/andynzor Mar 12 '21

The LZMA/XZ archive format was explicitly created to allow using the 7-zip algorithm with *NIX tools (more specifically, to fit more Slackware packages to a CD image). It used the LZMA SDK created by Igor Pavlov himself, with his knowledge and support.

4

u/afiefh Mar 12 '21

I wonder if the inadequacies of the XZ format were ever addressed.

→ More replies (1)

3

u/radarsat1 Mar 12 '21

so does every other archiving program

well, all other archiving programs except most archiving programs typically used in Linux. gzip and bzip2 work the same way, on a single file. You can use gzip, bzip2, and xz on a tar in one command using options to "tar".

3

u/[deleted] Mar 12 '21

.xz doesn't seem to be an archive format

It actually is one, but it's not a good archive format.

Not sure if there are any notable advantages.

Random file lookup is one advantage of the combined formats.

4

u/futlapperl Mar 12 '21

I just thought about this. Can you even take a look at the directory structure of the files within a .tar.gz without decompressing the entire thing? Doesn't seem like it would be possible.

6

u/[deleted] Mar 12 '21

nope, tar has no index unlike eg. zip

→ More replies (3)

4

u/beefcat_ Mar 12 '21 edited Mar 12 '21

More user friendly seems like an advantage. It may not seem like much, but making a task work similarly to how it has on other platforms for decades is really helpful for new users.

Linux has always suffered from a lack of good GUI compression/archiving tools so a native version of 7-zip will be welcome if the file manager component makes its way over.

13

u/jyper Mar 12 '21

Linux has had graphical archive programs for gnome and kde that support most common archive formats for a long time

→ More replies (1)

7

u/dreamer_ Mar 12 '21

Linux has always suffered from a lack of good GUI compression/archiving tools so a native version of 7-zip will be welcome if the file manager component makes its way over.

In Gnome:

  • right click on a directory

  • Click "Compress"

  • select .tar.xz (or .zip or .7z - they all have been supported for years)

  • click "Create"

GUI on Linux is simple and effective.

→ More replies (1)
→ More replies (5)
→ More replies (2)

20

u/eyal0 Mar 12 '21

You can't just compare compression ratioa. You have to look at the time spent on operations.

One algorithm can dominate smith is it's better in at least one measure and no worse in all the other measures.

13

u/futlapperl Mar 12 '21

The article I posted takes time spent into consideration.

6

u/smiler82 Mar 12 '21

You can't just compare compression ratioa. You have to look at the time spent on operations.

Which is why we use http://www.radgametools.com/oodlekraken.htm for compressing our bulk content in games.

2

u/YM_Industries Mar 12 '21

That doesn't include gzip, only bzip.

8

u/futlapperl Mar 12 '21

Correct me if I'm wrong, but gzip uses Deflate, which is covered.

6

u/YM_Industries Mar 12 '21

Oh my bad, you're right.

10

u/stbrumme Mar 12 '21

7zip supports Deflate as well. While *.7z is its default output format, it can generate *.gz files, too. These are actually a little bit smaller than those produced by GZIP and fully compatible to GZIP. (although not as small as Zopfli)

9

u/LinAGKar Mar 12 '21

Don't confuse the 7zip program with the 7z file format. You can use 7z on Linux with other programs (or xz, which also uses lzma), and you can use other file formats with 7zip, including AFAIK gz.

31

u/nrcain Mar 12 '21

You can just look up the compression ratios between the two formats. Gzip (.gz) and 7-zip (.7z) are the exact same thing on both Windows and Linux. So their differences are the same on either platform.

To clarify though: 7z has been available on linux for pretty much as long as the official "7-zip" program has been on Windows. The 7z spec was never closed source I don't think.

So this provides no new capability to Linux really, just another option for the same format that was already supported for a long time.

7

u/Hjine Mar 12 '21 edited Mar 12 '21

So this provides no new capability to Linux really

It's not about compression algorithm but the software that support wide range of antilogarithms/ file extension, one of first thing I suffered while testing Linux first time is decompression my .rar files, same nightmare when I run Linux servers first time, I could not find command line tools that support all extension that detect the algorithm easy with simply uncompress command even uncompress .zip file were not supported by default .

5

u/99drunkpenguins Mar 12 '21

Linux archive managers are extensible. Rar is a proprietary format so they can't include support by default in some regions.

That said theres, rar, 7z, &c extensions that can be installed to add support.

5

u/Bakoro Mar 12 '21

Here is at least one comparison: https://leadsift.com/7zip-gzip-compression-speed/

It seems like 7zip compresses better, but with more overhead, while gzip(zlib) is much faster overall.

Memory generally isn't a problem these days, so unless you're in some strange restricted environment, using 7zip (or any Lzma derived compression) is probably going to be better overall.

7

u/dreamer_ Mar 12 '21

7zip has better compression ratio than zip and gzip, but that's no wonder really.

In my experience: 7zip is worth using only on Windows really. On Linux we have xz and zstd, and both give better results, sometimes much, much better.

3

u/99drunkpenguins Mar 12 '21

I personally don't think it has a place on linux. We already have 7z extensions for all the main archive managers.

I use 7z files on linux all the time.

It feels odd to have yet another archive manager on linux when we already have dozens of very good ones thst have extensibility to new formats.

2

u/awelxtr Mar 12 '21

I like gzip on a single basis: ubiquity

2

u/TryingT0Wr1t3 Mar 12 '21

bsdtar now ships by default on Windows, so I just use tar on Windows too. Bonus unix file permissions set on Windows for shipping things!

→ More replies (4)

35

u/Hjine Mar 12 '21

21.01 alpha 2021-03-09


  • The command line version of 7-Zip for Linux was released.

  • The improvements for speed of ARM64 version using hardware CPU instructions for AES, CRC-32, SHA-1 and SHA-256.

  • The bug in versions 18.02 - 21.00 was fixed: 7-Zip could not correctly extract some ZIP archives created with xz compression method.

  • Some bugs were fixed.

166

u/[deleted] Mar 12 '21

I forgot that 7-zip isn't available in Linux. Very nice!

250

u/nrcain Mar 12 '21

The 7z format has been available on Linux for pretty much as long as 7-zip has existed. Under other open source implementations, but fully compatible. This is only an offering from the original dude from the format, I suppose.

44

u/andrewfenn Mar 12 '21

Thanks I was confused by this news as I've been using 7zip on linux for years.

2

u/[deleted] Mar 12 '21

Same. I always have an issue, though, when taking a 7z package from Windows and extracting to Linux. I almost always get filenames that have issues even if they are simple names. Sometimes it just fails entirely.

4

u/liquidpele Mar 12 '21

Ehhh.... the lzma format is, but 7z is harder to get working and that’s what has multi file indexing which is vastly more useful.

15

u/[deleted] Mar 12 '21

p7zip.

39

u/jcelerier Mar 12 '21

... but it has been, for, like, years ? It was in Debian Jessie released in 2015 (https://packages.debian.org/fr/source/jessie/p7zip)

41

u/nzodd Mar 12 '21 edited Mar 12 '21

But also years before that. https://sourceforge.net/projects/p7zip/files/p7zip/ lists a version 0.80 from 2004. This is the unofficial p7zip project by Mohammed Adnène Trojette.

29

u/fatalicus Mar 12 '21

Did people not bother reading the article?

As the p7zip developer has not maintained their project for 4-5 years, 7-Zip developer Igor Pavlov decided to create a new official Linux version based on the latest 7-Zip source code.

4

u/jcelerier Mar 12 '21

... how does that contradict the fact that 7zip was already available ? Even if it's a different implementation

9

u/GimmickNG Mar 12 '21

because "official 7zip" wasn't available.

22

u/jeanfrancis Mar 12 '21

The oldest reference I could find is version 4 that was released in 2005: http://p7zip.sourceforge.net/

11

u/AlwynEvokedHippest Mar 12 '21

I heard talk in a thread on a Linux sub that it hasn't been updated since 2016, they can't get in touch with the old maintainer, and has some inconsistencies with newer versions of 7z.

Edit: https://reddit.com/r/linux/comments/m2w42d/_/gqms06n/?context=1

1

u/Marls_LeTort Mar 12 '21

ye who needs 7-zip when I can just type tar -<smash head into keyboard>

49

u/bundt_chi Mar 12 '21

Love 7-zip ! Thank you so much for doing what you do.

21

u/Bakoro Mar 12 '21

It's great that this is being officially released on Linux, I've been using it for years on Windows, and I've missed it on Linux.

As maybe a bit of an aside, I feel like I must be missing something. I'm not anything like a Linux guru, but I learned C++ on Linux, and almost every other language I learned after that has been on Linux, except C# and my very first language, BASIC. All the serious non C# development I've done has been on Linux, because it's so much easier to do, from embedded systems to web development, to the point that I'm not even sure off the top of my head how I would go about doing some things in Windows.
Windows always seems to take an extra step or an extra hoop, especially for C++ based apps.
Why is it apparently so difficult to release utility applications for Linux?

I get it for programs which heavily lean on graphics. Graphics, Nvidia especially, is geared toward Windows from the ground up. Utility stuff though, anything that is primarily text and data based, seems like it should be dead simple to do a Linux release.

Maybe it had just been an accident of coincidence, but Windows seems to be more complicated to program against, unless you're using Windows specific languages and tools like .Net languages with Visual Studio (which is admittedly a very nice combo).

44

u/vattenpuss Mar 12 '21

Windows is a horrible environment to develop in but easy to develop for. Linux is a wonderful environment to develop in but hard to develop for (if you want to package your software for many distributions).

22

u/[deleted] Mar 12 '21

Flatpak and AppImage formats make Linux development a breeze these days. Fuck Snap though.

20

u/jess-sch Mar 12 '21

periodic reminder that while snap claims to be universal packaging for all of Linux, it only supports a single store (whose backend is proprietary and fully controlled by Canonical) and the installation instructions include great ideas like "download this AUR package and build it from source" or "download snap from this third party repository and don't forget to disable SELinux", and oh the sandboxing only works if you use AppArmor (so that's pretty much only Debian, Ubuntu, and SUSE)

3

u/Muoniurn Mar 13 '21

I don’t see what problems do flatpak and appimage solve. They try to solve the dependency hell problem, but they do so badly, although I give it to flatpak that they are also trying to solve the proper sandboxing problem which is great. But then they should focus on that part.

I believe the whole linux ecosystem should move towards the superior nix way of deterministic dependency management, which is truly novel.

7

u/c-smile Mar 12 '21

Windows is a horrible environment to develop in

I have quite contrary experience.

I am developing Sciter for various platforms. Windows, MacOS, Linux and others.

Windows is my primary development platform. For many reasons. Especially in and for GUI development when you deal not just with linear command line style code but with event handlers and other highly async stuff.

We all should agree that Visual Studio is the best IDE ( combination of editor + debugger ) around especially considering its performance. In fact many Open Source projects are done primarily in VS with secondary Linux ports.

The worst dev platform is MacOS, at least for me personally. XCode is too slow and not that native dev friendly. And unfortunately for some GUI dev tasks it is unavoidable.

2

u/vattenpuss Mar 12 '21

I’ve been a professional for over a decade, working on many projects at several different companies, sometimes using macOS or Linux but most often Windows.

There are some great Windows tools sure, but you feel like a carpenter with three great tools instead of a hundred good tools.

I never really used Xcode so I can’t say if it’s good. At my last two jobs I have been using Visual Studio a lot though, and it never really seemed snappy to me (although that might be because AAA game code bases are huge and/or C++ builds are dog shit to organize).

As for building GUIs specifically, I was never as productive as when building with Smalltalk. Both the language, frameworks and the tools are built for it (and debugging was awesome).

1

u/Muoniurn Mar 13 '21

Visual studio is so slow that I go out of my way to not use it. I don’t know if debugging is slow on windows due to some OS constraint but it is plain not usable, I compile and try a program 3 times before windows finishes a debug start. If I must be on windows I use clion, or any other jetbrains IDEs that are cross platform and actually fast compared to VS.

→ More replies (1)

11

u/whichton Mar 12 '21

Windows always seems to take an extra step or an extra hoop, especially for C++ based apps.

I find that odd, given that VS is the best C++ IDE you can get. It has far better coding / debugging experience compared to anything on Linux.

5

u/lorlen47 Mar 12 '21

JetBrains CLion has entered the chat

14

u/KERdela Mar 12 '21

And my ram left the chat

2

u/Muoniurn Mar 13 '21

Compared to vs? At least I don’t have time to brew a coffee while it tries to handle a click and doesn’t corrupt my projects all the time.

16

u/lelanthran Mar 12 '21

Maybe it had just been an accident of coincidence, but Windows seems to be more complicated to program against, unless you're using Windows specific languages and tools like .Net languages with Visual Studio (which is admittedly a very nice combo).

Win32 APIs are painful to use, compared to standard C or POSIX APIs. Linux-specific APIs are also much easier than Win32 APIs.

A few examples: In Win32, creating a new process uses one of CreateProcess(), CreateProcessAsUser(), CreateProcessWithLogin() (all with 2 variants each (prefix-A or prefix-W)) which takes up to 11 arguments, some of which are structs with up to 18 fields.

A new developer will have to read and understand all 29 fields involved in CreateProcess before they can determine which of them can be NULL.

In unixen (POSIX), create a new process is by calling fork() which takes no parameters and then calling exec() which takes only the program name and arguments.

Another example - compare getting the network interface list on Linux (linux-specific calls): With Win32 you call the function multiple times (allocating more length in the destbuffer each time) until it returns success, and then you iterate through the returned linked list, which also has a field that is a linked list that must be also iterated through, to get each interface's details.

Compare to getifaddrs() which is called only once (not in a loop until success), and returns a linked list of all interfaces+ip mappings.

The entire of the Win32 API is riddled with this sort of artificial complexity. It could be simpler, but nooooo.....

There's a lot more space for error when using Win32 APIs directly, so use C# instead.

39

u/whichton Mar 12 '21

In unixen (POSIX), create a new process is by calling fork() which takes no parameters and then calling exec() which takes only the program name and arguments.

fork / exec vs CreateProcess is probably the worst example you can select. While CreateProcess is far from an ideal API, fork is definitely worse. Its simple for you, but it makes things very complicated under the hood. And then there are things which Windows does much better, like SEH for example.

→ More replies (9)

10

u/spider-mario Mar 12 '21

all with 2 variants each (prefix-A or prefix-W)

Perhaps noteworthy is that while Microsoft used to recommend the -W functions for Unicode support via WCHAR and UTF-16, they recently also introduced the possibility of using the old -A functions + a manifest to make UTF-8 the “local” code page: https://docs.microsoft.com/en-us/windows/uwp/design/globalizing/use-utf8-code-page

20

u/mudkip908 Mar 12 '21

As a Windows anti-fan, I readily admit that the Win32 API is much better than Linux where oftentimes the only "API" is "here, parse this text file". fork also sucks ass as the other commenter mentioned.

8

u/Takeoded Mar 12 '21

A new developer will have to read and understand all 29 fields involved in CreateProcess before they can determine which of them can be NULL.

this USED to be better, but microsoft has been shitting on their own documentation, so it's much harder nowadays.

here is the OLD documentation for SetWindowPos:

BOOL WINAPI SetWindowPos(
  _In_      HWND hWnd,
  _In_opt_  HWND hWndInsertAfter,
  _In_      int X,
  _In_      int Y,
  _In_      int cx,
  _In_      int cy,
  _In_      UINT uFlags
);

you can instally tell: _In_: this argument can not be null, and it will be read. _In_opt: this argument IS OPTIONAL, can be null, and will be read. they also have Out (this argument will be written to and is not optional) and Out_opt (this argument is optional, and will be written to), and In_out and In_out_opt

here is the new documentation that microsoft has been shitting on,

BOOL SetWindowPos(
  HWND hWnd,
  HWND hWndInsertAfter,
  int  X,
  int  Y,
  int  cx,
  int  cy,
  UINT uFlags
);

in this new documentation, is hWnd optional? i have no idea; is hWndInsertAfter optional? no idea~

i have no idea why microsoft removed it, and i wish man7/linux programmer docs had the same :(

→ More replies (1)

11

u/MeanCommon Mar 12 '21

Does that mean they now support rar/ unrar for Linux? (I use the one for Windows so I am not sure)

19

u/Phrygue Mar 12 '21

RAR? I used ARJ while we're time tripping.

10

u/nzodd Mar 12 '21 edited Mar 12 '21

Oh man, I remember getting Doom in an ARJ file way back when. And Warlords II

2

u/jdiegmueller Mar 12 '21

PKARC for the win.

1

u/downvoted_dev Mar 12 '21

Thanks, you just gave me Vietnam style flashbacks when getting CRC errors on disk 8 of 10 while extracting a game you where desperate to play.

→ More replies (2)

1

u/palordrolap Mar 12 '21

But did you ever use JAR, ARJ's successor? Not to be confused with tha JARs that are Java ARchives, used by the Java language, which are actually ZIP files.

It arrived on the scene around the same time RAR/WinRAR, and that never-ending trial period basically killed JAR and everything else that was struggling to become a reality at the time.

7

u/distark Mar 12 '21

That has existed since the 90s

7

u/palordrolap Mar 12 '21

A free, command line, unrar tool has been available on Linux for a long time. Alexander Roshal himself is responsible for the free unpacker existing.

Creating RARs is a different matter; that requires a license.

That's primarily why 7zip gained a foothold because it's the most similar in terms of features while being free software.

1

u/o11c Mar 13 '21

This changes nothing, but you misunderstand the present state.

The new 7-zip packaging is no different than the old 7-zip packaging: the RAR extraction part is non-free. (it's still possible to install if you don't care, of course).

There are a couple of separate programs called unrar. One is unencumbered but only supports ancient flavors of RAR; another supports all RARs but is non-free.

However, the unar program somehow both supports "modern" RAR formats and is FLOSS.

There remains no unencumbered way to create a .rar file, but who cares? It's a bad format and you shouldn't use it.

0

u/[deleted] Mar 12 '21

[deleted]

39

u/[deleted] Mar 12 '21

That’s messed up. I hate these proprietary formats so much

26

u/LinAGKar Mar 12 '21

I don't see when you'd ever want to compress something as rar though.

16

u/[deleted] Mar 12 '21

As far as I can tell, RAR was favoured by many because it could do split archives and parity files. I'm not sure if it's still used for that these days. Other that it was considered more 1337 than zip.

→ More replies (3)

4

u/[deleted] Mar 12 '21

True, but I suspect part of the reason is because it’s proprietary, so it didn’t get widespread like zip, tar, etc.

3

u/ham_coffee Mar 12 '21

From what I've read it's a bit more resilient than other formats.

→ More replies (1)

7

u/send_me_a_naked_pic Mar 12 '21

as it legally cannot do so

Not in Europe, I think. Software patents are not valid here.

0

u/[deleted] Mar 12 '21

[deleted]

10

u/pelrun Mar 12 '21

You can't copyright a algorithm or a file format, only an implementation.

7

u/fissure Mar 12 '21

The decompressor source code license says you can't use it to create a compressor. Nobody's had the expertise and motivation to do a clean room reverse engineering of it.

2

u/MeanCommon Mar 12 '21

Ahh I see, thanks!

6

u/saladpie Mar 12 '21

We are truly living in the future

3

u/ScottIBM Mar 12 '21

Thanks for this! 7-zip is an awesome tool <3

3

u/Neo-Neo Mar 12 '21

Hopefully it replaces the abandoned p7zip

4

u/Aceflamez00 Mar 12 '21

The Year of the Linux Desktop is among us!

2

u/epic_gamer_4268 Mar 12 '21

when the imposter is sus!

2

u/[deleted] Mar 12 '21

This is good news!

4

u/augugusto Mar 12 '21

Wait. Wait. Hold on. Where the hell does the 7z command come from then? I just assumed it was 7zip

144

u/halter73 Mar 12 '21

Linux already had support for the 7-zip archive file format through a POSIX port called p7zip but it was maintained by a different developer.

This is the second sentence of the article.

→ More replies (27)

15

u/[deleted] Mar 12 '21

Afaik it's just an open source tool that works with the 7z format

1

u/[deleted] Mar 12 '21

I know this must have been a lot of work, but with so many decent utils on Linux, I'm wondering why bother?

1

u/VFZeroOo Mar 12 '21

Seconded

1

u/vplatt Mar 12 '21

7z support? Just guessing.

2

u/lordcirth Mar 12 '21

As the article says, p7zip has been around forever. I didn't even know it wasn't official.

5

u/vplatt Mar 12 '21 edited Mar 13 '21

Hmm..

As the p7zip developer has not maintained their project for 4-5 years, 7-Zip developer Igor Pavlov decided to create a new official Linux version based on the latest 7-Zip source code.

.

I mostly looked at ancient p7zip has unpatched issues that can easily be found by fuzzing. They are not necessarily exploitable. 2/n

— Christian Blichmann (indistinct radio chatter) (@AdmVonSchneider) March 11, 2021

Edit: So, it's not "7z support", but rather "continuing 7z support on Linux while preventing potential security issues".

1

u/Trukour Mar 12 '21

wait… does this mean I get to use spaces now?!!

1

u/LinAGKar Mar 12 '21

The biggest thing I'm still missing from 7-zip is the autodetect subfolder feature Ark has.

1

u/joliesleftnipple Mar 12 '21

How is Ark (on Manjaro) different from 7zip?

1

u/big-blue-balls Mar 12 '21

MacOS please :( I just wanna preview zip files without a command line tool or paying $50 for betterzip..

1

u/[deleted] Mar 12 '21

[removed] — view removed comment

1

u/big-blue-balls Mar 13 '21

Doesn't allow previewing files..

1

u/namekuseijin Mar 12 '21

gunzip, meet 7zip. And shoot.

1

u/codysea Mar 12 '21

That's a really good news for everybody

1

u/Cmdr_Salamander Mar 12 '21

I hope this wasn't taking development time from 8-Zip.

Edit: was trying to be funny, but apparently 8-Zip is actually a thing.

1

u/[deleted] Mar 12 '21

Awesome to hear can't wait to install it.

1

u/don_cornichon Mar 12 '21

Going by the title, I thought they released the first 'official' version of Linux and that all previous versions have been unofficial.

1

u/[deleted] Jan 08 '22

Windows always seems to take an extra step and that, especially for C++ based apps.

I find that odd, given that VS is the best C++ IDE you can get. It has far better coding / debugging experience compared to anything on Linux.

1

u/shayanzafar Mar 12 '21

I still remember how complex windows.h looked vs all of the Linux libraries in my first year of college C programming course. I can only imagine that scales out to their other complex and poorly documented APIs

0

u/[deleted] Mar 12 '21

does this mean it's the year of the linux desktop?

-10

u/minus_minus Mar 12 '21

I’m not sure that point of this is. It seems like all the compression formats 7Zip handles are already represented in other open source tools.

9

u/[deleted] Mar 12 '21

cross platform apps are cool. they make people's life much easier when they need to shift from windows to linux or viceversa.

3

u/minus_minus Mar 12 '21

That’s true. Personally, I’ll only use 7-zip on windows because the built in archiver sucks.

2

u/[deleted] Mar 12 '21

And windows cannot handle all the varieties of archives tha 7zip can help handle. pretty much everyone uses stuff like 7zip or VLC or foobar or Firefox/Chrome instead of the inbuilt variants

→ More replies (1)

2

u/[deleted] Mar 12 '21

"Lol look at this fucking idiot releasing official software for Linux instead of relying on third parties to do it all. What a fucking loser."

9

u/downvoted_dev Mar 12 '21

Relax. That is not what OP is saying.

→ More replies (1)

-2

u/downvoted_dev Mar 12 '21

Sane opinions getting downvoted. Reddit in a nutshell.

3

u/AtomicRocketShoes Mar 12 '21

It's probably downvoted because it shows they likely didn't read the first few sentences of the article and it's easier to downvote than to fix the problem of people not doing basic reading. The reason this is being released is the current linux tools have been unmaintained for years.

Linux already had support for the 7-zip archive file format through a POSIX port called p7zip but it was maintained by a different developer.

As the p7zip developer has not maintained their project for 4-5 years, 7-Zip developer Igor Pavlov decided to create a new official Linux version based on the latest 7-Zip source code.

2

u/minus_minus Mar 12 '21

Also, it’s not free/open because it uses the restricted unrar library.