Bug 121601

Summary: ark asks for the 'compress' utility where gunzip is enough.
Product: [Applications] ark Reporter: yuval aviel <yuval>
Component: generalAssignee: Harald Hvaal <metellius>
Status: RESOLVED FIXED    
Severity: normal CC: rakuco
Priority: NOR    
Version: 2.6.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Replace compress with gzip

Description yuval aviel 2006-02-08 15:22:53 UTC
Version:           2.6.1 (using KDE 3.5.1-1.5.fc4.kde, Fedora Core release 4 (Stentz))
Compiler:          Target: i386-redhat-linux
OS:                Linux (i686) release 2.6.15-1.1830_FC4smp

When opening a file.Z on a system with no 'compress' utility, Ark report an error, and does not open the compressed file.
The file, however, opens with gunzip.
I would expect Ark to try 'gunzip' if 'compress' is not available.
Comment 1 Haris Kouzinopoulos 2006-02-17 03:06:47 UTC
Can you attach a test .Z file?
Comment 2 Haris Kouzinopoulos 2006-02-17 22:26:03 UTC
We could have 2 approaches here: the first (the one i prefer) is to drop support for compress entirely and use gzip to compress/decompress .Z files. Gentoo doesn't even have "compress" anymore. 
The second is to search for compress and if its not found to use the gzip utility.
What do you think?
Comment 3 yuval aviel 2006-02-18 08:09:56 UTC
First, as for .Z files: search for "ps.Z" files. http://www.google.com/search?hl=en&q=ps.Z

Second, the second approach seems more appropriate, but on the price of intoducing complication. The first option is simple and easy to implement.
As 'compress' files are rare, and as gunzip would open any .Z file (I think), I would go for the first approach. Simply use gzip.
Comment 4 Haris Kouzinopoulos 2006-02-18 13:22:06 UTC
Created attachment 14750 [details]
Replace compress with gzip

Ok, quick patch: replaces compress and uncompress with gzip and gunzip. Tested
on my system works perfectly. I can do a new patch for the second case but i
think it adds unneccessary complication
Comment 5 Henrique Pinto 2006-02-18 15:53:20 UTC
SVN commit 510942 by henrique:

 * Use gzip/gunzip if compress/uncompress are not available.
   Based on patch by Henry Kay <haris@mpa.gr>
   BUG: 121601



 M  +4 -3      compressedfile.cpp  


--- branches/KDE/3.5/kdeutils/ark/compressedfile.cpp #510941:510942
@@ -44,6 +44,7 @@
 #include <kio/global.h>
 #include <kfileitem.h>
 #include <kapplication.h>
+#include <kglobal.h>
 
 // ark includes
 #include "arkwidget.h"
@@ -129,9 +130,9 @@
     }
     if ( mimeType == "application/x-compress" )
     {
-        m_unarchiver_program = "uncompress";
-        m_archiver_program = "compress";
-        m_defaultExtensions = ".Z";
+        m_unarchiver_program = KGlobal::dirs()->findExe( "uncompress" ).isNull()? "gunzip" : "uncompress";
+        m_archiver_program   = KGlobal::dirs()->findExe( "compress" ).isNull()? "gzip" : "compress";
+        m_defaultExtensions  = ".Z";
     }
 
 }
Comment 6 Nicolas Goutte 2006-02-18 16:24:21 UTC
>List:       kde-commits
>Subject:    branches/KDE/3.5/kdeutils/ark
> From:       Henrique Pinto <henrique.pinto () kdemail ! net>
>Date:       2006-02-18 14:53:08
>Message-ID: 1140274388.563557.29024.nullmailer () svn ! kde ! org
>
>SVN commit 510942 by henrique:
>
> * Use gzip/gunzip if compress/uncompress are not available.
>   Based on patch by Henry Kay <haris@mpa.gr>
>   BUG: 121601


You are aware that gzip *cannot* create files compatible to compress, aren't 
you?

Only gunzip can uncompress some non-gzip files (if compiled so), including 
files created by compress.

>
>
>
> M  +4 -3      compressedfile.cpp  


Have a nice day!
Comment 7 Henrique Pinto 2006-03-04 17:22:32 UTC
SVN commit 515688 by henrique:

 * According to Nicolas Goutte, gzip cannot create compress-compatible files.
   CCBUG: 121601


 M  +1 -1      compressedfile.cpp  


--- branches/KDE/3.5/kdeutils/ark/compressedfile.cpp #515687:515688
@@ -132,7 +132,7 @@
     if ( mimeType == "application/x-compress" )
     {
         m_unarchiver_program = KGlobal::dirs()->findExe( "uncompress" ).isNull()? "gunzip" : "uncompress";
-        m_archiver_program   = KGlobal::dirs()->findExe( "compress" ).isNull()? "gzip" : "compress";
+        m_archiver_program   = "compress";
         m_defaultExtensions  = ".Z";
     }