From b0ecd18115bb4fa1887da6c590353f9f5a76434f Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 6 Mar 2019 11:10:34 -0700 Subject: notmuch-slurp-debbug: use IPC::System::Simple Signed-off-by: Sean Whitton --- debian/changelog | 9 +++++++++ debian/control | 1 + mailscripts.el | 2 +- notmuch-slurp-debbug | 11 ++++++----- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7580b82..bbf528e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +mailscripts (0.6-1) UNRELEASED; urgency=high + + * notmuch-slurp-debbug: Further ensure that superfluous shells are not + invoked by switching from system() and backticks to functions from + IPC::System::Simple. + - d/control: add runtime dependency on libipc-system-simple-perl. + + -- Sean Whitton Wed, 06 Mar 2019 11:08:44 -0700 + mailscripts (0.5-1) unstable; urgency=high * notmuch-slurp-debbug: Avoid invoking entirely superfluous shells when diff --git a/debian/control b/debian/control index 8e7b8de..8bfe006 100644 --- a/debian/control +++ b/debian/control @@ -30,6 +30,7 @@ Package: mailscripts Depends: libconfig-tiny-perl, libfile-which-perl, + libipc-system-simple-perl, libmime-tools-perl, python3, ${misc:Depends}, diff --git a/mailscripts.el b/mailscripts.el index 2d88500..148b996 100644 --- a/mailscripts.el +++ b/mailscripts.el @@ -1,7 +1,7 @@ ;;; mailscripts.el --- functions to access tools in the mailscripts package ;; Author: Sean Whitton -;; Version: 0.5 +;; Version: 0.6 ;; Package-Requires: (notmuch) ;; Copyright (C) 2018 Sean Whitton diff --git a/notmuch-slurp-debbug b/notmuch-slurp-debbug index f555329..09d05c1 100755 --- a/notmuch-slurp-debbug +++ b/notmuch-slurp-debbug @@ -25,6 +25,7 @@ use File::Spec::Functions 'catfile'; use File::Which; use File::Temp; use Getopt::Long; +use IPC::System::Simple qw(systemx capturex); use MIME::Head; my $Config = Config::Tiny->new; @@ -67,7 +68,7 @@ my $bts_server_arg = defined $bts_server : undef; # see #904182 (try using this script ;)) -system(grep defined, "bts", $bts_server_arg, +systemx(grep defined, "bts", $bts_server_arg, qw(--mbox --mailreader), "true %s", "show", $bug) == 0 or die "notmuch-slurp-debbug: bts failed"; @@ -85,7 +86,7 @@ my $mbox = catfile $devscripts_cache, "$bug.mbox"; # note that mb2md won't work; it thinks Debian BTS mboxes contain just # a single message -system("mbox2maildir", $mbox, $dir) == 0 +systemx("mbox2maildir", $mbox, $dir) == 0 or die "notmuch-slurp-debbug: mbox2maildir failed"; foreach my $message (glob "$dir/*/*") { @@ -95,9 +96,9 @@ foreach my $message (glob "$dir/*/*") { # that is asking for trouble next unless defined $mid; $mid =~ s/(<|>)//g; - my $match = `notmuch search id:$mid`; + my $match = capturex(qw(notmuch search), "id:$mid"); my $match_lines = $match =~ tr/\n//; - system("mdmv", $message, $maildir) if ($match_lines == 0); + systemx("mdmv", $message, $maildir) if ($match_lines == 0); } -system(qw(notmuch new)); +systemx(qw(notmuch new)); -- cgit v1.2.3