Index | Thread | Search

From:
George Koehler <kernigh@gmail.com>
Subject:
Re: [BUG] x11/xfe Tar integration broken as of RELEASE_7_6
To:
Rubén Llorente <porting@use.startmail.com>
Cc:
ports@openbsd.org, Brian Callahan <bcallah@openbsd.org>
Date:
Fri, 25 Oct 2024 23:55:23 -0400

Download raw body.

Thread
Hi.  When I write mail to the OpenBSD ports list, I Cc the maintainer
(if the package has one), who might or might not be reading the list.
The maintainer for xfe is Brian Callahan (pkg_info xfe).

On Fri, 18 Oct 2024 12:39:00 +0000
Rubén Llorente <porting@use.startmail.com> wrote:

> Hi there,
> 
> it looks like tar integration is broken in Xfe as of OpenBSD 7.6. In 
> OpenBSD 7.5 the user could use a contextual menu to compress and 
> decompress files and folders, which would cause Xfe to invoke tar. Now, 
> when issued a compression command, Xfe tries to call tar with the "a" 
> option, which as far as I know is a gnucism, and causes the command to fail.
> 
> STEPS TO REPRODUCE:
> 
> Launch Xfe, navigate to some directory in which folders and file exist, 
> use the right click conteXtual menu to attempt and compress some of them.
> 
> OUTCOME: A warning window pops up with a failure message:
> 
> tar: unknown option -- a
> usage: tar {crtux}[014578beFfHhjLmNOoPpqsvwXZz]
>             [blocking-factor | format | archive | replstr]
>             [-C directory] [-I file] [file ...]
>         tar {-crtux} [-014578eHhjLmNOoPpqvwXZz] [-b blocking-factor]
>             [-C directory] [-F format] [-f archive] [-I file]
>             [-s replstr] [file ...]

