#1089303 chiark-utils: Supporting rootless builds by default

#1089303#5
Date:
2024-12-07 18:54:42 UTC
From:
To:
Dear maintainer,

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

Log Summary:
-------------------------------------------------------------------------------
[...]

+------------------------------------------------------------------------------+
| Build
                                                                        |
+------------------------------------------------------------------------------+


Unpack source
-------------

Format: 3.0 (native)
Source: chiark-utils
Binary: chiark-backup, chiark-scripts, chiark-rwbuffer, chiark-utils-
bin, chiark-really
Architecture: any all
Version: 7.0.3
Maintainer: Ian Jackson <ijackson@chiark.greenend.org.uk>
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
Build-Depends: libx11-dev, libxmu-dev, nettle-dev, debhelper (>= 13),
libxdmcp-dev, libxau-dev, libice-dev, libsm-dev, libuv1-dev
Package-List:
  chiark-backup deb utils optional arch=all
  chiark-really deb admin optional arch=any
  chiark-rwbuffer deb utils optional arch=any
  chiark-scripts deb admin optional arch=all
  chiark-utils-bin deb utils optional arch=any
Checksums-Sha1:
  54c200012cfe044d3640f065c9e25dabd5afa5e8 161724 chiark-utils_7.0.3.tar.xz
Checksums-Sha256:
  4f2ba73d1778f7a193600d2fffde63f191f506218f8ad12986c73ff04412161b 161724
chiark-utils_7.0.3.tar.xz
Files:
  1375d049795f2d04026cde1d437094c4 161724 chiark-utils_7.0.3.tar.xz
Dgit: b23a7f5855185b60cedc073c3066e619fd0e189f debian archive/
debian/7.0.3 https://git.dgit.debian.org/chiark-utils


gpgv: Signature made Thu Sep 26 16:10:00 2024 UTC
gpgv:                using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240
gpgv: Can't check signature: No public key
dpkg-source: warning: cannot verify inline signature for ./chiark-
utils_7.0.3.dsc: no acceptable signature found
dpkg-source: info: extracting chiark-utils in /<<PKGBUILDDIR>>
dpkg-source: info: unpacking chiark-utils_7.0.3.tar.xz

Check disk space
----------------

Sufficient free space for build

User Environment
----------------

APT_CONFIG=/var/lib/sbuild/apt.conf
HOME=/sbuild-nonexistent
LANG=en_US.UTF-8
LC_ALL=C.UTF-8
LOGNAME=debusine-worker
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
SHELL=/bin/sh
USER=debusine-worker

dpkg-buildpackage
-----------------

Command: dpkg-buildpackage -us -uc -b -rfakeroot
dpkg-buildpackage: info: source package chiark-utils
dpkg-buildpackage: info: source version 7.0.3
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Sean Whitton
<spwhitton@spwhitton.name>
  dpkg-source --before-build .
dpkg-buildpackage: info: host architecture arm64
  debian/rules clean
test -f cprogs/writebuffer.c
rm -f build
set -e; for s in cprogs; do \
	/usr/bin/make -C $s -i distclean || \
	/usr/bin/make -C $s -f Makefile.in distclean; \
