Opened 15 years ago

Last modified 7 years ago

#21117 reopened defect

use_dmg yes fails to copy from some images sometimes

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone: MacPorts Future
Component: base Version: 1.8.0
Keywords: Cc: blair (Blair Zajac), phosphide (Jakub Tomczyński), trond.kandal@…, nonstop.server@…, mmdonley@…, cooljeanius (Eric Gallager), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port:

Description

"use_dmg yes" doesn't work if you're not root, because it wants to copy everything from the disk image, including things it might not have permission to copy, which includes things that don't need to be copied. Change it to copy only those files we have permission to.

Change History (14)

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

Has duplicate #30711. This may now be a big deal since we're running as the macports user and not as root.

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

Cc: phosphide@… trond.kandal@… added
Milestone: MacPorts Future

Has duplicate #31430.

comment:3 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: nonstop.server@… added

Has duplicate #32238.

comment:4 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: mmdonley@… added

Has duplicate #32492.

comment:5 Changed 11 years ago by blair (Blair Zajac)

Resolution: fixed
Status: newclosed

Fixed in r101504 by escalating back to root before mounting and copying the contents.

comment:6 Changed 11 years ago by jmroot (Joshua Root)

Cc: blair@… added

Is this really fixed for the originally reported case, which was running as non-root to begin with (thus making it impossible to escalate back to root)?

comment:7 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:8 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

A new fix was committed in r101650 to handle the non-root case. I haven't verified it. But if it works, then can't we remove the elevateToRoot part of r101504?

comment:9 Changed 11 years ago by cooljeanius (Eric Gallager)

I'm still occasionally running into this issue with some DMGs, such as CgToolkit.

Version 0, edited 11 years ago by cooljeanius (Eric Gallager) (next)

comment:10 Changed 11 years ago by blair (Blair Zajac)

Please provide more information on when it doesn't work, such as log output, the command you ran, etc.

comment:11 Changed 11 years ago by cooljeanius (Eric Gallager)

As root, I ran port -udcp install cg-toolkit (the output is short enough that I can paste it all here):

gl00b05047:~ root# port -udcp install cg-toolkit
DEBUG: Copying /var/root/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
DEBUG: Changing to port directory: /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/cg-toolkit
DEBUG: OS darwin/11.4.2 (Mac OS X 10.7) arch i386
DEBUG: org.macports.load registered provides 'load', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.unload registered provides 'unload', a pre-existing procedure. Target override will not be provided
DEBUG: org.macports.distfiles registered provides 'distfiles', a pre-existing procedure. Target override will not be provided
DEBUG: universal_variant is false, so not adding the default universal variant
DEBUG: Requested variant +universal is not provided by port cg-toolkit.
DEBUG: Requested variant +quartz is not provided by port cg-toolkit.
DEBUG: Attempting ln -sf /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/cg-toolkit/work
DEBUG: changing euid/egid - current euid: 0 - current egid: 0
DEBUG: egid changed to: 501
DEBUG: euid changed to: 503
DEBUG: Starting logging for cg-toolkit
DEBUG: cg-toolkit has no conflicts
DEBUG: Executing org.macports.main (cg-toolkit)
DEBUG: changing euid/egid - current euid: 0 - current egid: 0
DEBUG: egid changed to: 501
DEBUG: euid changed to: 503
DEBUG: archivefetch phase started at Wed Mar 13 11:57:09 EDT 2013
--->  Fetching archive for cg-toolkit
DEBUG: Executing org.macports.archivefetch (cg-toolkit)
DEBUG: euid/egid changed to: 0/0
DEBUG: chowned /opt/local/var/macports/incoming to macports
DEBUG: euid/egid changed to: 503/501
--->  cg-toolkit-3.1.2012.04_1.darwin_11.x86_64.tbz2 doesn't seem to exist in /opt/local/var/macports/incoming/verified
--->  Attempting to fetch cg-toolkit-3.1.2012.04_1.darwin_11.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/cg-toolkit
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
DEBUG: Fetching archive failed:: The requested URL returned error: 404
--->  Attempting to fetch cg-toolkit-3.1.2012.04_1.darwin_11.x86_64.tbz2 from http://lil.fr.packages.macports.org/cg-toolkit
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
DEBUG: Fetching archive failed:: The requested URL returned error: 404
--->  Attempting to fetch cg-toolkit-3.1.2012.04_1.darwin_11.x86_64.tbz2 from http://packages.macports.org/cg-toolkit
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
DEBUG: Fetching archive failed:: The requested URL returned error: 404
DEBUG: Privilege de-escalation not attempted as not running as root.
DEBUG: fetch phase started at Wed Mar 13 11:57:10 EDT 2013
--->  Fetching distfiles for cg-toolkit
DEBUG: Can't run fetch on this port without elevated privileges. Escalating privileges back to root.
DEBUG: euid changed to: 0. egid changed to: 0.
DEBUG: changing euid/egid - current euid: 0 - current egid: 0
DEBUG: egid changed to: 501
DEBUG: euid changed to: 503
DEBUG: Executing org.macports.fetch (cg-toolkit)
--->  Cg-3.1_April2012.dmg doesn't seem to exist in /opt/local/var/macports/distfiles/cg-toolkit
--->  Attempting to fetch Cg-3.1_April2012.dmg from http://developer.download.nvidia.com/cg/Cg_3.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 37.4M  100 37.4M    0     0  4926k      0  0:00:07  0:00:07 --:--:-- 4905k
DEBUG: Privilege de-escalation not attempted as not running as root.
DEBUG: checksum phase started at Wed Mar 13 11:57:18 EDT 2013
--->  Verifying checksum(s) for cg-toolkit
DEBUG: Executing org.macports.checksum (cg-toolkit)
--->  Checksumming Cg-3.1_April2012.dmg
DEBUG: Correct (md5) checksum for Cg-3.1_April2012.dmg
DEBUG: Correct (sha1) checksum for Cg-3.1_April2012.dmg
DEBUG: Correct (sha256) checksum for Cg-3.1_April2012.dmg
DEBUG: Privilege de-escalation not attempted as not running as root.
DEBUG: extract phase started at Wed Mar 13 11:57:18 EDT 2013
--->  Extracting cg-toolkit
DEBUG: setting option extract.cmd to /usr/bin/hdiutil
DEBUG: setting option extract.pre_args to attach
DEBUG: setting option extract.post_args to {-private -readonly -nobrowse -mountpoint \"/tmp/mports.Ipncj47O\" && /bin/cp -Rp \"/tmp/mports.Ipncj47O\" \"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work/Cg-3.1_April2012\" && /usr/bin/hdiutil detach \"/tmp/mports.Ipncj47O\" && /bin/rmdir \"/tmp/mports.Ipncj47O\"}
DEBUG: Executing org.macports.extract (cg-toolkit)
--->  Extracting Cg-3.1_April2012.dmg
DEBUG: setting option extract.args to '/opt/local/var/macports/distfiles/cg-toolkit/Cg-3.1_April2012.dmg'
DEBUG: Environment: CPATH='/opt/local/include' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work/.CC_PRINT_OPTIONS' LIBRARY_PATH='/opt/local/lib' CC_PRINT_OPTIONS='YES' MACOSX_DEPLOYMENT_TARGET='10.7'
DEBUG: Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work" && /usr/bin/hdiutil attach '/opt/local/var/macports/distfiles/cg-toolkit/Cg-3.1_April2012.dmg' -private -readonly -nobrowse -mountpoint "/tmp/mports.Ipncj47O" && /bin/cp -Rp "/tmp/mports.Ipncj47O" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work/Cg-3.1_April2012" && /usr/bin/hdiutil detach "/tmp/mports.Ipncj47O" && /bin/rmdir "/tmp/mports.Ipncj47O"'
DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work" && /usr/bin/hdiutil attach '/opt/local/var/macports/distfiles/cg-toolkit/Cg-3.1_April2012.dmg' -private -readonly -nobrowse -mountpoint "/tmp/mports.Ipncj47O" && /bin/cp -Rp "/tmp/mports.Ipncj47O" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work/Cg-3.1_April2012" && /usr/bin/hdiutil detach "/tmp/mports.Ipncj47O" && /bin/rmdir "/tmp/mports.Ipncj47O" 
Checksumming Driver Descriptor Map (DDM : 0)…
     Driver Descriptor Map (DDM : 0): verified   CRC32 $26FC92CD
Checksumming Apple (Apple_partition_map : 1)…
     Apple (Apple_partition_map : 1): verified   CRC32 $36C7C479
Checksumming disk image (Apple_HFSX : 2)…
         disk image (Apple_HFSX : 2): verified   CRC32 $1A383EC1
Checksumming  (Apple_Free : 3)…
                    (Apple_Free : 3): verified   CRC32 $00000000
verified   CRC32 $397F09FC
/dev/disk2          	Apple_partition_scheme         	
/dev/disk2s1        	Apple_partition_map            	
/dev/disk2s2        	Apple_HFSX                     	/private/tmp/mports.Ipncj47O
cp: /tmp/mports.Ipncj47O/.Trashes: unable to copy extended attributes to /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work/Cg-3.1_April2012/.Trashes: Permission denied
cp: /tmp/mports.Ipncj47O/.Trashes: Permission denied
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work" && /usr/bin/hdiutil attach '/opt/local/var/macports/distfiles/cg-toolkit/Cg-3.1_April2012.dmg' -private -readonly -nobrowse -mountpoint "/tmp/mports.Ipncj47O" && /bin/cp -Rp "/tmp/mports.Ipncj47O" "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/work/Cg-3.1_April2012" && /usr/bin/hdiutil detach "/tmp/mports.Ipncj47O" && /bin/rmdir "/tmp/mports.Ipncj47O" 
Exit code: 1
Error: org.macports.extract for port cg-toolkit returned: command execution failed
DEBUG: Error code: NONE
DEBUG: Backtrace: command execution failed
    while executing
"$procedure $targetname"
Warning: targets not executed for cg-toolkit: org.macports.activate org.macports.extract org.macports.patch org.macports.configure org.macports.build org.macports.destroot org.macports.install
Please see the log file for port cg-toolkit for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_cg-toolkit/cg-toolkit/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port cg-toolkit failed

Apparently it's some issue with the extended attributes?

comment:12 Changed 11 years ago by cooljeanius (Eric Gallager)

Resolution: fixed
Status: closedreopened

comment:13 Changed 7 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Cc: MarcusCalhoun-Lopez added

comment:14 Changed 7 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

I ran port extract on all of the Portfiles that I could find with use_dmg yes (isightcapture fscript-cli cg-toolkit osxfuse libftd2xx activewire mkconsole BiggerSQL gimp2-launcher gimp2-launcher).
All of them succeeded on both a 10.12 machine and a 10.6 virtual machine.

I removed the root escalation, and all of them still succeeded.
I should note, however, that the exit status of find was sometimes 1 with error find: ./.Trashes: Permission denied.
The extract continued, however, because of the pipe | (the exit status of false | true is 0).

I have a slight preference for removing the root escalation simply because it is more consistent with my setup.
If we decide to keep it, however, I believe this ticket can be close.

Note: See TracTickets for help on using tickets.