Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#65313 closed defect (fixed)

ports that change prefix fail to install without root privileges

Reported by: lyskov (Sergey Lyskov) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone: MacPorts 2.8.0
Component: base Version:
Keywords: Cc: mascguy (Christopher Nielsen), lukaso (Lukas Oberhuber)
Port: cmake-bootstrap

Description

With MacPorts installed in user home dir (with --with-no-root-privileges flag) cmake-bootstrap@3.9.4_0 installation fails on 'installing' step. Here is the snippet from the log. Thanks,

:debug:clean Starting logging for cmake-bootstrap @3.9.4_0
:debug:sysinfo macOS 12.4 (darwin/21.5.0) arch i386
:debug:sysinfo MacPorts 2.7.2
:debug:sysinfo Xcode none
:debug:sysinfo SDK 12
:debug:sysinfo MACOSX_DEPLOYMENT_TARGET: 12.0
:debug:clean Privilege de-escalation not attempted as not running as root.
:debug:main Executing org.macports.main (cmake-bootstrap)
:debug:main Privilege de-escalation not attempted as not running as root.
:debug:archivefetch archivefetch phase started at Wed Jun  8 15:09:11 MDT 2022
:debug:archivefetch Executing org.macports.archivefetch (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.fetch (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.checksum (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.extract (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.patch (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.configure (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.build (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:archivefetch Skipping completed org.macports.destroot (cmake-bootstrap)
:debug:archivefetch Privilege de-escalation not attempted as not running as root.
:debug:install install phase started at Wed Jun  8 15:09:11 MDT 2022
:notice:install --->  Installing cmake-bootstrap @3.9.4_0
:error:install Failed to install cmake-bootstrap: MacPorts requires root privileges for this action
:debug:install Error code: NONE
:debug:install Backtrace: MacPorts requires root privileges for this action
:debug:install     while executing
:debug:install "elevateToRoot "install""
:debug:install     (procedure "portinstall::install_start" line 10)
:debug:install     invoked from within
:debug:install "[ditem_key $ditem prerun] $targetname"

Attachments (1)

main.log (3.7 MB) - added by lyskov (Sergey Lyskov) 2 years ago.

Change History (21)

comment:1 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

Port: @3.9.4_0 removed
Summary: cmake-bootstrap require root privilegescmake-bootstrap @3.9.4_0: require root privileges

Since this was not a clean build attempt it's hard to tell if that's the real problem. Please port clean cmake-bootstrap and try again, and attach the main.log file if it fails again.

Changed 2 years ago by lyskov (Sergey Lyskov)

Attachment: main.log added

comment:2 Changed 2 years ago by lyskov (Sergey Lyskov)

I have tried the clean rebuild and it fails again (looks like exactly the same failure). Please see full main.log file attached. Thanks,

comment:3 Changed 2 years ago by jmroot (Joshua Root)

Component: portsbase
Summary: cmake-bootstrap @3.9.4_0: require root privilegesports that change prefix fail to install without root privileges

comment:4 Changed 2 years ago by jmroot (Joshua Root)

Owner: set to jmroot
Resolution: fixed
Status: newclosed

In a594e01e3cfffe66c2d7219e10ebe0bb1a6da4ea/macports-base (master):

Use prefix_frozen for install writability check

Fixes: #65313

comment:5 Changed 2 years ago by jmroot (Joshua Root)

Milestone: MacPorts Future

comment:6 Changed 2 years ago by lyskov (Sergey Lyskov)

Is this fix 'live'? I just tried port selfupdate && port upgrade outdated && port clean cmake-bootstrap && port install cmake-bootstrap but i am still getting the same error. Thanks,

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

The fix will be in the next MacPorts base release. You could apply the change locally to ${prefix}/libexec/macports/lib/port1.0/portinstall.tcl in the meantime.

comment:8 Changed 2 years ago by lyskov (Sergey Lyskov)

I have tried apply path locally and do a clean rebuild: it fail again but now log a bit different, here is the tail of it:

:info:install a ./Users/abcde/prefix/macports.monterey.08.06.2022/libexec/cmake-bootstrap/bin/ccmake
:info:install a ./Users/abcde/prefix/macports.monterey.08.06.2022/libexec/cmake-bootstrap/bin/cmake
:info:install a ./Users/abcde/prefix/macports.monterey.08.06.2022/libexec/cmake-bootstrap/bin/cmakexbuild
:info:install a ./Users/abcde/prefix/macports.monterey.08.06.2022/libexec/cmake-bootstrap/bin/ctest
:info:install a ./Users/abcde/prefix/macports.monterey.08.06.2022/libexec/cmake-bootstrap/bin/cpack
:debug:install Archive cmake-bootstrap-3.9.4_0.darwin_21.x86_64.tbz2 packaged
:debug:install removing file: /Users/abcde/prefix/macports.monterey.08.06.2022/var/macports/build/_Users_abcde_prefix_macports.monterey.08.06.2022_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_cmake-bootstrap/cmake-bootstrap/work/destroot/+STATE
:debug:install removing file: /Users/abcde/prefix/macports.monterey.08.06.2022/var/macports/build/_Users_abcde_prefix_macports.monterey.08.06.2022_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_cmake-bootstrap/cmake-bootstrap/work/destroot/+PORTFILE
:debug:install removing file: /Users/abcde/prefix/macports.monterey.08.06.2022/var/macports/build/_Users_abcde_prefix_macports.monterey.08.06.2022_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_cmake-bootstrap/cmake-bootstrap/work/destroot/+CONTENTS
:debug:install removing file: /Users/abcde/prefix/macports.monterey.08.06.2022/var/macports/build/_Users_abcde_prefix_macports.monterey.08.06.2022_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_cmake-bootstrap/cmake-bootstrap/work/destroot/+DESC
:debug:install removing file: /Users/abcde/prefix/macports.monterey.08.06.2022/var/macports/build/_Users_abcde_prefix_macports.monterey.08.06.2022_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_cmake-bootstrap/cmake-bootstrap/work/destroot/+COMMENT
:debug:activate activate phase started at Thu Jun  9 12:01:52 MDT 2022
:error:activate Failed to activate cmake-bootstrap: MacPorts requires root privileges for this action
:debug:activate Error code: NONE
:debug:activate Backtrace: MacPorts requires root privileges for this action
:debug:activate     while executing
:debug:activate "elevateToRoot "activate""
:debug:activate     (procedure "portactivate::activate_start" line 5)
:debug:activate     invoked from within
:debug:activate "[ditem_key $ditem prerun] $targetname"
:error:activate See /Users/abcde/prefix/macports.monterey.08.06.2022/var/macports/logs/_Users_abcde_prefix_macports.monterey.08.06.2022_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_cmake-bootstrap/cmake-bootstrap/main.log for details.

comment:9 Changed 2 years ago by jmroot (Joshua Root)

In fbfcb9ff67ae55f477652fe6b7e7fc809782dbbf/macports-base (master):

Use prefix_frozen for activate writable check also

See: #65313

comment:10 Changed 2 years ago by lyskov (Sergey Lyskov)

Thank you Joshua! I can confirm that applying these patches locally fix the issue for me. Best,

comment:11 Changed 2 years ago by AgilentGCMS

Could someone explain to me how to apply the patch/fix being discussed? I looked in ${prefix}/libexec/macports/lib/port1.0/portinstall.tcl, but it currently looks a little different from the "before" version at https://github.com/macports/macports-base/commit/fbfcb9ff67ae55f477652fe6b7e7fc809782dbbf. Specifically, on that commit lines 51 through 53 are

default activate.asroot no

proc portactivate::activate_start {args} {

whereas in my ${prefix}/libexec/macports/lib/port1.0/portinstall.tcl that area of the code looks different. Lines 52-56 (not 51-53) have

default install.asroot no

set_ui_prefix

proc portinstall::install_start {args} {

and even the line after that is different,

    global UI_PREFIX subport version revision portvariants \
           prefix registry_open registry.path

I'm hesitant to change anything here, since it's clear that my portinstall.tcl is different from the "before" version in that commit.

comment:12 Changed 2 years ago by AgilentGCMS

I tried the two modifications at https://github.com/macports/macports-base/commit/a594e01e3cfffe66c2d7219e10ebe0bb1a6da4ea, but my install still fails cribbing about root privileges.

comment:13 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:14 Changed 2 years ago by lyskov (Sergey Lyskov)

Have you tried running port clean <port-name> after applying the patch?

comment:15 Changed 2 years ago by jmroot (Joshua Root)

You need the changes from both a594e01 and fbfcb9f, which modify two different files.

comment:16 in reply to:  15 Changed 2 years ago by mascguy (Christopher Nielsen)

Replying to jmroot:

You need the changes from both a594e01 and fbfcb9f, which modify two different files.

Josh, would it be simpler for Sergey to simply build using master, rather than cherry-picking some commits?

comment:17 Changed 2 years ago by jmroot (Joshua Root)

Simpler and far riskier.

comment:18 in reply to:  15 Changed 2 years ago by AgilentGCMS

Replying to jmroot:

You need the changes from both a594e01 and fbfcb9f, which modify two different files.

Ah, I did not realize that those were changes to two different files. After making those changes, cmake-bootstrap builds and installs fine! Thanks.

comment:19 in reply to:  15 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: lukaso added

Replying to jmroot:

You need the changes from both a594e01 and fbfcb9f, which modify two different files.

@lukaso, to fix the issues you're seeing for the GIMP build, you'll need to patch and build MacPorts base with these.

comment:20 Changed 2 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 2.8.0
Note: See TracTickets for help on using tickets.