diff -Nru mailscripts-0.4/debian/changelog mailscripts-0.7/debian/changelog --- mailscripts-0.4/debian/changelog 2018-10-27 17:56:10.000000000 +0000 +++ mailscripts-0.7/debian/changelog 2019-03-06 18:37:42.000000000 +0000 @@ -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 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 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 Tue, 05 Mar 2019 09:38:56 -0700 + mailscripts (0.4-1) unstable; urgency=medium * Do not import messages without a Message-Id header (Closes: #909835). diff -Nru mailscripts-0.4/debian/control mailscripts-0.7/debian/control --- mailscripts-0.4/debian/control 2018-10-27 17:56:10.000000000 +0000 +++ mailscripts-0.7/debian/control 2019-03-06 18:37:42.000000000 +0000 @@ -30,6 +30,7 @@ Depends: libconfig-tiny-perl, libfile-which-perl, + libipc-system-simple-perl, libmime-tools-perl, python3, ${misc:Depends}, diff -Nru mailscripts-0.4/debian/copyright mailscripts-0.7/debian/copyright --- mailscripts-0.4/debian/copyright 2018-10-27 17:56:10.000000000 +0000 +++ mailscripts-0.7/debian/copyright 2019-03-06 18:37:42.000000000 +0000 @@ -2,7 +2,7 @@ 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 -Nru mailscripts-0.4/mailscripts.el mailscripts-0.7/mailscripts.el --- mailscripts-0.4/mailscripts.el 2018-10-27 17:56:19.000000000 +0000 +++ mailscripts-0.7/mailscripts.el 2019-03-06 18:38:02.000000000 +0000 @@ -1,7 +1,7 @@ ;;; mailscripts.el --- functions to access tools in the mailscripts package ;; Author: Sean Whitton -;; Version: 0.4 +;; Version: 0.7 ;; Package-Requires: (notmuch) ;; Copyright (C) 2018 Sean Whitton diff -Nru mailscripts-0.4/notmuch-slurp-debbug mailscripts-0.7/notmuch-slurp-debbug --- mailscripts-0.4/notmuch-slurp-debbug 2018-10-27 17:56:19.000000000 +0000 +++ mailscripts-0.7/notmuch-slurp-debbug 2019-03-06 18:38:02.000000000 +0000 @@ -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 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 @@ && -d catfile($maildir, "new") && -d catfile($maildir, "tmp")); -my $bts_server_arg = defined $bts_server - ? "--bts-server $bts_server" - : ""; - -# 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"; +my @bts_server_args = defined $bts_server + ? ("--bts-server", $bts_server) + : undef; + +# 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 @@ # 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 @@ # 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));