Skip to content

Instantly share code, notes, and snippets.

@Coldblackice
Forked from ATRescue/MozLZ4-garbage.md
Created September 15, 2022 12:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Coldblackice/8488cefc7d0e51475a333aca83c89594 to your computer and use it in GitHub Desktop.
Save Coldblackice/8488cefc7d0e51475a333aca83c89594 to your computer and use it in GitHub Desktop.
MozLZ4/JsonLZ4 is a moronic idea. Here's why.

MozLZ4/JsonLZ4 is a moronic idea. Here's why.

Written by ATrescue.

I am not implying the comperssion algorithm Lz4 is bad. But adding an Lz4 layer to JSON files was a terrible idea by Mozilla.

Since Firefox version 56 (which is the last non-quantum version of Firefox), the session files in the 📁 sessionstore-backups directory are no longer recovery.bak and recovery.json, but recovery.baklz4 and recovery.jsonlz4. They should have called it recovery.bak.lz4 and recovery.json.lz4, which would be more logical file names, but they should not have done it in first place. Also the folders 📁bookmarkbackups 📁crashes/store.json.mozlz4 📁datareporting is affected (intoxicated) by Lƶ4.

“If it isn't broken, don't ‘fix’ it” does not apply to everything (e.g. when improving something), but to this one, it certainly does apply.

Previously, Firefox session backups were stored in plain text (just like places.sqlite). But Firefox 56, released on 20170612, added LZ4 bulk, that made recovering lost sessions harder and more time-consuming to me. Some tools that were supposed to decode LZ4 did not work.

There is a lz4 scrounger by a GitHub user called Jscher2000 (Jefferson Scher), which is supposed to turn the “LZ4” information into plain text, but that one does not work properly and crashes the opened browser tab it is running inside.

At least, LZ4 does not erase information without warning like Google Chrome/Chromium did with Version 37 (20140905): removing ArchivedHistory file.

Comparison

Semi-Advantages and alleged advantages of LZ4

  • Slightly saves some disk space storage.
    • How much does it save? 10 MB? Are we in 1990?! 100MB? Are we in 2000? Even if plain text files cost me an additional 1 GB compared to LZcrap, I would gracefully rather have that much disk storage reserved for it instead of suffering from LZ4 garbage. In addition, modern file systems (including standard file systems since more than a decade: ext2, ext3, ext4, btrFS, NTFS, ZFS, etc…) offer transparent compression functionality, which defeats the alleged purpose of LZ4. We are in 2019 (as of writing this), not 199_. Why not compress browser cache and all configuation files altogether? Invalid upside. If that was a good decision, why not go ahead and save every file as LZ4? .mp4LZ4 .oggLZ4 .wavLZ4 .txtLZ4 .exeLZ4 .jpgLZ4 .iniLZ4 .htmLZ4 .htmlLZ4 .phpLZ4 .cssLZ4 .pngLZ4 .svgLZ4 .rtfLZ4 .flacLZ4 .ogvLZ4 .mp3LZ4 .docLZ4 .docxLZ4 .pdfLZ4 .xpsLZ4 .epubLZ4 .djvuLZ4 .cLZ4 .pyLZ4 .odtLZ4 .xlsLZ4 .mpgLZ4 .vobLZ4 .xmlLZ4 .tifLZ4 … … … . How about that?

just add LZ4!” – Mozilla

  • Save ⭐🌟a few seconds(!)🌟⭐ when doing a backup of the .mozilla or profile folder. Hooray! ̶A̶̶w̶̶e̶̶s̶̶o̶̶m̶̶e̶!
  • Save writing cycles on solid state drives?
    • This advantage is very, very marginial.
    • After this logic, browser cache should not exist.
    • As already mentioned, today's file systems have their own transparent compression. No need for LZ4.
    • Show me just one SSD that ever took damage from Firefox writing uncompressed session data to it.

LZ4 Disadvantages

LZ4's disadvantages outweigh the (nearly non-existent) advantages. By far.
When web-searching “LZ4” or “MozLZ4” or “JsonLZ4”, the reasons for why only negative experience reports and complaints come up is obvious. LZ4 was an unnecessary misstep exactly nobody asked for. Where are those people who praise mozLZ4? Exactly. In LimboLand.
(Show me any positive thing about mozLZ4 in the first ~25 results.)

  • Incompatible to all previous Firefox versions.
    • Firefox ≥56 is also not backwards-compatible to the plain-text format.
  • MUCH harder to find and retreive information from damaged media and file systems. ( https://support.mozilla.org/questions/1251399 )
  • Unsuitable gibberish for text/JSON editors pre-installed on every operating system and emergency boot disc.
  • More CPU usage (, although marginial. LZ4 is efficient and fast, but nothing comes close to plain text.)
  • Even if LZ4 had those alleged benefits, why use a proprietary format?
    • Both 7-Zip for Windows and the often precluded FileRoller in Linux Mint, Ubuntu and many other distributions do support standard LZ4!
    • But Mozilla decided to act like Apple: Proprietary garbage that is hard to work around. (.mozlz4; .jsonlz4; .baklz4 instead of .json.lz4 and .bak.lz4)
    • There is absolutely no reason at all which I can think of, to use a proprietary format. Why even bother creating a proprietary format if one can just take the existing, widely supported LZ4 or just stick to plain text? This logic is beyond me.
  • Someone named Barry Finkel (bsfinkel) in the Mozilla support community even said: “What I will do now is uninstall 56.0 and re-install 55.0;.3.”.

verdict

As you can see, MozLZ4 only creates headaches, trouble and issues and helps nobody. It is the exact opposite of innovation. There is absolutely no need for MozLZ4.
It does more harm than good.

And even if there were benefits in using that compression, how come they did not utilize the standard LZ4?! They created their own proprietary format called mozlz4. What. Were. They. THINKING?! (if at all) *facepalm*

Suggestion for Mozilla

  • Should have made LZ_crap_ optional and not mandatory.
  • (And yes, please scrap(e) add-on verification, which allows remotely crippling browsers. Add-on verification means a tiny bit of security for a HUGE headache.)
  • Most importantly: Please create a Twitter poll to make people vote whether they believe LZ4 bulk for Firefox is a good idea or pure plain text. (…only if you care about your community, of course.)
  • If LZ4 was actually beneficial, use the standard LZ4 supported by FileRoller, 7-Zip, PeaZip, WinRAR and tons of oher programs. Not your garbage MozLZ4 that is unsupported by existing, often pre-installed file compression/archival software.

This text is licensed under CC-BY-SA 4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment