diff options
author | Niels Thykier <niels@thykier.net> | 2017-10-10 18:07:31 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2017-10-10 18:07:31 +0000 |
commit | bb17a1df1734b7216379d2205697a9947e9252f9 (patch) | |
tree | d2ae08d1a42c98f7f867a15eac9f79cc2cf932b8 /t/dh_installsystemd | |
parent | a06aee47441b982e691cb871468d064a1a4b6ae4 (diff) | |
download | debhelper-bb17a1df1734b7216379d2205697a9947e9252f9.tar.gz |
dh_systemd_*: Properly quote unit names in autoscripts
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 't/dh_installsystemd')
-rwxr-xr-x | t/dh_installsystemd/dh_systemd.t | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/t/dh_installsystemd/dh_systemd.t b/t/dh_installsystemd/dh_systemd.t index 265e84c1..dee70965 100755 --- a/t/dh_installsystemd/dh_systemd.t +++ b/t/dh_installsystemd/dh_systemd.t @@ -27,10 +27,10 @@ sub unit_is_enabled { my $matches; $num_masks = $num_masks // $num_enables; @output=`cat debian/$package.postinst.debhelper`; - $matches = grep { m{^if deb-systemd-helper .* was-enabled .*$unit\.service} } @output; + $matches = grep { m{^if deb-systemd-helper .* was-enabled .*'\Q$unit\E\.service'} } @output; ok($matches == $num_enables) or diag("$unit appears to have been enabled $matches times (expected $num_enables)"); @output=`cat debian/$package.postrm.debhelper`; - $matches = grep { m{deb-systemd-helper mask.*$unit\.service} } @output; + $matches = grep { m{deb-systemd-helper mask.*'\Q$unit\E\.service'} } @output; ok($matches == $num_masks) or diag("$unit appears to have been masked $matches times (expected $num_masks)"); } sub unit_is_started { @@ -39,10 +39,10 @@ sub unit_is_started { my $matches; $num_stops = $num_stops // $num_starts; @output=`cat debian/$package.postinst.debhelper`; - $matches = grep { m{deb-systemd-invoke \$_dh_action .*$unit.service} } @output; + $matches = grep { m{deb-systemd-invoke \$_dh_action .*'\Q$unit\E.service'} } @output; ok($matches == $num_starts) or diag("$unit appears to have been started $matches times (expected $num_starts)"); @output=`cat debian/$package.prerm.debhelper`; - $matches = grep { m{deb-systemd-invoke stop .*$unit.service} } @output; + $matches = grep { m{deb-systemd-invoke stop .*'\Q$unit\E.service'} } @output; ok($matches == $num_stops) or diag("$unit appears to have been stopped $matches times (expected $num_stops)"); } @@ -115,6 +115,14 @@ each_compat_up_to_and_incl_subtest(10, sub { ok($matches == 1); ok(run_dh_tool('dh_clean')); + # Quoting #764730 + make_path('debian/foo/lib/systemd/system/'); + install_file('debian/foo.service', 'debian/foo/lib/systemd/system/foo\x2dfuse.service'); + ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_enable')); + ok(run_dh_tool({ 'needs_root' => 1 }, 'dh_systemd_start')); + unit_is_enabled('foo', 'foo\x2dfuse', 1); + unit_is_started('foo', 'foo\x2dfuse', 1); + ok(run_dh_tool('dh_clean')); }); |