Bug 135099

Summary: error when trying to open password-protected RAR archive
Product: [Applications] ark Reporter: Philippe Cloutier <chealer>
Component: generalAssignee: Harald Hvaal <metellius>
Status: CLOSED FIXED    
Severity: normal CC: ismail, karl.sebastian.liebich, rakuco
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Password-protected RAR archive
patches the password protected rar files extraction problem

Description Philippe Cloutier 2006-10-04 16:56:02 UTC
Version:            (using KDE KDE 3.5.4)
Installed from:    Debian testing/unstable Packages
OS:                Linux

When trying to open a test password-protected RAR archive, ark fails with the helpful message "An error occurred while trying to open the archive " ;)

$ ark test.rar
kio (KMimeType): WARNING: mimetype not valid '' (missing entry in the file ?)
kio (KMimeType): WARNING: mimetype not valid '' (missing entry in the file ?)
kparts: WARNING: StatusBarExtension::removeStatusBarItem. Widget not found : [KPushButton pointer (0x80b99a8) to widget CancelButton, geometry=100x30+0+0]
chealer@vinci:~$

This is ark 2.6.3, which should apparently support password-protected archives. Opening RAR archives without password protection seems to work fine.
Comment 1 Philippe Cloutier 2006-10-04 16:57:22 UTC
Created attachment 18010 [details]
Password-protected RAR archive
Comment 2 Ben Blum 2006-11-17 14:15:25 UTC
I get this too (Ark version ~3.5.5 on Gentoo ~x86). Temporary solution: Open the archive with "unrar e /filepath/filename" in terminal.
Comment 3 Pino Toscano 2007-06-07 20:13:24 UTC
*** Bug 146482 has been marked as a duplicate of this bug. ***
Comment 4 Ozan Çağlayan 2007-11-06 17:39:46 UTC
Created attachment 22008 [details]
patches the password protected rar files extraction problem

patch that fix the extraction process of password protected rar files
Comment 5 Ozan Çağlayan 2007-11-06 17:41:14 UTC
Oops i've forgot to cite the necessary explanation:

I read the source codes of the package ark and i think i've found the bug.
Even the GUI implements a dialog for asking the password(it works with zip files), it doesn't work with RAR files because,

the program first runs "unrar" or equivalent unarchiver program it then checks the m_lastshelloutput for the string "password incorrect ?". The problem is that the program unrar doesn't verbose this string, it justs ask for it. So ark cannot detect if the archive is a password protected one and returns unsuccessfully.

If unrar is called with the switch "p-", it doesn't query for password and the standard output now contains a "(password incorrect ?)" for every file in the archive. The patch that fix this problem is attached, and it seems that it works with password protected and ordinary rar files.
Comment 6 Ismail Donmez 2007-11-06 18:17:51 UTC
Fix opening password protected RAR archives, patch by Ozan Çağlayan <ozan@pardus.org.tr>, thanks!
BUG:FIXED:135099



 M  +2 -0      rar.cpp  


--- branches/KDE/3.5/kdeutils/ark/rar.cpp #733549:733550
@@ -226,6 +226,8 @@
 
   if ( !m_password.isEmpty() )
     *kp << "-p" + m_password;
+  else
+    *kp << "-p-";
 
   if ( !ArkSettings::extractOverwrite() )
   {