[101650] trunk/base/src/port1.0/portextract.tcl

blair at macports.org blair at macports.org
Tue Jan 15 21:08:58 PST 2013


Revision: 101650
          https://trac.macports.org/changeset/101650
Author:   blair at macports.org
Date:     2013-01-15 21:08:58 -0800 (Tue, 15 Jan 2013)
Log Message:
-----------
portextract::extract_start: for use_dmg: do not copy unreadable files and dirs.

This is for non-root MacPorts installs and to avoid copying unreadable
files into ${extract.dir} that will not be readable by the MacPorts
user.  The specific technique used here uses

$ cd $dmg_dir; find . -depth -perm -+r -print0 | cpio ...flags... -0 $destdir

- Use find | cpio to avoid fork()/exec() with very many files to copy;
  its faster.

- Use -depth to go depth first so that cpio will fix permissions on
  parent directories once its finished with all the children.

- Use -print0 and -0 to avoid problems with spaces in the filenames.

- Use -perm -+r to skip unreadable files and directories.  By avoiding
  unreadable files and directories, the error status of cpio does not
  need to be ignored, which it would if cp or rsync were used.

- Use cd $dmg_dir because cpio requires filenames to copy from the
  current working directory.

Modified Paths:
--------------
    trunk/base/src/port1.0/portextract.tcl

Modified: trunk/base/src/port1.0/portextract.tcl
===================================================================
--- trunk/base/src/port1.0/portextract.tcl	2013-01-16 04:47:51 UTC (rev 101649)
+++ trunk/base/src/port1.0/portextract.tcl	2013-01-16 05:08:58 UTC (rev 101650)
@@ -108,7 +108,7 @@
         set dmg_mount [mkdtemp "/tmp/mports.XXXXXXXX"]
         option extract.cmd [findBinary hdiutil ${portutil::autoconf::hdiutil_path}]
         option extract.pre_args attach
-        option extract.post_args "-private -readonly -nobrowse -mountpoint \\\"${dmg_mount}\\\" && [findBinary cp ${portutil::autoconf::cp_path}] -Rp \\\"${dmg_mount}\\\" \\\"${extract.dir}/${distname}\\\"; status=\$?; ${extract.cmd} detach \\\"${dmg_mount}\\\" && [findBinary rmdir ${portutil::autoconf::rmdir_path}] \\\"${dmg_mount}\\\"; exit \$status"
+        option extract.post_args "-private -readonly -nobrowse -mountpoint \\\"${dmg_mount}\\\" && cd \\\"${dmg_mount}\\\" && find . -depth -perm -+r -print0 | [findBinary cpio ${portutil::autoconf::cpio_path}] -0 -p -d -m -u \\\"${extract.dir}/${distname}\\\"; status=\$?; cd / && ${extract.cmd} detach \\\"${dmg_mount}\\\" && [findBinary rmdir ${portutil::autoconf::rmdir_path}] \\\"${dmg_mount}\\\"; exit \$status"
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130115/d977e12d/attachment.html>


More information about the macports-changes mailing list