This diff patches xfe to run GNU tar.  I was able to make a .tar.gz in
xfe and extract it again on my amd64 desktop, where I had installed
archivers/gtar.  I forgot to add gtar to RUN_DEPENDS.  (xfe can also
run 7z and unrar but doesn't depend on archivers/{p7zip,unrar}.)

bsdtar (archivers/libarchive) also has option -a, but I didn't try it.
I guess that gtar is better at GNU things.

There are too many "tar ___" command strings to patch.  I instead
wrote some C++ for FXString to change "tar ___" to "gtar ___".  Unless
I missed a spot, I need only 7 copies of this C++.

Is this ok, or should we do something else?
--gkoehler

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/xfe/Makefile,v
diff -u -p -r1.58 Makefile
--- Makefile	5 Jul 2024 13:24:49 -0000	1.58
+++ Makefile	26 Oct 2024 03:09:17 -0000
@@ -2,7 +2,7 @@ COMMENT=	MS-Explorer like file manager f
 
 DISTNAME=	xfe-1.46.2
 EXTRACT_SUFX=	.tar.xz
-REVISION=	0
+REVISION=	1
 CATEGORIES=	x11
 
 HOMEPAGE=	http://roland65.free.fr/xfe/
Index: patches/patch-src_DirPanel_cpp
===================================================================
RCS file: patches/patch-src_DirPanel_cpp
diff -N patches/patch-src_DirPanel_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_DirPanel_cpp	26 Oct 2024 03:09:17 -0000
@@ -0,0 +1,18 @@
+No tar -a, use archivers/gtar
+
+Index: src/DirPanel.cpp
+--- src/DirPanel.cpp.orig
++++ src/DirPanel.cpp
+@@ -1036,6 +1036,12 @@ long DirPanel::onCmdAddToArch(FXObject* o, FXSelector,
+             cmd = "tar -acvf " + archive + " ";
+         }
+ 
++        // Change tar to gtar
++        if (compare(cmd, "tar ", 4) == 0)
++        {
++            cmd.prepend('g');
++        }
++
+         // Archive command name
+         cmd = cmd + ::quote(name);
+ 
Index: patches/patch-src_FilePanel_cpp
===================================================================
RCS file: /cvs/ports/x11/xfe/patches/patch-src_FilePanel_cpp,v
diff -u -p -r1.6 patch-src_FilePanel_cpp
--- patches/patch-src_FilePanel_cpp	25 Jul 2023 15:21:29 -0000	1.6
+++ patches/patch-src_FilePanel_cpp	26 Oct 2024 03:09:17 -0000
@@ -1,5 +1,7 @@
 onCmdDirUsage is linux-only for now
 
+No tar -a, use archivers/gtar
+
 Index: src/FilePanel.cpp
 --- src/FilePanel.cpp.orig
 +++ src/FilePanel.cpp
@@ -19,3 +21,55 @@ Index: src/FilePanel.cpp
      FXMAPFUNC(SEL_COMMAND, FilePanel::ID_MOUNT, FilePanel::onCmdMount),
      FXMAPFUNC(SEL_COMMAND, FilePanel::ID_UMOUNT, FilePanel::onCmdMount),
      FXMAPFUNC(SEL_UPDATE, FilePanel::ID_MOUNT, FilePanel::onUpdMount),
+@@ -4984,6 +4984,12 @@ long FilePanel::onCmdAddToArch(FXObject* o, FXSelector
+             cmd = "tar -acvf " + archive + " ";
+         }
+ 
++        // Change tar to gtar
++        if (compare(cmd, "tar ", 4) == 0)
++        {
++            cmd.prepend('g');
++        }
++
+         for (int u = 0; u < current->list->getNumItems(); u++)
+         {
+             if (current->list->isItemSelected(u))
+@@ -5127,6 +5133,12 @@ long FilePanel::onCmdExtract(FXObject*, FXSelector, vo
+             cmd = "tar -axvf ";
+         }
+ 
++        // Change tar to gtar
++        if (compare(cmd, "tar ", 4) == 0)
++        {
++            cmd.prepend('g');
++        }
++
+         // Final extract command
+         cmd += name + " ";
+ 
+@@ -5279,6 +5291,12 @@ long FilePanel::onCmdExtractToFolder(FXObject*, FXSele
+             cmd = "tar -axvf ";
+         }
+ 
++        // Change tar to gtar
++        if (compare(cmd, "tar ", 4) == 0)
++        {
++            cmd.prepend('g');
++        }
++
+         // Final extract command
+         cmd += pathname + " ";
+ 
+@@ -5385,6 +5403,12 @@ long FilePanel::onCmdExtractHere(FXObject*, FXSelector
+             else
+             {
+                 cmd = "tar -axvf ";
++            }
++
++            // Change tar to gtar
++            if (compare(cmd, "tar ", 4) == 0)
++            {
++                cmd.prepend('g');
+             }
+ 
+             // Final extract command
Index: patches/patch-src_SearchPanel_cpp
===================================================================
RCS file: patches/patch-src_SearchPanel_cpp
diff -N patches/patch-src_SearchPanel_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_SearchPanel_cpp	26 Oct 2024 03:09:17 -0000
@@ -0,0 +1,31 @@
+No tar -a, use archivers/gtar
+
+Index: src/SearchPanel.cpp
+--- src/SearchPanel.cpp.orig
++++ src/SearchPanel.cpp
+@@ -2605,6 +2605,12 @@ long SearchPanel::onCmdAddToArch(FXObject* o, FXSelect
+             cmd = "tar -acvf " + archive + " ";
+         }
+ 
++        // Change tar to gtar
++        if (compare(cmd, "tar ", 4) == 0)
++        {
++            cmd.prepend('g');
++        }
++
+         for (int u = 0; u < list->getNumItems(); u++)
+         {
+             if (list->isItemSelected(u))
+@@ -2725,6 +2731,12 @@ long SearchPanel::onCmdExtract(FXObject*, FXSelector, 
+         else
+         {
+             cmd = "tar -axvf ";
++        }
++
++        // Change tar to gtar
++        if (compare(cmd, "tar ", 4) == 0)
++        {
++            cmd.prepend('g');
+         }
+ 
+         // Final extract command