Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: ikiwiki-host...@packages.debian.org
Control: affects -1 + src:ikiwiki-hosting

Please unblock package ikiwiki-hosting

[ Reason ]
Fix `ikisite backup` and related commands

[ Impact ]
The daily backup cron job doesn't work in the version in testing.

[ Tests ]
Manually tested on a web server recently upgraded to bookworm.
I also expanded the existing autopkgtest smoke-test to cover the most
important ikisite commands.

[ Risks ]
Low risk, the patch is simple (and the package is not widely used).

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

unblock ikiwiki-hosting/0.20220716-2
diffstat for ikiwiki-hosting-0.20220716 ikiwiki-hosting-0.20220716

 debian/changelog                                                               |   14 +++
 debian/control                                                                 |    1 
 debian/patches/ikisite-backup-Create-the-bundle-as-the-site-s-user.patch       |   29 +++++++
 debian/patches/ikiwiki-hosting.conf-Indicate-that-systemd-unit-needs-to-.patch |    1 
 debian/patches/series                                                          |    1 
 debian/tests/create-delete                                                     |   39 +++++++---
 ikisite                                                                        |    4 -
 7 files changed, 79 insertions(+), 10 deletions(-)

diff -Nru ikiwiki-hosting-0.20220716/debian/changelog ikiwiki-hosting-0.20220716/debian/changelog
--- ikiwiki-hosting-0.20220716/debian/changelog	2023-01-29 20:00:40.000000000 +0000
+++ ikiwiki-hosting-0.20220716/debian/changelog	2023-03-30 10:56:12.000000000 +0100
@@ -1,3 +1,17 @@
+ikiwiki-hosting (0.20220716-2) unstable; urgency=medium
+
+  * d/p/ikisite-backup-Create-the-bundle-as-the-site-s-user.patch:
+    Add patch fixing `ikisite backup` with bookworm's git version
+    (Closes: #1033692)
+    - d/tests/create-delete: Add a regression test for `ikisite backup`,
+      among other subcommands
+  * d/p/ikiwiki-hosting.conf-Indicate-that-systemd-unit-needs-to-.patch:
+    Mark patch as forwarded
+  * d/control: Add missing dependency on rsync, detected by this version's
+    additional test coverage
+
+ -- Simon McVittie <s...@debian.org>  Thu, 30 Mar 2023 10:56:12 +0100
+
 ikiwiki-hosting (0.20220716-1) unstable; urgency=medium
 
   * New upstream release
diff -Nru ikiwiki-hosting-0.20220716/debian/control ikiwiki-hosting-0.20220716/debian/control
--- ikiwiki-hosting-0.20220716/debian/control	2023-01-29 20:00:40.000000000 +0000
+++ ikiwiki-hosting-0.20220716/debian/control	2023-03-30 10:56:12.000000000 +0100
@@ -101,6 +101,7 @@
  polygen-data,
  python3,
  python3-docutils,
+ rsync,
  uuid,
  ${misc:Depends},
  ${perl:Depends},
diff -Nru ikiwiki-hosting-0.20220716/debian/patches/ikisite-backup-Create-the-bundle-as-the-site-s-user.patch ikiwiki-hosting-0.20220716/debian/patches/ikisite-backup-Create-the-bundle-as-the-site-s-user.patch
--- ikiwiki-hosting-0.20220716/debian/patches/ikisite-backup-Create-the-bundle-as-the-site-s-user.patch	1970-01-01 01:00:00.000000000 +0100
+++ ikiwiki-hosting-0.20220716/debian/patches/ikisite-backup-Create-the-bundle-as-the-site-s-user.patch	2023-03-30 10:56:12.000000000 +0100
@@ -0,0 +1,29 @@
+From: Simon McVittie <s...@debian.org>
+Date: Thu, 30 Mar 2023 09:30:19 +0100
+Subject: ikisite backup: Create the bundle as the site's user
+
+Newer versions of git refuse to act on a repository not owned by the
+current uid.
+
+Bug-Debian: https://bugs.debian.org/1033692
+Signed-off-by: Simon McVittie <s...@debian.org>
+Forwarded: https://ikiwiki-hosting.branchable.com/bugs/ikisite_backup_fails_on_Debian_12___40__git_2.39.2__41__/
+---
+ ikisite | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/ikisite b/ikisite
+index 4663fd9..88a3def 100755
+--- a/ikisite
++++ b/ikisite
+@@ -214,7 +214,9 @@ sub backup {
+ 		# will either see the new or old refs, and not no refs.
+ 		# Also, this relies on git writing objects before
+ 		# updating the refs to point to them.
+-		shell("git", "bundle", "create", $dump, "--all");
++		runas(username($hostname), sub {
++			shell("git", "bundle", "create", $dump, "--all");
++		});
+ 		# git bundle does not preserve git's config file,
+ 		# so that will be backed up separately.
+ 		push @tobackup, repository($hostname)."/config";
diff -Nru ikiwiki-hosting-0.20220716/debian/patches/ikiwiki-hosting.conf-Indicate-that-systemd-unit-needs-to-.patch ikiwiki-hosting-0.20220716/debian/patches/ikiwiki-hosting.conf-Indicate-that-systemd-unit-needs-to-.patch
--- ikiwiki-hosting-0.20220716/debian/patches/ikiwiki-hosting.conf-Indicate-that-systemd-unit-needs-to-.patch	2023-01-29 20:00:40.000000000 +0000
+++ ikiwiki-hosting-0.20220716/debian/patches/ikiwiki-hosting.conf-Indicate-that-systemd-unit-needs-to-.patch	2023-03-30 10:56:12.000000000 +0100
@@ -3,6 +3,7 @@
 Subject: ikiwiki-hosting.conf: Indicate that systemd unit needs to be in sync
 
 Signed-off-by: Simon McVittie <s...@debian.org>
+Forwarded: https://ikiwiki-hosting.branchable.com/todo/use_a_native_systemd_unit_to_run_git-daemon/
 ---
  ikiwiki-hosting.conf | 6 ++++++
  1 file changed, 6 insertions(+)
diff -Nru ikiwiki-hosting-0.20220716/debian/patches/series ikiwiki-hosting-0.20220716/debian/patches/series
--- ikiwiki-hosting-0.20220716/debian/patches/series	2023-01-29 20:00:40.000000000 +0000
+++ ikiwiki-hosting-0.20220716/debian/patches/series	2023-03-30 10:56:12.000000000 +0100
@@ -1 +1,2 @@
 ikiwiki-hosting.conf-Indicate-that-systemd-unit-needs-to-.patch
+ikisite-backup-Create-the-bundle-as-the-site-s-user.patch
diff -Nru ikiwiki-hosting-0.20220716/debian/tests/create-delete ikiwiki-hosting-0.20220716/debian/tests/create-delete
--- ikiwiki-hosting-0.20220716/debian/tests/create-delete	2023-01-29 20:00:40.000000000 +0000
+++ ikiwiki-hosting-0.20220716/debian/tests/create-delete	2023-03-30 10:56:12.000000000 +0100
@@ -10,16 +10,33 @@
 
 chdir($ENV{AUTOPKGTEST_TMP}) or die "chdir: $!\n";
 
+sub assert_present {
+	my ($name) = @_;
+	ok(-d "/home/e-$name");
+	ok(-f "/home/e-$name/ikiwiki.setup");
+	ok(-f "/home/e-$name/public_html/ikiwiki/index.html");
+
+	my $uid = getpwnam("e-$name");
+	my $stat = stat("/home/e-$name");
+	is($stat->uid, $uid);
+}
+
+sub assert_absent {
+	my ($name) = @_;
+	ok(! -e "/home/e-$name");
+}
+
 # This assumes that ikiwiki-hosting.conf still has prefix_e=example.com.
 ok(! system(qw(ikisite create foo.example.com --admin=root@localhost)));
-ok(-d '/home/e-foo');
-ok(-f '/home/e-foo/ikiwiki.setup');
-ok(-f '/home/e-foo/public_html/ikiwiki/index.html');
-
-my $uid = `id -u e-foo`;
-chomp $uid;
-my $stat = stat('/home/e-foo');
-is($stat->uid, $uid);
+assert_present('foo');
+
+my $backup = $ENV{AUTOPKGTEST_TMP}.'/backup';
+
+ok(! system(qw(ikisite backup), '--filename='.$backup, qw(foo.example.com)));
+ok(! system(qw(ikisite compact foo.example.com)));
+ok(! system(qw(ikisite rename foo.example.com baz.example.com)));
+ok(! system(qw(ikisite restore foo.example.com), '--filename='.$backup));
+ok(! system(qw(ikisite branch foo.example.com bar.example.com)));
 
 ok(! system('getent passwd "$(id -nu)" > passwd'));
 ok(! system('getent group "$(id -ng)" > group'));
@@ -50,6 +67,10 @@
 };
 
 ok(! system(qw(ikisite delete foo.example.com)));
-ok(! -e '/home/e-foo');
+ok(! system(qw(ikisite delete bar.example.com)));
+ok(! system(qw(ikisite delete baz.example.com)));
+assert_absent('foo');
+assert_absent('bar');
+assert_absent('baz');
 
 done_testing;
diff -Nru ikiwiki-hosting-0.20220716/ikisite ikiwiki-hosting-0.20220716/ikisite
--- ikiwiki-hosting-0.20220716/ikisite	2022-08-01 16:37:58.000000000 +0100
+++ ikiwiki-hosting-0.20220716/ikisite	2023-03-30 11:37:52.000000000 +0100
@@ -214,7 +214,9 @@
 		# will either see the new or old refs, and not no refs.
 		# Also, this relies on git writing objects before
 		# updating the refs to point to them.
-		shell("git", "bundle", "create", $dump, "--all");
+		runas(username($hostname), sub {
+			shell("git", "bundle", "create", $dump, "--all");
+		});
 		# git bundle does not preserve git's config file,
 		# so that will be backed up separately.
 		push @tobackup, repository($hostname)."/config";

Reply via email to