On Sat, 18 Dec 2021 10:49:14 +0100
Niels Thykier <ni...@thykier.net> wrote:
> Hi,
> 
> I think I am missing a rationale / What problem are you trying to
> solve with this change/RFC?.
> 
> Thanks,
> ~Niels

Let me try to clarify. I was recently locally building a source package
that listed 'Rules-Requires-Root: no' in its debian/control file.
Seeing that, I attempted, I think not unreasonably, to execute the
binary target of the debian/rules file without using root. AKA:
```
$ debian/rules binary
```

This began the debhelper package build sequence which ran until the
dh_testroot step which errors out with the message:
```
dh_testroot: error: You must run this as root (or use fakeroot).
```
which is rather at odds with what is stated by the debian/control
header.



Debian Policy § 5.6.31 lists three categories of values for the
'Rules-Requires-Root:' header:

A) 'no'

B) 'binary-targets'

C) a list of keywords as detailed in Policy § 5.6.31.2 & 5.6.31.3

B simply denotes the existing default behavior of requiring root when
calling any of the binary targets of debian/rules (a.k.a. binary-arch,
binary-indep, and binary). It is currently identical in function to
a complete absence of the 'Rules-Requires-Root:' header altogether.

C denotes a dynamic, keyword-based system first alluded to in the
original R³ proposal and fully documented in the Debian Policy
sections noted previously. Because this new system requires builders to
provide a special "gain root command" (detailed in Policy § 4.9.2),
builders must opt-in to using this system by setting
DEB_RULES_REQUIRES_ROOT and DEB_GAIN_ROOT_CMD environment variables.

A on the other hand does not require providing a "gain root command" or
implementing any special new behaviour. By design it should just work
when the debian/rules file is run without root. However, as I read
Policy § 5.6.31, Policy nevertheless mandates that the
DEB_RULES_REQUIRES_ROOT environment variable must be set even in this
case and dh_testroot currently enforces this.

My proposal is to modify both dh_testroot and Policy to remove this
requirement from case A.

Thoughts?



Links:

dh_testroot(1)
https://manpages.debian.org/bookworm/debhelper/dh_testroot.1

RFC: Support for selective usage of (fake)root during package build (R³)
https://lists.debian.org/debian-devel/2017/10/msg00520.html

Debian Policy § 4.9.2  debian/rules and Rules-Requires-Root
https://www.debian.org/doc/debian-policy/ch-source.html#debian-rules-and-rules-requires-root

Debian Policy § 5.6.31  Rules-Requires-Root
https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-rules-requires-root

-- 
Plasma

Reply via email to