Trying to open RAR 5 files results in "No images in '<archive>'" even if unrar (non-free) is able to open it and installed. Note that 7z cannot open such archives either:</archive>
[...] Open Error: Can not open the file as [Rar] archive
Errors:
Is not archive
An example archive can be created this way (see attachment):
Note the archive version number when listing the contents using
unrar:I guess that MComix prefers
7zoverunrar, hence the error. (I am not sure, though. Maybe it's because I don't havelibunrarinstalled.) Adding both unencrypted and encrypted RAR 5 archives to the test files might be helpful. (Currently, all rar files are RAR 4 files.)EDIT I just tested it on Windows and it seems that it is not an issue there. /EDIT
Last edit: Ark 2015-12-21
Yes, with a recent version of 7z it works fine. Unicode support is better for 7z, which why it's prefered over unrar.
Turns out: The dependecies are currently quite a mess. I tested all possible combinations, and these are the results:
Arch Linux
Y | - | - | - | - | Y
Y | - | Y | Y | -(!)| Y
Y | Y | - | Y | Y | Y
Y | Y | Y | Y | Y | Y
(A dash means "not available/not supported" while "Y" means "available/supported".)
Note the Y's in the first line: I can open RAR 4, RAR 5 and 7z without having one of the listed packages installed. (In other words, there might be false positives in the RAR 4 and RAR 5 columns due to a strange testing environment. Sorry.) Also note that as soon as I install
p7zip, I cannot open RAR 4 or RAR 5 anymore. If I also installunrar(which itself is able to open RAR 5), I can only open RAR 4 but not RAR 5 with MComix. The only configurations where I can open everything are those wherep7zipandlibunrarare installed.Debian Stretch (testing)
(Note: I left out 4 combinations since
p7zip-rardepends onp7zip-full.)RAR 5 is not supported at all but
unraritself is able to extract files from such archives. I guess this is due top7zip-rar(probably?) being unable to handle RAR 5. Note that this is quite bad for Debian users as they cannot open RAR 5 and 7z at the same time. Similar to Arch, installingp7zip-fulldisables support for RAR 4, unless it is re-enabled by also installingp7zip-rar.Another thing is that
unrar-freeitself is able to open RAR 4 archives but MComix with onlyunrar-freeinstalled is not. Certain things indicate that this is due to parsing errors. I will add another post here with more details later.TL;DR In other words, MComix does not try to use
unrarif extracting with7zfails. Retrying withunrarmight be an approach to work around this issue.Last edit: Ark 2015-12-22
I'm confused, how do you read your tables? Shouldn't you put formats on rows, and implementations on colums?
There is also Unicode support. And the fast that unrar-free does not support the same set of option (no extract to stdout...). And that's not taking also into account the possible differences in output...
Retrying is going to be hell, retrying on what type of error? Listing works, extracting may fails, or it may report a success, but have failed (with unrar-free)... We could differentiate the types returned by
archive_mime_type, like it's done forZIP_EXTERNAL/ZIP: instead ofRAR, return eitheirRAR3,RAR4, orRAR5.If we read byte 44 we can get the version of the format.
Or simply prefer only prefer 7z over unrar for Windows, and unrar over 7z for other platforms.
Or always prefer unrar over 7z.
Because without knowing the version of 7z plus wether or not rar support for 7z is available, we cannot decide which is better (7z or unrar), so...
Since 99% of Windows users will be using the distribution we provide, they'll have libunrar, so really, we should just go back to prefering unrar if libunrar is not available, using 7z as a last resort.
I am sorry for the confusion. Reading the tables works like this: The columns to the left show which packages are (not) installed, and the columns to the right show which formats are (not) supported when using this combination of (un-)installed packages. For example, on Debian, the 10th line reads "IF
p7zip-fullis installed andp7zip-raris installed andunraris not installed andunrar-freeis installed THEN RAR 4 is supported and RAR 5 is not supported and 7z is supported". (Actually, the source code of the tables looks nicer than the rendered versions.)The main issue here is that installing packages should only add support for archives, not remove it.
Thank you for your posts, they helped me thinking about this as well. Now, I think this approach might work best:
unrar-freeissue as this is currently too complicated. This means that Debain users who want to enjoy free-software-only setups will not be able to open RAR 4 or RAR 5 archives. However, this should not be a problem since themcomixpackages for Debian do not recommendunrar-freebut suggestunrar(non-free) anyway.unrar, but only if we encounter a RAR 5 archive andlibunraris not available.More formal (pseudocode):
This should not break anything.
(It might be the case that someone installs both
unrarandunrar-freeand for some reason, theunrarcommand refers to the free version instead of the non-free version. However, in this case, we cannot do much but merely suggest to make sure that theunrarcommand refers to the non-free version, or to removeunrar-free.)What do you think?
The differences between 7z/unrar support for RAR are:
Considering the fact that again our Windows version of MComix will ship with libunrar, we should just do this:
Which should get us the same RAR support as for the previous versions, except for the fact that 7z is tried as a last resort if both libunrar and unrar are not available.
I think we could release in this state.
And then I can work on improving unrar support: switch to technical listing so we can support solid detection and encryption like 7z does.
Last edit: Benoit Pierre 2015-12-22
Here is a version with the aforementioned patch and improved external rar/unrar support: https://github.com/benoit-pierre/mcomix/compare/improve-rar-support
52 xfails removed from the testsuite! \o/
Thank you for the new patches. However, I could not yet test them with respect to the RAR 5 issue discussed here. Instead, I created a new ticket because your patches also affect the library. See [bugs:#100] for more details.
Related
Bugs: #100
Now for the greatly improved archive extraction method thanks to your patches:
Arch Linux
Y | - | - | Y(!)| Y(!)| Y
Y | - | Y | Y | Y | Y
Y | Y | - | Y | Y | Y
Y | Y | Y | Y | Y | Y
Now that I think about it, concerning the cells marked with (!), I guess that is because
raris installed on my system. Apart from that, it is perfect.Debian Stretch (testing)
Almost perfect. The only problem is the line marked with (!), indicating that installing
unrar-freedisables RAR 4 support. A version detection on startup (next tosubprocess32andczipfile) might fix this. From what I can tell, you simply need to inspect the return value ofunrar: If you executeunrarwithout any arguments,unrar-freewill return 1 whileunrar(non-free) will return 0. Sinceunrar-freedoes not work well for us anyway, we should disableunraron startup if it turns out to beunrar-free.I think you can already push the changes to SVN now, including the patches for [bugs:#100].
Related
Bugs: #100
Yes, external RAR support checks for both
unrarandrarexecutables.I'll look into checking if the
unrarbinary is actuallyunrar-free.In the mean time I will push https://github.com/benoit-pierre/mcomix/compare/master...improve-rar-support to SVN.
I currently have access to a Ubuntu derived system (Linux Mint 17.2 Rafaela), and it looks like with both
unrarandunrar-freeinstalled:unrarprovides theunrar-nonfreebinaryunrar-freeprovides theunrar-freebinaryunraris just a symlink set byupdate-alternativesSo we could just prepend
unrar-nonfreeto the candidates list when callingfind_executable:And then we can check the executable we found is not a symlink to
unrar-free, see code here.Well spotted! I think for this to implement, it might be a good idea to add an optional parameter to
find_executable. This new parameter is a function which receives a stringn(the same as we passed it tofind_executablewithin the tuple) and an absolute pathpthat points to an executable. Wheneverfind_executableis about to return a path, it calls this function whichnandpandp, if it turns out to be already perfect) orNoneifpturns out to be useless.If a path is returned, then
find_executablesimply returns the very same path. However, ifNoneis returned,find_executablecontinues searching. Pseudocode:If I got it right, your current approach is a bit buggy as it might not be able to find
rareven if it is installed, but still returnsNonebecause it found an unusableunrar.Yes, I'll add a
is_valid_candidate_fnparameter tofind_executable.Note that we have another problem with RAR support (yeah...): on the machine I'm currently using (Linux Mint 17.2 Rafaela),
unraris version 5.0, butraris version 4.2, and the latter's output for 'vt' (technical listing) is different...Is the
unrarprogram you talk about non-free? I think that most setups will satisfyif nonfree(unrar) then version(unrar) >= version(rar), so it is probably safe to just ignore this issue, at least for now, becauseunraris preferred overraranyway. And sinceraris the last alternative we consider, it should not hurt that we try to use something that won't work.For the record: I just checked the alternative links on Debian and it's just like Mint. (Not that much of a surprise.) Thus, your solution should work on Debian as well. (I did not yet actually test it.) Adding a comment in the code about the different return codes of
unrar-freeandunrar-nonfreemight turn out helpful later, though. For example, the links might change their names in the future, or other distributions might behave differently.I tweaked
find_executableand updatedrar_external.py, see here.Regarding the problem with
rar: on my current system, if only therarpackage is installed, then MComix will show all RAR archives as empty, because the format of the listing is different that what is parsed/expected.The branch
improve-rar-supportlooks promising. Could you please push it to SVN? Thanks in advance.Done.
Should we close this?
Yes, you are right.