View Issue Details

IDProjectCategoryView StatusLast Update
0000538fileGeneralpublic2024-07-07 14:42
Reporterdajhorn Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version5.45 
Summary0000538: RAR version 7 is not recognized
DescriptionThe file utility incorrectly recognizes RAR v7 files as v5 files.
Steps To Reproduce$ rar a -md8G -r v7test.rar *

$ file v7test.rar
v7test.rar: RAR archive data, v5

$ file --version
file-5.45
magic file from /etc/magic:/usr/share/misc/magic

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
Additional InformationRAR files with dictionaries larger than 4 gigabytes are always version 7. The expected result is:

$ file v7test.rar
v7test.rar: RAR archive data, v7
TagsNo tags attached.

Activities

dajhorn

2024-07-06 16:11

reporter  

WinRAR 7 Screenshot.png (6,826 bytes)   
WinRAR 7 Screenshot.png (6,826 bytes)   

jsummers

2024-07-06 19:20

reporter   ~0004059

Somebody correct me if I'm wrong, but the format is still named RAR 5. It's covered in the document titled "RAR 5.0 archive format" (https://www.rarlab.com/technote.htm -- search for "RAR 7.0").

It might be good if 'file' printed something like "RAR archive data, v5, RAR v7 to extract" for such files. Though I don't think that would be simple to do, in part because of RAR5's variable-length integers.

dajhorn

2024-07-07 14:20

reporter   ~0004060

The RAR application version is often conflated with the RAR format version. In this case:

* WinRAR 5 is format 5 version 0.
* WinRAR 6 is format 5 version 0.
* WinRAR 7 is format 5 version 1 (and possibly format 5 version 0 with a large dictionary).

The enduser won't understand this implementation detail and will reasonably expect to see "v7" in the `file` result.

Per the rarlab.com technical note, doing two bitwise tests in the existing service header are likely enough to recognize the latest archive revision:

1. Check the format and version:
IF { compression_information & 0x003f > 0 } THEN RETURN v7

2. Check for a large dictionary:
ELSE IF { compression_information & 0x7c00 > 15 } THEN RETURN v7

dajhorn

2024-07-07 14:42

reporter   ~0004061

BTW, you are right that the `vint` type makes adding this check non-trivial. Dunno how the RAR subblock test in Magdir/archive might be modified to make it happen.

Issue History

Date Modified Username Field Change
2024-07-06 16:11 dajhorn New Issue
2024-07-06 16:11 dajhorn File Added: WinRAR 7 Screenshot.png
2024-07-06 19:20 jsummers Note Added: 0004059
2024-07-07 14:20 dajhorn Note Added: 0004060
2024-07-07 14:42 dajhorn Note Added: 0004061