Control: tags -1 patch

On Sat, 7 Dec 2024 19:54:42 +0100 Niels Thykier <ni...@thykier.net> wrote:
Source: chiark-utils
Version: 7.0.3
Severity: important
Tags: ftbfs
Justification: FTBFS
X-Debbugs-Cc: ni...@thykier.net
User: ni...@thykier.net
Usertags: rrr-no-as-default-issue

Dear maintainer,

During a test rebuild for building packages with
`Rules-Requires-Root: no` as the default in `dpkg`,
chiark-utils failed to rebuild.

[...]

Hi,

I think the attached patch should solve it. Though, please review it carefully, since I am seeing some surprising delta. Such as git-branchmove.1 being added to the diff, which I think is a bug in the original packaging. Additionally 'debian/chiark-backup/conffiles' is removed, which I do not understand and it looks kind of bad. I have filtered out both of these in the attached debdiff.

Like with authbind, this might be overdue for a packaging rewrite. Let me know if you are interested in that.

Best regards,
Niels

diff -Nru chiark-utils-7.0.3/cprogs/Makefile 
chiark-utils-7.0.3+nmu1/cprogs/Makefile
--- chiark-utils-7.0.3/cprogs/Makefile  2024-09-26 18:07:41.000000000 +0200
+++ chiark-utils-7.0.3+nmu1/cprogs/Makefile     2024-12-30 11:26:09.000000000 
+0100
@@ -93,7 +93,7 @@
                $(INSTALL_DIRECTORY) $(bindir) $(sbindir)
                $(INSTALL_PROGRAM) $(PROGRAMS) $(bindir)
                $(INSTALL_PROGRAM) $(DAEMONS) $(sbindir)
-               $(INSTALL) -m 4774 -o root -g $(SYSTEM_GROUP) \
+               $(INSTALL) -m 4774 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP) \
                        $(SUIDSBINPROGRAMS) $(sbindir)
 
 install-docs:  $(TXTDOCS)
