By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.
Bug 2794 - ark can't open rar files
Summary: ark can't open rar files
Status: RESOLVED FIXED
Alias: None
Product: TDE
Classification: Unclassified
Component: tdeutils (show other bugs)
Version: R14.0.x [Trinity]
Hardware: All Linux
: P5 major
Assignee: Michele Calgaro
URL:
Depends on:
Blocks: R14.0.5
  Show dependency treegraph
 
Reported: 2017-08-05 10:32 CDT by wofgdkncxojef
Modified: 2018-05-29 08:14 CDT (History)
4 users (show)

See Also:
Compiler Version:
TDE Version String: R14.0.4
Application Version: 2.6.4
Application Name: ark


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wofgdkncxojef 2017-08-05 10:32:20 CDT
ark can't open rar files.

unrar and unrar-nonfree are already installed.
I can open rar files with an other archiver.
ark seams to work fine with other formats.
The test rar archives are definitely not encrypted either.

In the terminal it gives this error:
"tdeio (KMimeType): WARNING: mimetype not valid '' (missing entry in the file ?)"

I put severity major, because rar is a widespread archive format....
Comment 1 Ray Vine 2018-05-16 17:46:20 CDT
If applying these patches to R14.0.4, the patch given in bug 2043 should be applied first.
For git, some patches have already been done.

--------------------------------------
The warning is not related to this error.
It's due to the routine in tdeutils/ark/archiveformatinfo.cpp scanning for the non-existent application/x-tbz2 - so remove it [already done in git]:

--- ark/archiveformatinfo.cpp
+++ ark/archiveformatinfo.cpp
@@ -55 +54,0 @@
-  addFormatInfo( TAR_FORMAT, "application/x-tbz2", ".tar.bz2" );

--------------------------------------
There is also an application/x-rar-compressed which adds a second <file>.rar entry to the Compress As menu.
There is no indication of the difference between that and the application/x-rar Compress As option and functions the same - so remove it:

--- ark/archiveformatinfo.cpp
+++ ark/archiveformatinfo.cpp
@@ -80 +78,0 @@
-  addFormatInfo( RAR_FORMAT, "application/x-rar-compressed", ".rar" );

also needs to be removed from tdeaddons [patch at 328 done in git ]

--- konq-plugins/arkplugin/arkplugin.cpp
+++ konq-plugins/arkplugin/arkplugin.cpp
@@ -328 +328 @@
-        m_archiveMimeTypes << "application/x-rar" << "application/x-rar-compressed";
+        m_archiveMimeTypes << "application/x-rar";
@@ -411 +411 @@
-        m_extractMimeTypes << "application/x-rar" << "application/x-rar-compressed";
+        m_extractMimeTypes << "application/x-rar";

and removed from tdelibs

--- mimetypes/application/CMakeLists.txt
+++ mimetypes/application/CMakeLists.txt
@@ -85 +84,0 @@
-    x-rar-compressed.desktop

--- mimetypes/application/Makefile.am
+++ mimetypes/application/Makefile.am
@@ -68 +67,0 @@
-	x-rar-compressed.desktop \

-----------------------------
Remove other redundant application/x-tbz2 entries in tdeutils:
[already done in git]

--- ark/tar.cpp
+++ ark/tar.cpp
@@ -94,7 +93,0 @@
-    if ( m_fileMimeType == "application/x-tbz2" )
-    {
-        // ark treats .tar.bz2 as x-tbz, instead of duplicating the mimetype
-        // let's just alias it to the one we already handle.
-        m_fileMimeType = "application/x-tbz";
-    }
-
--- superkaramba/src/sknewstuff.cpp
+++ superkaramba/src/sknewstuff.cpp
@@ -67 +66,0 @@
-      result->name() == "application/x-tbz2" ||
--- ark/ark.desktop
+++ ark/ark.desktop
@@ -2 +2 @@
-MimeType=application/x-gzip;application/x-lha;application/x-tar;application/x-tgz;application/x-tbz;application/x-tbz2;application/x-zip;application/zip;application/x-bzip;application/x-tzo;application/x-lzop;application/x-rar;application/x-zoo;application/x-tarz;application/x-archive;application/x-bzip2;application/x-jar;application/x-deb;application/x-ace;application/x-7z;application/x-arc;application/x-arj;application/x-compress;application/x-cpio;application/x-pak;application/x-zip-compressed;application/x-lzma;application/x-xz;application/x-txz;application/x-tlz
+MimeType=application/x-gzip;application/x-lha;application/x-tar;application/x-tgz;application/x-tbz;application/x-zip;application/zip;application/x-bzip;application/x-tzo;application/x-lzop;application/x-rar;application/x-zoo;application/x-tarz;application/x-archive;application/x-bzip2;application/x-jar;application/x-deb;application/x-ace;application/x-7z;application/x-arc;application/x-arj;application/x-compress;application/x-cpio;application/x-pak;application/x-zip-compressed;application/x-lzma;application/x-xz;application/x-txz;application/x-tlz
--- ark/ark_part.desktop
+++ ark/ark_part.desktop
@@ -2 +2 @@
-MimeType=application/x-gzip;application/x-lha;application/x-tar;application/x-tgz;application/x-tbz;application/x-tbz2;application/x-zip;application/x-bzip;application/x-tzo;application/x-lzop;application/x-rar;application/x-zoo;application/x-tarz;application/x-archive;application/x-bzip2;application/x-jar;application/x-deb;application/x-ace;application/x-7z;application/x-arc;application/x-arj;application/x-compress;application/x-cpio;application/x-pak;application/x-lzma;application/x-xz;application/x-tlz;application/x-txz
+MimeType=application/x-gzip;application/x-lha;application/x-tar;application/x-tgz;application/x-tbz;application/x-zip;application/x-bzip;application/x-tzo;application/x-lzop;application/x-rar;application/x-zoo;application/x-tarz;application/x-archive;application/x-bzip2;application/x-jar;application/x-deb;application/x-ace;application/x-7z;application/x-arc;application/x-arj;application/x-compress;application/x-cpio;application/x-pak;application/x-lzma;application/x-xz;application/x-tlz;application/x-txz

