[debhelper-devel] [debhelper] 01/01: Include $! in error messages

Niels Thykier nthykier at moszumanska.debian.org
Sat Oct 14 11:20:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit e29afec31f2923b15ae526ce35a518a96c589ff6
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Oct 14 11:19:38 2017 +0000

    Include $! in error messages
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog  | 9 +++++++++
 dh_installsystemd | 4 ++--
 dh_systemd_enable | 2 +-
 dh_systemd_start  | 2 +-
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1c3c74d..98a9d4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+debhelper (10.9.3) UNRELEASED; urgency=medium
+
+  * dh_installsystemd: Improve error messages to include the actual
+    error caused by attempted to open the file.
+  * dh_systemd_enable: Ditto.
+  * dh_systemd_start: Ditto.
+
+ -- Niels Thykier <niels at thykier.net>  Sat, 14 Oct 2017 11:18:19 +0000
+
 debhelper (10.9.2) unstable; urgency=medium
 
   [ Niels Thykier ]
diff --git a/dh_installsystemd b/dh_installsystemd
index 29c60db..8cd826b 100755
--- a/dh_installsystemd
+++ b/dh_installsystemd
@@ -156,7 +156,7 @@ init(options => {
 sub contains_install_section {
 	my ($unit_path) = @_;
 
-	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s)");
+	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) to check for [Install]: $!");
 
 	while (my $line = <$fh>) {
 		chomp($line);
@@ -185,7 +185,7 @@ sub extract_key {
 
 	return @values if $dh{NO_ALSO};
 
-	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s)");
+	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s): $!");
 
 	while (my $line = <$fh>) {
 		chomp($line);
diff --git a/dh_systemd_enable b/dh_systemd_enable
index a05aab1..e2e5add 100755
--- a/dh_systemd_enable
+++ b/dh_systemd_enable
@@ -124,7 +124,7 @@ init(options => {
 
 sub contains_install_section {
 	my ($unit_path) = @_;
-	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) to check for [Install]");
+	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) to check for [Install]: $!");
 	while (my $line = <$fh>) {
 		chomp($line);
 		return 1 if $line =~ /^\s*\[Install\]$/i;
diff --git a/dh_systemd_start b/dh_systemd_start
index 0c3a51d..362d00a 100755
--- a/dh_systemd_start
+++ b/dh_systemd_start
@@ -104,7 +104,7 @@ sub extract_key {
 
 	return if $dh{NO_ALSO};
 
-	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s)");
+	open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s): $!");
 
 	while (my $line = <$fh>) {
 		chomp($line);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list