diff -Nru chiark-utils-7.0.3/debian/changelog 
chiark-utils-7.0.3+nmu1/debian/changelog
--- chiark-utils-7.0.3/debian/changelog 2024-09-26 18:07:41.000000000 +0200
+++ chiark-utils-7.0.3+nmu1/debian/changelog    2024-12-30 11:26:09.000000000 
+0100
@@ -1,3 +1,10 @@
+chiark-utils (7.0.3+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Make package build without requiring root. (Closes: #1089303)
+
+ -- Niels Thykier <ni...@thykier.net>  Mon, 30 Dec 2024 10:26:09 +0000
+
 chiark-utils (7.0.3) unstable; urgency=medium
 
   * Team upload.
diff -Nru chiark-utils-7.0.3/debian/control 
chiark-utils-7.0.3+nmu1/debian/control
--- chiark-utils-7.0.3/debian/control   2024-09-26 18:07:41.000000000 +0200
+++ chiark-utils-7.0.3+nmu1/debian/control      2024-12-30 11:25:23.000000000 
+0100
@@ -4,6 +4,7 @@
 Maintainer: Ian Jackson <ijack...@chiark.greenend.org.uk>
 Build-Depends: libx11-dev, libxmu-dev, nettle-dev, debhelper (>= 13),
                libxdmcp-dev, libxau-dev, libice-dev, libsm-dev, libuv1-dev
+Rules-Requires-Root: no
 Standards-Version: 4.6.1.1
 Vcs-Browser: https://www.chiark.greenend.org.uk/ucgi/~ian/git/chiark-utils.git/
 Vcs-Git: https://www.chiark.greenend.org.uk/ucgi/~ian/githttp/chiark-utils.git
diff -Nru chiark-utils-7.0.3/debian/rules chiark-utils-7.0.3+nmu1/debian/rules
--- chiark-utils-7.0.3/debian/rules     2024-09-26 18:07:41.000000000 +0200
+++ chiark-utils-7.0.3+nmu1/debian/rules        2024-12-30 11:26:09.000000000 
+0100
@@ -37,19 +37,26 @@
                $(MAKE) -C $$s -i distclean || \
                $(MAKE) -C $$s -f Makefile.in distclean; \
        done
-       rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
-       rm -rf debian/sv-* debian/*.debhelper.log
+       rm -rf debian/sv-*
+       dh_clean
 
 binary-prep:
        $(checkdir)
        rm -rf debian/tmp*
+       # The ownership information will be reset later to root:root in
+       # the `dpkg-deb` call, so the actual ownership here is of no
+       # consequence as long as we are allowed to perform the action.
        #
+       # Chown'ing from your own user/group to itself is always allowed,
+       # so we pass that via id -u/-g.
        set -e; for s in $(subdirs_build_arch) $(subdirs_nobuild); do \
                $(MAKE) -C $$s install install-docs install-examples \
                        prefix=$t/$$s/usr \
                        etcdir=$t/$$s/etc \
                        varlib=$t/$$s/var/lib \
-                       mandir=$t/$$s/usr/share/man; \
+                       mandir=$t/$$s/usr/share/man \
+                       SYSTEM_USER=$$(id -u) \
+                       SYSTEM_GROUP=$$(id -g); \
        done
        #
        mv $t/cprogs $t/chiark-utils-bin
@@ -114,16 +121,16 @@
        dh_lintian -p$p -Pdebian/tmp/$p
        dh_link -p$p -Pdebian/tmp/$p
        dpkg-gencontrol -p$p -P$t/$p -Tdebian/sv-$p
-       chown -R root.root debian/tmp
        chmod -R g-ws debian/tmp
        debian/rules binary-hook-$p
-       dpkg --build $t/$p ..
+       dpkg-deb --root-owner-group --build $t/$p ..
 
-binary-indep:  checkroot build binary-prep
+binary-indep: build binary-prep
+       $(checkdir)
        set -e; for p in $(packages_indep); do \
                debian/rules binary-one p=$$p; done
 
-binary-arch:   checkroot build binary-prep
+binary-arch: build binary-prep
        $(checkdir)
        set -ex; for p in chiark-really chiark-utils-bin chiark-rwbuffer; do \
                dh_strip -p$$p -Pdebian/tmp/$$p; done
@@ -156,8 +163,4 @@
 source diff:
        @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
 
-checkroot:
-       $(checkdir)
-       test root = "`whoami`"
-
-.PHONY: binary binary-arch binary-indep clean checkroot
+.PHONY: binary binary-arch binary-indep clean
diff -Nru chiark-utils-7.0.3/settings.make chiark-utils-7.0.3+nmu1/settings.make
--- chiark-utils-7.0.3/settings.make    2024-09-26 18:07:41.000000000 +0200
+++ chiark-utils-7.0.3+nmu1/settings.make       2024-12-30 11:26:09.000000000 
+0100
@@ -33,6 +33,7 @@
 OPTIMISE=      -O2
 DEBUG=         -g
 
+SYSTEM_USER=   root
 SYSTEM_GROUP=  root
 
 prefix=/usr/local
@@ -56,7 +57,7 @@
 # INSTALL_PROGRAM_STRIP_OPT=-s
 
 INSTALL=               install -c
-INSTALL_SHARE=         $(INSTALL) -m 644 -o root -g $(SYSTEM_GROUP)
-INSTALL_SCRIPT=                $(INSTALL) -m 755 -o root -g $(SYSTEM_GROUP)
+INSTALL_SHARE=         $(INSTALL) -m 644 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP)
+INSTALL_SCRIPT=                $(INSTALL) -m 755 -o $(SYSTEM_USER) -g 
$(SYSTEM_GROUP)
 INSTALL_PROGRAM=       $(INSTALL_SCRIPT) $(INSTALL_PROGRAM_STRIP_OPT)
-INSTALL_DIRECTORY=     $(INSTALL) -m 2755 -o root -g $(SYSTEM_GROUP) -d
+INSTALL_DIRECTORY=     $(INSTALL) -m 2755 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP) 
-d
diff -Nru chiark-utils-7.0.3/sync-accounts/Makefile 
chiark-utils-7.0.3+nmu1/sync-accounts/Makefile
--- chiark-utils-7.0.3/sync-accounts/Makefile   2024-09-26 18:07:41.000000000 
+0200
+++ chiark-utils-7.0.3+nmu1/sync-accounts/Makefile      2024-12-30 
11:26:09.000000000 +0100
@@ -19,12 +19,13 @@
 # with this program; if not, consult the Free Software Foundation's
 # website at www.fsf.org, or the GNU Project website at www.gnu.org.
 
+SYSTEM_USER=   root
 SYSTEM_GROUP=  root
 
 INSTALL=               install -c
-INSTALL_SHARE=         $(INSTALL) -m 644 -o root -g $(SYSTEM_GROUP)
-INSTALL_SCRIPT=                $(INSTALL) -m 755 -o root -g $(SYSTEM_GROUP)
-INSTALL_DIRECTORY=     $(INSTALL) -m 2755 -o root -g $(SYSTEM_GROUP) -d
+INSTALL_SHARE=         $(INSTALL) -m 644 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP)
+INSTALL_SCRIPT=                $(INSTALL) -m 755 -o $(SYSTEM_USER) -g 
$(SYSTEM_GROUP)
+INSTALL_DIRECTORY=     $(INSTALL) -m 2755 -o $(SYSTEM_USER) -g $(SYSTEM_GROUP) 
-d
 
 prefix=/usr/local
 bindir=$(prefix)/bin

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to