[PATCH] dpkg-buildpackage: print message on signal

[email protected]
Newsgroups gmane.linux.debian.devel.dpkg.general
Message-ID <[email protected]>
From: Jochen Sprickerhof <[email protected]>

We found a unit test in the gcc package that killed dpkg-buildpackage
(#1089007). The error message was non obvious, so this adds a warning in
case someone stumbles of over this again.
---
 scripts/dpkg-buildpackage.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index d849d6e90..4eadb5e7c 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -20,6 +20,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
+use sigtrap 'handler' => \&sig_handler, 'normal-signals';
 use strict;
 use warnings;
 
@@ -52,6 +53,12 @@ use Dpkg::Vendor qw(run_vendor_hook);
 
 textdomain('dpkg-dev');
 
+sub sig_handler {
+    my $sig_name = shift;
+    print g_("$0 was killed by signal $sig_name.\n");
+    print g_("This is probably a bug in the package.\n");
+}
+
 sub showversion {
     printf g_("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.