CRUX

Welcome to CRUX bug tracking.
Tasklist

FS#1852 - ports(8):update_ports(): do not check for id -u = 0

Attached to Project: CRUX
Opened by Steffen Nurpmeso (steffen) - Saturday, 27 February 2021, 18:03 GMT
Last edited by Tim Biermann (tb) - Wednesday, 31 August 2022, 18:57 GMT
Task Type Improvement
Category ports
Status Closed
Assigned To No-one
Operating System CRUX
Severity Low
Priority Normal
Reported Version 3.6
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

On my box this was always false, and i used fakeroot to cross that test.
Now i switched to an unshare(1) containment, and it would be much nicer if the test would just vanish. For now commented out, but truly meaningless and complicating that box stuff (here).

# if [ "`id -u`" != "0" ]; then
# echo "$COMMAND: only root can update ports"
# exit 1
# fi
This task depends upon

Closed by  Tim Biermann (tb)
Wednesday, 31 August 2022, 18:57 GMT
Reason for closing:  Won't implement
Comment by John McQuah (farkuhar) - Wednesday, 31 August 2022, 13:44 GMT
One of the attractions of CRUX is that it ships with sensible defaults, but it's flexible enough that a knowledgeable user like stenur can set up a container for the ports tree and still reap the benefits of the ports collections. Anyone knowledgeable enough to set up their ports tree in this manner is also capable of placing a custom copy of /usr/bin/ports in a directory that appears (to the invoking user) earlier in $PATH. Everyone else will run the version of ports(8) that performs the simplest test of whether the ports tree is writable. Replacing the test `id -u` = 0 with another test involving filesystem permissions is likely to generate false positives on some systems, or even to encounter "time of check versus time of use" problems. But removing the test entirely is not a sensible default (considering the owner/group/permissions of /usr/ports on a typical installation), and should be left to the discretion of the knowledgeable user.
Comment by Steffen Nurpmeso (steffen) - Wednesday, 31 August 2022, 15:03 GMT
i mean not too much trouble. other parts of pkg etc do not check for a 0 $UID, they just fail to work properly a hundred percent.
Please just remove that test
Comment by John McQuah (farkuhar) - Wednesday, 31 August 2022, 15:44 GMT
The only context in which ports(8) performs the UID check is when running 'ports -u'. Running 'ports -d' or 'ports -l' as a regular user is expected and works just fine. It's misleading to make a comparison with the other programs in pkgutils and prt-utils, since they don't require write permission on the whole ports tree. If you want the test removed, nobody is stopping you from putting a custom version of the ports script somewhere else in $PATH (or editing it in-place as you've already done). Removing the test for everybody might cause too much confusion. A regular user lacking write permission on /usr/ports would see their scrollback buffer fill up with error messages, rather than the brief and informative error message they get with the current design.
Comment by Steffen Nurpmeso (steffen) - Wednesday, 31 August 2022, 15:50 GMT
It is misleading to let that in. I can configure the file permissions anyway i want, and in fact i do. Why should the script care. That is apple and oranges. But i do not want to fill up error messages any more. Thank you.

Loading...