summaryrefslogtreecommitdiff
path: root/debuginfod
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2020-03-26 21:32:40 -0400
committerFrank Ch. Eigler <fche@redhat.com>2020-03-26 21:56:45 -0400
commit426a000dc59bd824de86d20b1e4d772340031067 (patch)
tree1d93ff016a3d51fd81b6b1a6768676c6ce17c610 /debuginfod
parentbde8d7ec3fb1780f8178586533d76a959bde89ab (diff)
downloadelfutils-426a000dc59bd824de86d20b1e4d772340031067.tar.gz
PR25583: debuginfod: conditionally prefer bsdtar to dpkg for .deb handling
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>
Diffstat (limited to 'debuginfod')
-rw-r--r--debuginfod/ChangeLog5
-rw-r--r--debuginfod/debuginfod.cxx12
2 files changed, 15 insertions, 2 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 5e19db51..58ba85cf 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -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
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index c03bbf92..9e8d5560 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':