summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog24
-rw-r--r--debian/control1
-rw-r--r--debian/copyright2
-rw-r--r--mailscripts.el2
-rwxr-xr-xnotmuch-slurp-debbug27
5 files changed, 41 insertions, 15 deletions
diff --git a/debian/changelog b/debian/changelog
index cd1a2f0..f69a0b9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,27 @@
+mailscripts (0.7-1) unstable; urgency=high
+
+ * notmuch-slurp-debbug: Fix the --bts-server argument.
+ The 0.6 release broke use of this argument.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Wed, 06 Mar 2019 11:37:42 -0700
+
+mailscripts (0.6-1) unstable; 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 <spwhitton@spwhitton.name> Wed, 06 Mar 2019 11:14:30 -0700
+
+mailscripts (0.5-1) unstable; urgency=high
+
+ * notmuch-slurp-debbug: Avoid invoking entirely superfluous shells when
+ calling other tools. This is a security risk.
+ Thanks to Paul Wise for reporting that the code was doing that.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Tue, 05 Mar 2019 09:38:56 -0700
+
mailscripts (0.4-1~bpo9+1) stretch-backports; urgency=medium
* Rebuild for stretch-backports.
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/debian/copyright b/debian/copyright
index 83c2ca9..b3d860e 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,7 +2,7 @@ mailscripts
Collection of scripts for manipulating e-mail on Debian
Copyright (C)2017 Aurelien Aptel
-Copyright (C)2017-2018 Sean Whitton
+Copyright (C)2017-2019 Sean Whitton
These programs are free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
diff --git a/mailscripts.el b/mailscripts.el
index 249cb42..c68f7a9 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -1,7 +1,7 @@
;;; mailscripts.el --- functions to access tools in the mailscripts package
;; Author: Sean Whitton <spwhitton@spwhitton.name>
-;; Version: 0.4
+;; Version: 0.7
;; Package-Requires: (notmuch)
;; Copyright (C) 2018 Sean Whitton
diff --git a/notmuch-slurp-debbug b/notmuch-slurp-debbug
index d289e31..d424236 100755
--- a/notmuch-slurp-debbug
+++ b/notmuch-slurp-debbug
@@ -2,7 +2,7 @@
# notmuch-slurp-debbug -- add messages from a Debian bug to notmuch
-# Copyright (C) 2018 Sean Whitton
+# Copyright (C) 2018-2019 Sean Whitton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,10 +21,11 @@ use strict;
use warnings;
use Config::Tiny;
-use File::Spec::Functions 'catfile';
+use File::Spec::Functions qw(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;
@@ -62,13 +63,14 @@ die "notmuch-slurp-debbug: $maildir does not look to be a maildir"
&& -d catfile($maildir, "new")
&& -d catfile($maildir, "tmp"));
-my $bts_server_arg = defined $bts_server
- ? "--bts-server $bts_server"
- : "";
+my @bts_server_args = defined $bts_server
+ ? ("--bts-server", $bts_server)
+ : undef;
-# see #904182 (try using this script ;))
-system("bts $bts_server_arg --mbox --mailreader 'true %s' show $bug") == 0
- or die "notmuch-slurp-debbug: bts failed";
+# see #904182 for why we have to do it like this
+my @bts_args = grep defined, @bts_server_args,
+ qw(--mbox --mailreader), "true %s", "show", $bug;
+systemx("bts", @bts_args);
my $dir = File::Temp->newdir();
mkdir catfile($dir, "cur");
@@ -83,8 +85,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
- or die "notmuch-slurp-debbug: mbox2maildir failed";
+systemx("mbox2maildir", $mbox, $dir);
foreach my $message (glob "$dir/*/*") {
my $message_head = MIME::Head->from_file($message);
@@ -93,9 +94,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 "notmuch new";
+systemx(qw(notmuch new));