Re: patch PR25583: debuginfod bsdtar for deb

2020-03-27 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

Like this?
(/usr/bin/dkpg-deb is the usual installation path)


diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 5e19db517472..58ba85cf3664 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-26  Frank Ch. Eigler 
+
+   * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
+   after all if access(3)-able, fallback to bsdtar.
+
 2020-03-25  Frank Ch. Eigler 
 
* debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index c03bbf922f59..9e8d55609c56 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -429,8 +429,16 @@ parse_opt (int key, char *arg,
   scan_archives[".rpm"]="cat"; // libarchive groks rpm natively
   break;
 case 'U':
-  scan_archives[".deb"]="(bsdtar -O -x -f - data.tar.xz)<";
-  scan_archives[".ddeb"]="(bsdtar -O -x -f - data.tar.xz)<";
+  if (access("/usr/bin/dpkg-deb", X_OK) == 0)
+{
+  scan_archives[".deb"]="dpkg-deb --fsys-tarfile";
+  scan_archives[".ddeb"]="dpkg-deb --fsys-tarfile";
+}
+  else
+{
+  scan_archives[".deb"]="(bsdtar -O -x -f - data.tar.xz)<";
+  scan_archives[".ddeb"]="(bsdtar -O -x -f - data.tar.xz)<";
+}
   // .udeb too?
   break;
 case 'Z':



Re: patch PR25583: debuginfod bsdtar for deb

2020-03-27 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

> Like this?
> (/usr/bin/dkpg-deb is the usual installation path)

pushed to master after testing on f30 with and without dpkg.

- FChE



Re: patch PR25583: debuginfod bsdtar for deb

2020-03-26 Thread Frank Ch. Eigler via Elfutils-devel
Hi -

> I am not against this patch, but I do wonder if it should not try to
> fall back on dpkg if bsdtar isn't installed.

Good point, will do that.

- FChE



Re: patch PR25583: debuginfod bsdtar for deb

2020-03-26 Thread Mark Wielaard
Hi Frank,

On Wed, 2020-03-25 at 10:57 -0400, Frank Ch. Eigler via Elfutils-devel wrote:
> Author: Frank Ch. Eigler 
> Date:   Wed Mar 25 10:55:53 2020 -0400
> 
> PR25583: debuginfod: prefer bsdtar to dpkg for .deb handling
> 
> It turns out a bsdtar subshell can do the job of dpkg-deb.
> bsdtar comes from/with libarchive so it should be available
> everywhere.

The patch itself looks correct. And it is a win for non-deb based
systems since the bsdtar dependencies are already there. But for .deb
based systems it is more likely they already have dpkg installed, while
bsdtar might be a separate install/package. And it still needs to spawn
an external process.

I looked at the buildbot workers and none had bsdtar installed. I have
installed it now on the i386, debian/fedora/centos-x86_64, arm32 and
arm64 workers and have requested it to be installed on the s390x and
ppc64[le] workers.

I am not against this patch, but I do wonder if it should not try to
fall back on dpkg if bsdtar isn't installed.

Cheers,

Mark