]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
PR25583: debuginfod: conditionally prefer bsdtar to dpkg for .deb handling
authorFrank Ch. Eigler <fche@redhat.com>
Fri, 27 Mar 2020 01:32:40 +0000 (21:32 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Fri, 27 Mar 2020 01:56:45 +0000 (21:56 -0400)
Prefer /usr/bin/dpkg-deb if installed, as normal on a debian system.

Suggested-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
debuginfod/ChangeLog
debuginfod/debuginfod.cxx

index 5e19db5174727c27a406ef773d162a2e46a448a8..58ba85cf36649097e4184f1146c22d919435dabc 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-26  Frank Ch. Eigler <fche@redhat.com>
+
+       * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
+       after all if access(3)-able, fallback to bsdtar.
+
 2020-03-25  Frank Ch. Eigler <fche@redhat.com>
 
        * debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
index c03bbf922f5936aed4db0267057b80045ee74c69..9e8d55609c56be188b1894c08faf5e5ccb99c37c 100644 (file)
@@ -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':