Opened 7 months ago

Last modified 7 months ago

#69650 assigned defect

netpbm fails to destroot Port when not using MacPorts as root

Reported by: tux-o-matic (Benjamin Merot) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: Dave-Allured (Dave Allured)
Port: netpbm

Description (last modified by ryandesign (Ryan Carsten Schmidt))

On a system where ports are installed by and for a local user account, the netpbm Port fails to install:

[...]
:info:destroot chown: /Users/XXX/macports/var/macports/build/_Users_ XXX_macports_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_netpbm/libnetpbm/work/destroot: Operation not permitted
:info:destroot Command failed: chown -R 'root':'admin' /Users/XXX/macports/var/macports/build/_Users_ XXX_macports_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_netpbm/libnetpbm/work/destroot

Seems to come from this source:macports-ports/graphics/netpbm/Portfile#L184 chown command in the Portfile.

As explained in #69601, netpbm has somehow become a dependency for some popular CLI tools which normally shouldn't even need netpbm.

Change History (12)

comment:1 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: set to ryandesign
Status: newassigned

comment:2 Changed 7 months ago by jmroot (Joshua Root)

Why are the install user and group root:admin if this is a non-root installation?

comment:3 Changed 7 months ago by tux-o-matic (Benjamin Merot)

It's a mystery to me since MacPorts correctly runs in the local user folder and otherwise installs all other ports without a problem. Could there somehow be separate configuration files or sections?

comment:4 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

I would have to set up a non-root MacPorts installation to test this.

Do you recall the configure command you used to install MacPorts?

comment:5 in reply to:  3 Changed 7 months ago by jmroot (Joshua Root)

Replying to tux-o-matic:

It's a mystery to me since MacPorts correctly runs in the local user folder and otherwise installs all other ports without a problem. Could there somehow be separate configuration files or sections?

Those values are read from /opt/local/libexec/macports/lib/port1.0/port_autoconf.tcl and should be set to the current user when you configure with --with-no-root-privileges.

comment:6 Changed 7 months ago by tux-o-matic (Benjamin Merot)

So /opt/local/libexec/macports/lib/port1.0/port_autoconf.tcl has

        variable install_user "root"
        variable install_group "admin"

But there is another port_autoconf.tcl in the local user install on MacPorts which correctly lists the local user for "install_user".

comment:7 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

In a clone of macports-base I ran:

prefix=/Volumes/Shared/testmp
PATH=/usr/bin:/bin:/usr/sbin:/sbin ./configure --prefix=$prefix --with-applications-dir=$prefix/Applications --with-frameworks-dir=$prefix/Library/Frameworks --with-no-root-privileges --without-startupitems
make -j$(sysctl -n hw.activecpu)
make install
$prefix/bin/port sync
$prefix/bin/port destroot libnetpbm

Result: successful build. The command it ran:

DEBUG: system: chown -R 'rschmidt':'staff' /Volumes/Shared/testmp/var/macports/build/_Volumes_Shared_testmp_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_graphics_netpbm/libnetpbm/work/destroot

In $prefix/libexec/macports/lib/port1.0/port_autoconf.tcl I have:

	variable install_user "rschmidt"
	variable install_group "staff"

Which is a long way of saying I cannot reproduce this issue.

comment:8 Changed 7 months ago by tux-o-matic (Benjamin Merot)

So any idea why the ${install.user} in the Portfil for my system is root and not what is defined in my $prefix/libexec/macports/lib/port1.0/port_autoconf.tcl?

comment:9 Changed 7 months ago by jmroot (Joshua Root)

The only ways I can think of are if your portmain.tcl has been modified or if the variables are being overridden on the command line or in a conf file.

comment:10 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Which conf files would allow such a setting? I tried setting install_user or install.user in macports.conf and it was not honored.

comment:11 Changed 7 months ago by tux-o-matic (Benjamin Merot)

Just have the default values in $prefix/libexec/macports/lib/port1.0/portmain.tcl

default install.user {${portutil::autoconf::install_user}}
default install.group {${portutil::autoconf::install_group}}

A search shows the same:

grep -r "install_user" $prefix/libexec/macports/lib/port1.0/ 
../macports/libexec/macports/lib/port1.0/port_autoconf.tcl:	variable install_user "XXX"
../macports/libexec/macports/lib/port1.0/portmain.tcl:default install.user {${portutil::autoconf::install_user}}

comment:12 Changed 7 months ago by Dave-Allured (Dave Allured)

Cc: Dave-Allured added
Note: See TracTickets for help on using tickets.