[MacPorts] #71564: libnetpbm @11.08.02: chown: Operation not permitted

MacPorts noreply at macports.org
Fri Dec 20 17:34:36 UTC 2024


#71564: libnetpbm @11.08.02: chown: Operation not permitted
--------------------------+------------------------
  Reporter:  AgilentGCMS  |      Owner:  ryandesign
      Type:  defect       |     Status:  assigned
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:  2.10.5
Resolution:               |   Keywords:
      Port:  libnetpbm    |
--------------------------+------------------------

Comment (by ryandesign):

 Replying to [comment:14 AgilentGCMS]:
 > Maybe changing these values during `port selfupdate` is not a good idea,
 i.e., if the user set up the port install tree a certain way, `port
 selfupdate` should respect that?

 I certainly agree! selfupdate does run the usual `./configure`, `make`,
 `make install` dance, but ideally it should preserve as many configuration
 settings as possible. I know that it doesn't preserve many (and I thought
 I filed a ticket about that years ago but I can't find it) but it does at
 least intend to preserve the user and group. Here's the code that does
 this:

 https://github.com/macports/macports-
 base/blob/74660c81825a78caa4b4e2b0b801b8bbcb4a67f2/src/macports1.0/selfupdate.tcl#L427-L428

 It gets the user and group from the prefix directory, in your case
 /Users/sbasu1/packages/macports/sonoma. Presumably when you last ran
 selfupdate, that directory was owned by the admin group.

 > From time to time, on our work laptops, we are given elevated privileges
 to perform certain tasks such as security updates. I was considering
 whether I might have run `port selfupdate` during one of those periods of
 elevated privilege. However, I was **just** given such an elevated
 privilege session, so I opened a terminal to check, and `id -gn` still
 says `staff`. So that can't be the reason, and confirms my suspicion that
 I was never part of the `admin` group.

 On my system, my user is an admin user and is in the `admin` group, but
 still uses `staff` as the primary group so `id -gn` still says `staff`.
 But it appears this is only used when you first configure. On subsequent
 selfupdates, it's taken from the ownership of the prefix directory.

 Replying to [comment:7 AgilentGCMS]:
 > And now I've changed the ownership of __all__ files and folder in
 `/Users/sbasu1/packages/macports/sonoma` to `sbasu1:staff`, but
 `libnetpbm` still wants to chown to `sbasu1:admin`, and I don't know why.

 Replying to [comment:15 AgilentGCMS]:
 > Is it a good idea to change the `install_group` in that to `staff` to
 resolve this for now? I'm hesitating because I see that
 `libexec/macports/lib/port1.0/port_autoconf.tcl` is by default "read-
 only", i.e., it has permissions 444, and there must be a good reason for
 it.

 I think that should be fine. You can `chmod` it to 644, change it, and
 `chmod` it back. Provided you've changed the group of
 /Users/sbasu1/packages/macports/sonoma back to `staff` it should survive
 future selfupdates.

-- 
Ticket URL: <https://trac.macports.org/ticket/71564#comment:17>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list