done
make[1]: Entering directory '/<<PKGBUILDDIR>>/cprogs'
rm -f *~ ./#*# *.o readbuffer writebuffer with-lock-ex xbatmon-simple
summer watershed rcopy-repeatedly xduplic-copier prefork-interp cgi-
fcgi-interp acctdump
rm -f readbuffer writebuffer with-lock-ex xbatmon-simple summer
watershed rcopy-repeatedly xduplic-copier prefork-interp cgi-fcgi-interp
acctdump really trivsoundd watershed.txt prefork-interp.txt cgi-fcgi-
interp.txt xbatmon-simple.txt rcopy-repeatedly.txt
make[1]: Leaving directory '/<<PKGBUILDDIR>>/cprogs'
rm -rf *~ debian/tmp debian/*~ debian/files* debian/substvars*
rm -rf debian/sv-* debian/*.debhelper.log
  debian/rules binary
test -f cprogs/writebuffer.c
test root = "`whoami`"
make: *** [debian/rules:161: checkroot] Error 1
dpkg-buildpackage: error: debian/rules binary subprocess returned exit
status 2
--------------------------------------------------------------------------------
Build finished at 2024-11-15T21:39:05Z
-------------------------------------------------------------------------------


The above is just how the build ends and not necessarily the most
relevant part. If required, the full build log is available here:

https://people.debian.org/~nthykier/rrr-no-as-default/logs/977297.gz

You can find common solutions at
https://people.debian.org/~nthykier/rrr-no-as-default/docs/solutions.md

If this is really a bug in one of the build-depends, please use
reassign and affects, so that this is still visible in the BTS web
page for this package.

If this package is listed in
https://people.debian.org/~nthykier/rrr-no-as-default/docs/static-
ownership.list,
then please just set `Rules-Requires-Root: binary-targets` to the source
stanza of `debian/control` as a fix to this bug.

If this package is listed in
https://people.debian.org/~nthykier/rrr-no-as-default/docs/maybe-
misbuilds.list,
then the package was deemed at risk for misbuilding (having wrong
ownership) but had a FTBFS problem we tested it. Please test whether the
package works with `Rules-Requires-Root: no` validating that the
resulting deb has the correct ownership for all paths in the deb.

The goal is to have the default changed in `dpkg` either in `Trixie` or
`Forky`, depending on progress and feasibility with the release schedule
for Trixie.

For more information on this bug filing, please see:
https://lists.debian.org/debian-dpkg/2024/11/msg00016.html

Thanks,


PS: The builds were performed in mid-November. If you fixed the problem
between between then and this bug being filed, then please just close
the bug with the version it was fixed in.

#1089303#10
Date:
2024-12-30 10:46:14 UTC
From:
To:
Control: tags -1 patch

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

#1089303#17
Date:
2024-12-30 11:14:39 UTC
From:
To:
Niels Thykier:

I think I understand the `conffiles` one now. I added `dh_clean` since
`debian/.debhelper` was not cleaned up. However, `dh_clean` removes that
folder. That is trivially solvable. However, it does not answer the
`git-branchmove.1` part, and ...

The answer to this affects how we go about it.

Best regards,
Niels

#1089303#22
Date:
2024-12-30 19:07:18 UTC
From:
To:
Niels Thykier writes ("Bug#1089303: chiark-utils: Supporting rootless builds by default"):

Thanks for the patch.  (I haven't looked at it yet.)

You are very probably right about it needing a packaging rewrite.  It
really ought to be using dh, although I'm not sure how well that will
fit given how anomalous the upstream parts are.

Ian.

#1089303#27
Date:
2024-12-30 20:53:30 UTC
From:
To:
Ian Jackson:

Hi,

I had a look at migrating chiark-utils to `dh`.

The `git format-patch` generated patches (0001-0003) are based on
dgit/sid and move the package towards classic debhelper. The first patch
will also close this bug as a side effect. Each patch comments on the
diffoscope delta relative to be "the before"-state. The baseline was a
clean sid rebuild of `dgit/sid` in todays unstable (rather than the
archive debs) to remove noise from newer compiler versions since last
upload.

The final patch `dh-prototype.diff` is what I envisioned would be the
final bit required to move to `dh`. Though for some reason it changes
the generated `shlib:*` substvars for `chiark-utils-bin`. It is
consistently introduced with that patch (and reverting the patch
consistently restores the original behavior) but I see no logic in the
`dh` patch that should change the generated substvar, so I am at a loss
here. Note that  `dh` patch also have delta caused by `dh_dwz` being
run. I did not check it for other issues once I spotted the shlib one.

I recommend applying 0001-0003 for now. If you have time to debug
`dh-prototype.diff` then it would be great. However, the move to
debhelper classic would already be a major step of the way in my book.

Best regards,
Niels

#1089303#32
Date:
2024-12-30 21:58:08 UTC
From:
To:
Niels Thykier writes ("Re: Bug#1089303: chiark-utils: Supporting rootless builds by default"):

Thanks for this work.  I hope to look at this soon.

Ian.

#1089303#41
Date:
2025-01-04 08:35:35 UTC
From:
To:
Hi Ian.

The transition has entered is final phase and this bug has now become
RC. If you prefer, I can upload a minimal patch with
   `Rules-Requires-Root: binary-targets`

which will fix this RC bug against `chiark-utils` and avoid any negative
effects such as auto-removal. It is safe and will have no risk of
regression (it is "opt-in to the previous status quo").

Let me know if the NMU will help. Otherwise, I will leave this in your
hands for now and focus on other packages.

Best regards,
Niels

#1089303#46
Date:
2025-01-12 18:40:13 UTC
From:
To:
Hi.  Thanks for all this.  Superb work.

I have reviewed the first three patches and their output and I have
adopted them into my own mainline.  I'll be uploading later today.

First, though, I want to see if I can adopt the dh patch, or something
like it.

Regards,
Ian.

#1089303#53
Date:
2025-01-12 19:12:49 UTC
From:
To:
tl;dr:
  TYVM.  This is all great.
  I'll be uploading *with* your dh changes, fixed, shortly.

Niels Thykier writes ("Bug#1089303: chiark-utils: Supporting rootless builds by default"):

Thanks for the patch, which is actually excellent, and also for the
thorough and cautious report.  You give me great confidence in the
code, this way.

I investigated the shlibs issue.  I think the cause is that with the
dh sequencer, dh_link happens before dh_shlibdeps.  The result is that
the symlink /usr/bin/xacpi-simple is found by the loop in what is now
override_dh_shlibdeps.  The link target, xbatmon-simple, has its
dependencies explicitly downgraded, but the link isn't liosted in the
case statement.  Previously, dh_link ran later.  The fix is to have
the loop call realpath and match on the resolved path.

Temporarily overriding this allowed me to get a very minimal diff out
of diffoscope.

I have now done this.

Your patch, and my fixups (see above, plus a few .gitignore additions)
will be in sid shortly.

Regards,
Ian.

#1089303#58
Date:
2025-01-12 19:57:26 UTC
From:
To:
Ian Jackson:

You are welcome. :)

Makes sense that was the missing bit I could not figure out. :)

Sounds good!

Thanks for finishing this one up. :)

Best regards,
Niels

#1089303#63
Date:
2025-01-12 20:41:39 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
chiark-utils, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1089303@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Ian Jackson <ijackson@chiark.greenend.org.uk> (supplier of updated chiark-utils package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 12 Jan 2025 20:19:58 +0000
Source: chiark-utils
Architecture: source
Version: 8.0.0
Distribution: unstable
Urgency: medium
Maintainer: Ian Jackson <ijackson@chiark.greenend.org.uk>
Changed-By: Ian Jackson <ijackson@chiark.greenend.org.uk>
Closes: 1089303
Changes:
 chiark-utils (8.0.0) unstable; urgency=medium
 .
   * Rewrite the packaging to use `debhelper` and `dh` in as standard a way
     as possible.  As a consequence, support root-less builds.
     No functional changes to the installed packages.
     Closes: #1089303.  [Niels Thykier]
Checksums-Sha1:
 e386e4fdf3991a0c8941ca74e9737c4280c56f9c 1712 chiark-utils_8.0.0.dsc
 40d527f08950474b9d87d9f2cb218daa275229af 161744 chiark-utils_8.0.0.tar.xz
Checksums-Sha256:
 fe609f56e53903e0d9562edf83e8e2109632a47392066013225f610c9efe07d4 1712 chiark-utils_8.0.0.dsc
 41571bb6ccbe1290b1f877cf28c7d790c7f4db95eb709dbf3e0854fc3f625461 161744 chiark-utils_8.0.0.tar.xz
Files:
 9aeb17aa82f68b0e29d576dca4a0f520 1712 admin optional chiark-utils_8.0.0.dsc
 73f4cdb37a1ff14d5a8d3bd65b0874cf 161744 admin optional chiark-utils_8.0.0.tar.xz
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEVZrkbC1rbTJl58uh4+M5I0i1DTkFAmeEJAQACgkQ4+M5I0i1
DTnhKQf+MHFQ0M8bqL9KNPQDics6qgrchj1ftUW1c+AdHXde2rWDLMHmf8mXBUTp
56RNgYJ6PdfhVaWU6zOAxSmCfEMx+vySodmW2D5kXUY+gw6brIspVQzS3sTx2UFu
lBKiE31+DFXc8XT4sDTgJhYyp28iPFXCLhNhWiv+v+KKX65tBW39U7LarkgT4f0U
a5YTb2RQ0Wphz0NFJ74m9Na9dWm7MAS1OizzFfqE7jd8Rak18j/xHBnVUekO6gV7
33eHEkeiAcSlVAC9OWZ2A+IYfGS9QvwnWArofRNRIOfQeEgiRqOOs1N4FG0k+zED
sQxj2DI6olG3qvuiH6bmvDAqwEGJVw==
=nPg3
-----END PGP SIGNATURE-----