• Status Closed
  • Percent Complete
  • Task Type Improvement
  • Category ports
  • Assigned To No-one
  • Operating System CRUX
  • Severity Low
  • Priority Very Low
  • Reported Version 3.6
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: CRUX
Opened by steffen - 27.02.2021
Last edited by tb - 31.08.2022

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

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

Closed by  tb
31.08.2022 18:57
Reason for closing:  Won't implement

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.

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

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.

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.


Available keyboard shortcuts


Task Details

Task Editing