Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAR 5.0 support needed #3

Open
VictorVG opened this issue Apr 23, 2019 · 18 comments
Open

RAR 5.0 support needed #3

VictorVG opened this issue Apr 23, 2019 · 18 comments

Comments

@VictorVG
Copy link

VictorVG commented Apr 23, 2019

RAR 5.0 format support needed, Your can see example for unpack code in to source tarball unrarsrc-5.7.4.tar.gz (ftp://Anonymous:user@server.com@ftp.rarlabs.com:21/rar/unrarsrc-5.7.4.tar.gz) on FTP RarLabs.com. Starting on Rar/WinRAR v5.00 (22.08.2013 year) RAR5 is default compression format fo rar archives (see WhatsNew.txt for details and have different in to RAR 2.9 (used up to Rar v2.5 - Rar v4.20 as default) format.

Please, update unarr library for support this Rar archive default format.

@selmf
Copy link
Owner

selmf commented Apr 23, 2019

Yes, RAR5 is needed. I am working on it, but this takes time. The structure and algorithms of the new format are different from the previous versions and I can't use the unrar source code as a reference (license problems), so I can't really tell when this will be finished.

@VictorVG
Copy link
Author

Your can see as example source Far Manager plug-in MultiArc - rar.fmt - rar.cpp - this module used for detect any RAR version. But RAR5 have large size of SFX module ~ 200 - 250 Kb then old RAR format - ~ 80 - 90 Kb in to start of archive.

@VictorVG
Copy link
Author

I asked for a consultation from the RAR developer - EugeneRoshal (Eugene Roshal) and this is what he answered:

EugeneRoshal (Eugene Roshal)

We have laid out the sources of our unpacker under our license. The same 7-Zip calmly uses them with the addition of a link to the UnRAR license in its License.txt.

If they include the "unRAR license restriction" clause in their license, as is done in 7-Zip license.txt, they can use the unrar source code.

@selmf
Copy link
Owner

selmf commented Apr 24, 2019

No, I can't use it. The whole point of unarr as a rar extraction library is that it provides rar support without the UnRAR license restriction. This allows other open source software that can't use the UnRAR license to use unarr instead. If I start using UnRAR code I have to add the license restriction and unarr will be useless for these projects, including SumatraPDF.

FYI, the current rar extraction code is based on reverse engineering done by TheUnarchiver and they have added rar5 support, so I can use that as a reference.

@VictorVG
Copy link
Author

It is clear that there are already legal issues, and I am a computer systems engineer and I don’t undertake to give advice to someone else’s area of knowledge in order not to harm.

@selmf
Copy link
Owner

selmf commented Apr 24, 2019

Don't worry, it's not that bad. I have no plans to implement a rar compressor, so Mr. Roshal shouldn't have any reasons to complain about unarr. I just have to be careful to avoid using the UnRAR licensed code, so I don't 'taint' the project.

@VictorVG
Copy link
Author

On this and we stumbled. We can help with technology, but licensing issues are beyond our power and we gave a hint on the example of the algorithm - and as it turned out both think the same way - take the algorithm from the 7-Zip library as an example. There is also the main thing - methods of working with a container, and they are usually the most difficult to come up with.

@selmf
Copy link
Owner

selmf commented Apr 24, 2019

Yes. I have some support for rar5 on a local, unpublished branch. Parsing rar5 and reading stored files is already possible, but extraction of compressed files is not as I'm still investigating the details of the algorithm and filters. I have TheUnarchiver as an example, but this is written in ObjectiveC, so understanding it is not straightforward for me. But I need this feature myself, so it will happen sooner or later.

@VictorVG
Copy link
Author

In theory, it is better to look at the algorithms in unrar - it’s on c / C ++ and I think it’s clearer, the very way of recognizing with parsing the signature (the format of the RAR container was changed in RAR 1.4, RAR 1.50, RAR 2.50 and RAR 5.00) is probably easier to see in the UnRAR plugin - everything is commented out in contrast to my habits :) (I can easily write several tens of thousands of microcode lines and no comments - this is usually faster, and then when I redid the block scheme itself and the old microcode doesn’t seem to be necessary - it’s wise to look at the inputs of logic elements, adders and triggers with encoders even e e in relation to sinrosignalam? Faster and easier to write new :))

