Opened 15 years ago
Closed 15 years ago
#20330 closed defect (fixed)
Ports that require root access to build don't work if macportsuser is not root
Reported by: | mtalexander (Mike Alexander) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | MacPorts 1.8.0 |
Component: | base | Version: | 1.8.0 |
Keywords: | asroot | Cc: | ryandesign (Ryan Carsten Schmidt), jmroot (Joshua Root) |
Port: |
Description
The {target}.asroot option in portfiles doesn't seem to work. This is because the code to test it in target_run in portutil.tcl is testing the wrong variable. The result is that ports which require root access to install don't work right if macports is built with the with-install-user, with-install-group, and with-macports-user options (or with with-no-root-privileges which amounts to the same thing).
Also reinplace sometimes needs root access to set the attributes on the new copy of the file it just changed. This means that some ports (for example dbus) need "patch.asroot yes" just to do a reinplace in the post patch code.
I've attached a patch that fixes both of these problems. With this change dbus builds properly in a non-privileged macports running under sudo if you add "install.asroot yes" and "destroot.asroot yes" to its Portfile. Most of the build runs as macportsuser and only the installation parts run as root.
There is also a kluge around line 100 in portdestroot.tcl which is probably not needed with these changes. It escalates privileges to root if macports started as root, but isn't root now. After the fix to make destroot.asroot work this shouldn't be needed anymore. I verified that it isn't being executed, but didn't remove it.
Attachments (1)
Change History (5)
Changed 15 years ago by mtalexander (Mike Alexander)
Attachment: | portutil.tcl.patch added |
---|
comment:1 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign@… added |
---|---|
Milestone: | → MacPorts 1.8.0 |
comment:2 follow-up: 3 Changed 15 years ago by mtalexander (Mike Alexander)
Yes one part of the attached patch should fix #18489. The other part that fixes "target.asroot" is a separate bug. They probably should be separate tickets and patches, but I got lazy. I didn't find #18489 before I submitted this or I would have attached the one patch there. Do you want me to split the patch in half?
comment:3 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to mta@…:
Do you want me to split the patch in half?
I think it's fine as is. I just wanted to make sure the two tickets were now linked.
comment:4 Changed 15 years ago by jmroot (Joshua Root)
Cc: | jmr@… added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Thanks, applied in r54367.
jmr says this is the same problem as #18489 (which was marked as a duplicate of this ticket).