--------------------------------------
The rar issue requires modifying rar.cpp

The version string formats for the various rar/unrar programs are:

For rarlabs
RAR 5.50   Copyright (c) 1993-2017 Alexander Roshal   11 Aug 2017
UNRAR 5.50 freeware      Copyright (c) 1993-2017 Alexander Roshal

For unrarsrc [unrar-free ?]:
UNRAR 5.60 beta 3 freeware      Copyright (c) 1993-2018 Alexander Roshal

and the current rar.cpp regex doesn't catch them and the capture[?] chunks are displaced by one

--- ark/rar.cpp
+++ ark/rar.cpp
@@ -102 +102 @@
-    TQRegExp versionRegExp (TQString::fromLatin1 ("RAR\\s(\\d+)\\.(\\d+)\\s(beta (\\d+))?\\s+Copyright.*"));
+    TQRegExp versionRegExp (TQString::fromLatin1 ("(UN)?RAR\\s(\\d+)\\.(\\d+)( beta (\\d+))?.*"));
@@ -107,3 +107,3 @@
-      m_version  = versionRegExp.cap(1).toShort() * VERSION_MAJOR;
-      m_version += versionRegExp.cap(2).toShort()/10 * VERSION_MINOR;
-      m_version += versionRegExp.cap(2).toShort()%10 * VERSION_PATCH;
+      m_version  = versionRegExp.cap(2).toShort() * VERSION_MAJOR;
+      m_version += versionRegExp.cap(3).toShort()/10 * VERSION_MINOR;
+      m_version += versionRegExp.cap(3).toShort()%10 * VERSION_PATCH;
@@ -111 +111 @@
-      if (!versionRegExp.cap(4).isEmpty()) { // beta versions should go befor release ones
+      if (!versionRegExp.cap(5).isEmpty()) { // beta versions should go before release ones
@@ -113 +113 @@
-        m_version += versionRegExp.cap(4).toShort();
+        m_version += versionRegExp.cap(5).toShort();


Tested for (un)rar 5.5.0 and 3.9.0 and unrar[-free ?] 5.31 beta 1 and 5.60 beta 3

unrar-3.9.0 won't open files compressed with rar-5.5.0, but I would think that's expected behaviour(?)

--------------------------------------
Options

[1] default to tar.xz compression in Compress As menu

--- konq-plugins/arkplugin/arkplugin.cpp
+++ konq-plugins/arkplugin/arkplugin.cpp
@@ -96 +96 @@
-        m_ext = m_conf->readEntry( "LastExtension", ".tar.gz" );
+        m_ext = m_conf->readEntry( "LastExtension", ".tar.xz" );
@@ -107 +107 @@
-                                    "LastMimeType", "application/x-tgz" ) )->comment(),
+                                    "LastMimeType", "application/x-txz" ) )->comment(),

[2] enable jar and ar compression in Compress As menu

--- konq-plugins/arkplugin/arkplugin.cpp
+++ konq-plugins/arkplugin/arkplugin.cpp
@@ -323 +323 @@
-        if ( m_conf->readBoolEntry( "UseJar", false ) )
+        if ( m_conf->readBoolEntry( "UseJar", true ) )
@@ -346 +346 @@
-    if ( !TDEStandardDirs::findExe( "ar" ).isNull() && m_conf->readBoolEntry( "UseAr", false ) )
+    if ( !TDEStandardDirs::findExe( "ar" ).isNull() && m_conf->readBoolEntry( "UseAr", true ) )
Comment 2 Michele Calgaro 2018-05-27 10:32:31 CDT
> ark can't open rar files.

I would like to reproduce the problem and test Ray's patches.
Can any of you provide a .rar file that cannot be opened?
I have tried a few here, but they all worked so far.

Thanks a lot :-)
Comment 3 wofgdkncxojef 2018-05-27 12:15:11 CDT
try the file here (not a direct link)
https://developer.blender.org/p/dfleury2/
Comment 4 Michele Calgaro 2018-05-27 19:21:39 CDT
> try the file here (not a direct link)
> https://developer.blender.org/p/dfleury2/

Thanks for the feedback. I can open and extract the file without issues from both Ark and Konqueror Ark plugin.
I am running Debian buster + rar + unrar + TDE 14.1.0~devel.

Any additional info you can provide could help.
Comment 5 wofgdkncxojef 2018-05-27 20:33:33 CDT
just tested this
remove rar
Comment 6 Michele Calgaro 2018-05-28 00:14:49 CDT
> remove rar
Thanks, I am now able to reproduce the problem ;-)
Comment 7 Michele Calgaro 2018-05-29 08:14:38 CDT
The patches proposed by Ray have been pushed to git, with two exceptions:
- the rar patch has been simplified. By using non capturing groups in the regex, it is no t necessary to change the group numbers later in the code.
- the "ar" format in option 2 has remained disable by default.

In addition, x-zip-compressed duplicated entry was also removed.

Commits related to this bug.

R14.1
tdelibs:   74181268, 1b04b27b
tdeutils:  4d3ca8ff, 04a8b70f, c91feb08
tdeaddons: 256b5e18, fcdbd810, b1c38049

R14.0
tdelibs:   64ce5b22, 8140cac9
tdeutils:  f0d31187, cc71cffb, 817ad11e
tdeaddons: e7a5dff2, 9581ce33, fa22b5e8