pyload / pyload

The free and open-source Download Manager written in pure Python
https://pyload.net
Other
3.28k stars 709 forks source link

use libarchive instead of unrar, to avoid unrar's unfree license #4346

Open milahu opened 1 year ago

milahu commented 1 year ago

unrar: unfree license

UnRAR source code may be used in any software to handle RAR archives without limitations free of charge, but cannot be used to develop RAR (WinRAR) compatible archiver and to re-create RAR compression algorithm, which is proprietary.

libarchive: free license (2-clause BSD license)

libarchive also has python bindings: https://github.com/Changaco/python-libarchive-c

import os
import libarchive
os.chdir("/tmp")
libarchive.extract_file("archive.rar")

ideally, unrar should be kept as a fallback option, when libarchive fails to extract a rar archive

mihawk90 commented 9 months ago

ideally, unrar should be kept as a fallback option, when libarchive fails to extract a rar archive

If you're gonna do that, then you're not avoiding anything. You're just creating more complexity in the code for no reason, which leads to more maintenance work and more potential bugs. In other words: You'd gain nothing.

If you want to avoid RAR's unfree license the only way to do that is to stop downloading RAR archives.

Besides: the 7-zip extractor already handles RAR-archives if unrar is not present, so if you just don't install unrar then you're already avoiding it, with all its downsides: https://github.com/pyload/pyload/blob/695bb70cd88608dc4fee18a6a7ecb66722ebfd8f/src/pyload/plugins/extractors/SevenZip.py#L42

milahu commented 9 months ago

this is really just a nitpick about software licenses (sorry)

the 7-zip extractor already handles RAR-archives if unrar is not present

7z uses the original unrar code in Rar1Decoder.cpp Rar2Decoder.cpp Rar3Decoder.cpp Rar5Decoder.cpp so 7z-with-rar-support has the same "unfree" license as unrar

libarchive implements unrar from scratch in archive_read_support_format_rar.c archive_read_support_format_rar5.c so it does not have the "unfree" license of unrar

If you want to avoid RAR's unfree license the only way to do that is to stop downloading RAR archives.

nah, all licenses/copyrights/patents should be nullified so people like Eugene Roshal can no longer troll everyone else with their stupid license but that fix will take a while...

that people use rar archives to store already-compressed video/audio/image files is a different kind of stupid, but equally hard to solve... zip -0 would be the simplest fix but a "cracked" rar.exe is such a good container for computer virusses...