[debhelper-devel] [debhelper] 01/01: dh_systemd_*: Error out if the unit file cannot be read
Niels Thykier
nthykier at moszumanska.debian.org
Tue Oct 10 05:35:47 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 841170155bec2f60a2c4bcc03346bc296ff7525f
Author: Niels Thykier <niels at thykier.net>
Date: Sun Oct 8 14:50:53 2017 +0000
dh_systemd_*: Error out if the unit file cannot be read
Signed-off-by: Niels Thykier <niels at thykier.net>
---
debian/changelog | 3 +++
dh_systemd_enable | 6 +-----
dh_systemd_start | 11 +++--------
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 66f804b..bb70620 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,9 @@ debhelper (10.9.1) UNRELEASED; urgency=medium
init-system-helpers that is satisfied in oldstable.
* Dh_Lib: Fix regression where --no-act would actually create
maintscript snippets.
+ * dh_systemd_*: If an unit file cannot be read (e.g. to check for
+ the [Install] section), error out instead of emitting a warning
+ and continuing.
[ Dmitry Shachnev ]
* qmake.pm: Add basic cross-building support. (Closes: #877357)
diff --git a/dh_systemd_enable b/dh_systemd_enable
index db68b03..7c3f338 100755
--- a/dh_systemd_enable
+++ b/dh_systemd_enable
@@ -120,11 +120,7 @@ init(options => {
sub contains_install_section {
my ($unit_path) = @_;
- my $fh;
- if (!open($fh, '<', $unit_path)) {
- warning("Cannot open($unit_path) for extracting the Also= line(s)");
- return;
- }
+ open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s)");
while (my $line = <$fh>) {
chomp($line);
return 1 if $line =~ /^\s*\[Install\]$/i;
diff --git a/dh_systemd_start b/dh_systemd_start
index 0a04874..d17bb28 100755
--- a/dh_systemd_start
+++ b/dh_systemd_start
@@ -97,16 +97,11 @@ init(options => {
sub extract_key {
my ($unit_path, $key) = @_;
my @values;
- my $fh;
- if ($dh{NO_ALSO}) {
- return @values;
- }
+ return if $dh{NO_ALSO};
+
+ open(my $fh, '<', $unit_path) or error("Cannot open($unit_path) for extracting the Also= line(s)");
- if (!open($fh, '<', $unit_path)) {
- warning("Cannot open($unit_path) for extracting the Also= line(s)");
- return;
- }
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