arK from 3.5 fix - -d option for gunzip & Co. is not valid

Vadim Zhukov persgray at gmail.com
Fri Sep 19 12:14:33 CEST 2008


19 September 2008 г. Vadim Zhukov  wrote:
> 19 September 2008 г. Vadim Zhukov  wrote:
> > Hello.
> >
> > Patch below fixes problem with calling uncompress(1), gunzip(1) and
> > bunzip2(1) utilities: they should not receive "-d" flag, so programs
> > called changed to "compress", "gzip" and "bzip2", respectively,
> > which handle "-d" flag.
>
> BTW, this should fix bug 149765.
> https://bugs.kde.org/show_bug.cgi?id=149765

Sorry, wrong patch sent, which actually broke other code paths. :( Now 
there is right patch.

And please note: patch is not well-tested yet. :(

-- 
  Best wishes,
    Vadim Zhukov


$OpenBSD: patch-ark_tar_cpp,v 1.1 2007/02/02 12:09:36 espie Exp $
--- ark/tar.cpp.orig	Mon May 22 22:08:38 2006
+++ ark/tar.cpp	Fri Sep 19 13:59:47 2008
@@ -247,13 +248,22 @@ TarArch::open()
     // tar archive are plain or start with "./"
     KProcess *kp = m_currentProcess = new KProcess;
 
-    *kp << m_archiver_program;
-
     if ( compressed )
     {
-        *kp << "--use-compress-program=" + getUnCompressor();
+      kp->setUseShell(true);
+      *kp << getUnCompressor() << "-d" << "-c" << 
KProcess::quote(m_filename) << "|";
+      QString strUnCompressor = getUnCompressor();
+      *kp << strUnCompressor;
+      if (strUnCompressor == "lzop")
+        *kp << "-d";
+      *kp << "-c" << KProcess::quote(m_filename) << "|";
+    } else 
+    {
+      kp->setUseShell(false);
     }
 
+    *kp << m_archiver_program;
+ 
     *kp << "-tvf" << m_filename;
 
     m_buffer = "";
@@ -600,10 +610,19 @@ void TarArch::unarchFileInternal()
 
   KProcess *kp = m_currentProcess = new KProcess;
   kp->clearArguments();
-
-  *kp << m_archiver_program;
   if (compressed)
-    *kp << "--use-compress-program="+getUnCompressor();
+  {
+    kp->setUseShell(true);
+    QString strUnCompressor = getUnCompressor();
+    *kp << strUnCompressor;
+    if (strUnCompressor == "lzop")
+      *kp << "-d";
+    *kp << "-c" << KProcess::quote(m_filename) << "|";
+  } else 
+  {
+    kp->setUseShell(false);
+  }
+  *kp << m_archiver_program;
 
   QString options = "-x";
   if (ArkSettings::preservePerms())


More information about the Kde-utils-devel mailing list