Bug#873789: init-system-helpers: autopkgtests broken in 1.49
Steve Langasek
steve.langasek at canonical.com
Thu Aug 31 08:12:30 BST 2017
Package: init-system-helpers
Version: 1.49
Followup-For: Bug #873789
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu artful ubuntu-patch
Attached is a patch which fixes the tests to also correctly handle the
escape characters in the unit names.
Cheers,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek at ubuntu.com vorlon at debian.org
-------------- next part --------------
diff -Nru init-system-helpers-1.49/t/001-deb-systemd-helper.t init-system-helpers-1.49ubuntu1/t/001-deb-systemd-helper.t
--- init-system-helpers-1.49/t/001-deb-systemd-helper.t 2017-07-17 09:27:32.000000000 -0700
+++ init-system-helpers-1.49ubuntu1/t/001-deb-systemd-helper.t 2017-08-30 23:44:48.000000000 -0700
@@ -21,7 +21,7 @@
sub _unit_check {
my ($unit_file, $cmd, $cb, $verb) = @_;
- my $retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh $cmd $unit_file");
+ my $retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh $cmd '$unit_file'");
isnt($retval, -1, 'deb-systemd-helper could be executed');
ok(!($retval & 127), 'deb-systemd-helper did not exit due to a signal');
$cb->($retval >> 8, 0, "random unit file $verb $cmd");
@@ -96,7 +96,7 @@
'multi-user.target.wants does not exist yet');
}
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
my $symlink_path = "/etc/systemd/system/multi-user.target.wants/$random_unit";
ok(-l $symlink_path, "$random_unit was enabled");
@@ -120,7 +120,7 @@
isnt_enabled($random_unit);
is_debian_installed($random_unit);
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
isnt_enabled($random_unit);
@@ -133,7 +133,7 @@
ok(-f $statefile, 'state file exists');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test _DEB_SYSTEMD_HELPER_PURGE=1 $dsh disable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test _DEB_SYSTEMD_HELPER_PURGE=1 $dsh disable '$random_unit'");
is($retval, 0, "disable command succeeded");
ok(! -f $statefile, 'state file does not exist anymore after purging');
isnt_debian_installed($random_unit);
@@ -145,7 +145,7 @@
ok(! -l $symlink_path, 'symlink does not exist yet');
isnt_enabled($random_unit);
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
is_enabled($random_unit);
@@ -155,7 +155,7 @@
# ┃ Verify “disable” removes the symlinks. ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test _DEB_SYSTEMD_HELPER_PURGE=1 $dsh disable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test _DEB_SYSTEMD_HELPER_PURGE=1 $dsh disable '$random_unit'");
is($retval, 0, "disable command succeeded");
isnt_enabled($random_unit);
@@ -167,7 +167,7 @@
ok(! -l $symlink_path, 'symlink does not exist yet');
isnt_enabled($random_unit);
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
is_enabled($random_unit);
@@ -177,7 +177,7 @@
# ┃ Verify the “purge” verb works. ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge '$random_unit'");
is($retval, 0, "purge command succeeded");
isnt_enabled($random_unit);
@@ -190,7 +190,7 @@
ok(! -l $symlink_path, 'symlink does not exist yet');
isnt_enabled($random_unit);
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
is_enabled($random_unit);
@@ -203,12 +203,12 @@
my $mask_path = "/etc/systemd/system/$random_unit";
ok(! -l $mask_path, 'mask link does not exist yet');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask '$random_unit'");
is($retval, 0, "mask command succeeded");
ok(-l $mask_path, 'mask link exists');
is(readlink($mask_path), '/dev/null', 'service masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask '$random_unit'");
is($retval, 0, "unmask command succeeded");
ok(! -e $mask_path, 'mask link does not exist anymore');
@@ -216,16 +216,16 @@
# ┃ Verify “mask” (when disabled) works the same way ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh disable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh disable '$random_unit'");
is($retval, 0, "disable command succeeded");
ok(! -e $symlink_path, 'symlink no longer exists');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask '$random_unit'");
is($retval, 0, "mask command succeeded");
ok(-l $mask_path, 'mask link exists');
is(readlink($mask_path), '/dev/null', 'service masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask '$random_unit'");
is($retval, 0, "unmask command succeeded");
ok(! -e $mask_path, 'symlink no longer exists');
@@ -238,12 +238,12 @@
ok(-l $mask_path, 'mask link exists');
is(readlink($mask_path), '/dev/null', 'service masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask '$random_unit'");
is($retval, 0, "mask command succeeded");
ok(-l $mask_path, 'mask link exists');
is(readlink($mask_path), '/dev/null', 'service still masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask '$random_unit'");
is($retval, 0, "unmask command succeeded");
ok(-l $mask_path, 'mask link exists');
is(readlink($mask_path), '/dev/null', 'service still masked');
@@ -270,14 +270,14 @@
ok(-e $mask_path, 'local service file exists');
ok(! -l $mask_path, 'local service file is not a symlink');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask '$random_unit'");
isnt($retval, -1, 'deb-systemd-helper could be executed');
ok(!($retval & 127), 'deb-systemd-helper did not exit due to a signal');
is($retval >> 8, 0, 'deb-systemd-helper exited with exit code 0');
ok(-e $mask_path, 'local service file still exists');
ok(! -l $mask_path, 'local service file is still not a symlink');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask '$random_unit'");
isnt($retval, -1, 'deb-systemd-helper could be executed');
ok(!($retval & 127), 'deb-systemd-helper did not exit due to a signal');
is($retval >> 8, 0, 'deb-systemd-helper exited with exit code 0');
@@ -290,7 +290,7 @@
# ┃ Verify Alias= handling. ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge '$random_unit'");
is($retval, 0, "purge command succeeded");
open($fh, '>', $servicefile_path);
@@ -309,25 +309,25 @@
isnt_enabled($random_unit);
isnt_enabled('foo\x2dtest.service');
-my $alias_path = "/etc/systemd/system/foo\x2dtest.service";
+my $alias_path = '/etc/systemd/system/foo\x2dtest.service';
ok(! -l $alias_path, 'alias link does not exist yet');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
is(readlink($alias_path), $servicefile_path, 'correct alias link');
is_enabled($random_unit);
ok(! -l $mask_path, 'mask link does not exist yet');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask '$random_unit'");
is($retval, 0, "mask command succeeded");
is(readlink($alias_path), $servicefile_path, 'correct alias link');
is(readlink($mask_path), '/dev/null', 'service masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask '$random_unit'");
is($retval, 0, "unmask command succeeded");
is(readlink($alias_path), $servicefile_path, 'correct alias link');
ok(! -l $mask_path, 'mask link does not exist any more');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh disable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh disable '$random_unit'");
isnt_enabled($random_unit);
ok(! -l $alias_path, 'alias link does not exist any more');
@@ -335,25 +335,25 @@
# ┃ Verify Alias/mask with removed package (as in postrm) ┃
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge '$random_unit'");
is($retval, 0, "purge command succeeded");
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
is(readlink($alias_path), $servicefile_path, 'correct alias link');
unlink($servicefile_path);
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask '$random_unit'");
is($retval, 0, "mask command succeeded with uninstalled unit");
is(readlink($alias_path), $servicefile_path, 'correct alias link');
is(readlink($mask_path), '/dev/null', 'service masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge '$random_unit'");
is($retval, 0, "purge command succeeded with uninstalled unit");
ok(! -l $alias_path, 'alias link does not exist any more');
is(readlink($mask_path), '/dev/null', 'service masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask '$random_unit'");
is($retval, 0, "unmask command succeeded with uninstalled unit");
ok(! -l $mask_path, 'mask link does not exist any more');
@@ -378,7 +378,7 @@
isnt_enabled($random_unit);
isnt_enabled('foo\x2dtest.service');
# note that in this case $alias_path and $mask_path are identical
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh enable '$random_unit'");
is($retval, 0, "enable command succeeded");
is_enabled($random_unit);
# systemctl enable does create the alias link even if it's not needed
@@ -386,15 +386,15 @@
unlink($servicefile_path);
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh mask '$random_unit'");
is($retval, 0, "mask command succeeded");
is(readlink($mask_path), '/dev/null', 'service masked');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh unmask '$random_unit'");
is($retval, 0, "unmask command succeeded");
ok(! -l $mask_path, 'mask link does not exist any more');
-$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge $random_unit");
+$retval = system("DPKG_MAINTSCRIPT_PACKAGE=test $dsh purge '$random_unit'");
isnt_enabled($random_unit);
ok(! -l $mask_path, 'mask link does not exist any more');
More information about the Pkg-systemd-maintainers
mailing list