@tm681
Copy link

tm681 commented Sep 5, 2019

Виктор, я очень извиняюсь что не по теме пишу - не знаю Ваш емейл.
Сможете ли помочь с проблемой - не копируются сессии в панель Netbox -
вот тут я расписал подробно https://forum.farmanager.com/viewtopic.php?f=5&t=6317&start=2480 в конце темы:
Far 3.0.5445 x64 (NetBox 2.4.5.531)

Не могу импортировать в NetBox фтп-аккаунты.
С него можно скопировать, в него - нельзя. Нажимаю F5, появляется красная табличка
"Import session(s) from selected file(s)?"
Нажимаю "Да" - ничего не происходит.

Переименование папок (shift-F6) также не срабатывает, переименовываются только фтп-аккаунты.

@VictorVG
Copy link
Author

VictorVG commented Sep 5, 2019

@tm681

Ответил на багтрекере NetBox michaellukashov/Far-NetBox#291 куда и прошу перейти по всем вопросам NetBox. Так же можно задать мне вопросы на моём багтрекере .

@selmf

Please, sorry on offtopic. I move this question in to NetBox bug-tracker.

@pashifika
Copy link

@selmf
Here is a go-based implementation:
https://github.com/nwaples/rardecode/blob/master/decode50.go

@dejlek
Copy link

dejlek commented Sep 9, 2022

Could perhaps a fallback to using unrar/rar (if present on the system) tools be an option? No legal issues with that approach either.

@selmf
Copy link
Owner

selmf commented Sep 24, 2022

Thanks for your continued interest. There are two things that I want to finish before I re-tackle the RAR5 support:

  • Release the current beta
  • Add SIMD acceleration for CRC32 (optional)

Thankfully, the amount of open source software supporting rar5 has increased so I have some references to work with. I do not plan to add any dependencies on a command line tool but the option to provide a fallback using libunrar (based on official rar) or an open source implementation as fallback is a possibility.

@Dennis-Zhang-SH
Copy link

Any updates on this issue?

@VictorVG
Copy link
Author

VictorVG commented Jul 1, 2023

/rar/rar.c str 205 - 224:

ar_archive *ar_open_rar_archive(ar_stream *stream)
{
    char signature[FILE_SIGNATURE_SIZE];
    if (!ar_seek(stream, 0, SEEK_SET))
        return NULL;
    if (ar_read(stream, signature, sizeof(signature)) != sizeof(signature))
        return NULL;
    if (memcmp(signature, "Rar!\x1A\x07\x00", sizeof(signature)) != 0) {
        if (memcmp(signature, "Rar!\x1A\x07\x01", sizeof(signature)) == 0)
            warn("RAR 5 format isn't supported");
        else if (memcmp(signature, "RE~^", 4) == 0)
            warn("Ancient RAR format isn't supported");
        else if (memcmp(signature, "MZ", 2) == 0 || memcmp(signature, "\x7F\x45LF", 4) == 0)
            warn("SFX archives aren't supported");
        return NULL;
    }

    return ar_open_archive(stream, sizeof(ar_archive_rar), rar_close, rar_parse_entry, rar_get_name, rar_uncompress, NULL, FILE_SIGNATURE_SIZE);
}

@milahu
Copy link

milahu commented Aug 2, 2023

rant against rar's shitty license

honestly, fuck Eugene Roshal and his shitty license.

i have never accepted his license,
and i have never accepted any copyright law or patent law.

lets move to the darknet (example: darktea), and reverse-engineer winrar,
to write a fully-open-source rar compressor and decompressor.

possible names:

  • openrar
  • fossrar
  • fuckeugenerar
  • rarminuseugene

it should be possible to use a cracked winrar, to generate a corpus of test files...
it should be possible to reverse-engineer winrar with ida/ghidra, to get the algorithms...

@VictorVG
Copy link
Author

VictorVG commented Aug 2, 2023

milahu

You first look at what and why. With the support of the RAR5 in unaar, the "problem" comes down to the choice of a license, and the source of the unpacker has long been on ftp.rarlabs.com/rar/unrarsrc-*.tar.gz or is this discovery for you?

You read the issues and you will see everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants