<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[934] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/darwinbuild/changeset/934">934</a></dd>
<dt>Author</dt> <dd>wsiegrist@apple.com</dd>
<dt>Date</dt> <dd>2011-02-10 07:22:14 -0800 (Thu, 10 Feb 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge PR-8817822</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdarwinbuildxcodeprojprojectpbxproj">trunk/darwinbuild.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkdarwintracedarwintracec">trunk/darwintrace/darwintrace.c</a></li>
<li><a href="#trunkdarwinupDepotcpp">trunk/darwinup/Depot.cpp</a></li>
<li><a href="#trunkdarwinupDigestcpp">trunk/darwinup/Digest.cpp</a></li>
<li><a href="#trunkdarwinupDigesth">trunk/darwinup/Digest.h</a></li>
<li><a href="#trunkdarwinupFilecpp">trunk/darwinup/File.cpp</a></li>
<li><a href="#trunkdarwinupFileh">trunk/darwinup/File.h</a></li>
<li><a href="#trunkdarwinupmaincpp">trunk/darwinup/main.cpp</a></li>
<li><a href="#trunktestingdarwinupruntestssh">trunk/testing/darwinup/run-tests.sh</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/testing/darwintrace/</li>
<li><a href="#trunktestingdarwintraceclosetest">trunk/testing/darwintrace/close-test</a></li>
<li><a href="#trunktestingdarwintraceexec">trunk/testing/darwintrace/exec</a></li>
<li><a href="#trunktestingdarwintracerealpath">trunk/testing/darwintrace/realpath</a></li>
<li><a href="#trunktestingdarwintraceredirectiontest">trunk/testing/darwintrace/redirection-test</a></li>
<li><a href="#trunktestingdarwintraceruntestssh">trunk/testing/darwintrace/run-tests.sh</a></li>
<li><a href="#trunktestingrunalltestssh">trunk/testing/run-all-tests.sh</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkMakefile">trunk/Makefile</a></li>
<li><a href="#trunkdarwintraceMakefile">trunk/darwintrace/Makefile</a></li>
<li><a href="#trunkdarwinupredo_prebindingh">trunk/darwinup/redo_prebinding.h</a></li>
<li><a href="#trunktestingdarwintraceclosetest">trunk/testing/darwintrace/close-test</a></li>
<li><a href="#trunktestingdarwintraceexec">trunk/testing/darwintrace/exec</a></li>
<li><a href="#trunktestingdarwintracerealpath">trunk/testing/darwintrace/realpath</a></li>
<li><a href="#trunktestingdarwintraceredirectiontest">trunk/testing/darwintrace/redirection-test</a></li>
<li><a href="#trunktestingdarwintraceruntestssh">trunk/testing/darwintrace/run-tests.sh</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#trunk">trunk/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunk"></a>
<div class="propset"><h4>Property changes: trunk</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4>Modified: svn:mergeinfo</h4></div>
<span class="cx">/branches/PR-6358021:442-443
</span><span class="cx">/branches/PR-6392966:423-427
</span><span class="cx">/branches/PR-6398060:433-434
</span><span class="cx">/branches/PR-6493844:460-461
</span><span class="cx">/branches/PR-6497694:466-468,471
</span><span class="cx">/branches/PR-6634286:632-650
</span><span class="cx">/branches/PR-6688645:479-490
</span><span class="cx">/branches/PR-6722857:495-499
</span><span class="cx">/branches/PR-6729491:655-664
</span><span class="cx">/branches/PR-6973110:804-813
</span><span class="cx">/branches/PR-7250612:635-650
</span><span class="cx">/branches/PR-7341154:682-694
</span><span class="cx">/branches/PR-7431723:660-664
</span><span class="cx">/branches/PR-7461534:650-664
</span><span class="cx">/branches/PR-7482850:670-671
</span><span class="cx">/branches/PR-7489777:676-731
</span><span class="cx">/branches/PR-7529688:692-694
</span><span class="cx">/branches/PR-7593824:739-772
</span><span class="cx">/branches/PR-7598640:703-731
</span><span class="cx">/branches/PR-7748469:777-785
</span><span class="cx">/branches/PR-7765119:790-791
</span><span class="cx">/branches/PR-7798586:796-799
</span><span class="cx">/branches/PR-7872907:830-840
</span><span class="cx">/branches/PR-7935095:819-821
</span><span class="cx">/branches/PR-8116613:849
</span><span class="cx">/branches/PR-8279204:854-862
</span><span class="cx">/branches/PR-8416637:870-880
</span><span class="cx">/branches/PR-8486662:885-889
</span><span class="cx">/branches/PR-8488185:894-898
</span><span class="cx">/branches/PR-8604911:903-905
</span><span class="cx">/branches/PR-8908468:912
</span><span class="cx">   + /branches/PR-4841388:399-419
</span><span class="cx">/branches/PR-6358021:442-443
</span><span class="cx">/branches/PR-6392966:423-427
</span><span class="cx">/branches/PR-6398060:433-434
</span><span class="cx">/branches/PR-6493844:460-461
</span><span class="cx">/branches/PR-6497694:466-468,471
</span><span class="cx">/branches/PR-6634286:632-650
</span><span class="cx">/branches/PR-6688645:479-490
</span><span class="cx">/branches/PR-6722857:495-499
</span><span class="cx">/branches/PR-6729491:655-664
</span><span class="cx">/branches/PR-6973110:804-813
</span><span class="cx">/branches/PR-7250612:635-650
</span><span class="cx">/branches/PR-7341154:682-694
</span><span class="cx">/branches/PR-7431723:660-664
</span><span class="cx">/branches/PR-7461534:650-664
</span><span class="cx">/branches/PR-7482850:670-671
</span><span class="cx">/branches/PR-7489777:676-731
</span><span class="cx">/branches/PR-7529688:692-694
</span><span class="cx">/branches/PR-7593824:739-772
</span><span class="cx">/branches/PR-7598640:703-731
</span><span class="cx">/branches/PR-7748469:777-785
</span><span class="cx">/branches/PR-7765119:790-791
</span><span class="cx">/branches/PR-7798586:796-799
</span><span class="cx">/branches/PR-7872907:830-840
</span><span class="cx">/branches/PR-7935095:819-821
</span><span class="cx">/branches/PR-8116613:849
</span><span class="cx">/branches/PR-8279204:854-862
</span><span class="cx">/branches/PR-8416637:870-880
</span><span class="cx">/branches/PR-8486662:885-889
</span><span class="cx">/branches/PR-8488185:894-898
</span><span class="cx">/branches/PR-8604911:903-905
</span><span class="cx">/branches/PR-8817822:917-933
</span><span class="cx">/branches/PR-8908468:912
</span><a id="trunkMakefile"></a>
<div class="delfile"><h4>Deleted: trunk/Makefile (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Makefile   2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/Makefile      2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-Project        = darwinbuild
-SubProjects = darwinbuild \
-       darwintrace \
-       darwinup \
-       darwinxref 
-
-Install_Flags = DESTDIR=$(DSTROOT)
-
-SUBDIRS= \
-       darwinbuild \
-       darwinxref \
-       darwinup \
-       darwintrace
-
-.PHONY: all clean install uninstall
-
-all clean install uninstall:
-       @$(foreach DIR,$(SUBDIRS), \
-               (echo "*** Making $@ in $(DIR) ***" ; \
-               make -C $(DIR) $@) || exit 1; )
-
-installsrc:
-       tar czf - . | tar xzf - -C "$(SRCROOT)" --exclude=.svn --exclude=sqlite --exclude=www --exclude=darwinup/libredo.o --exclude=patches --exclude=plists --exclude=testing
-
-installhdrs:
-       @echo Nothing to be done for $@
</del></span></pre></div>
<a id="trunkdarwinbuildxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/darwinbuild.xcodeproj/project.pbxproj (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinbuild.xcodeproj/project.pbxproj      2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinbuild.xcodeproj/project.pbxproj 2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -37,17 +37,6 @@
</span><span class="cx">                  name = darwinbuild_scripts;
</span><span class="cx">                  productName = darwinbuild_scripts;
</span><span class="cx">          };
</span><del>-               7227AC7E1098EF6400BE33D7 /* libredo_prebinding.a */ = {
-                       isa = PBXAggregateTarget;
-                       buildConfigurationList = 7227AC841098EF8000BE33D7 /* Build configuration list for PBXAggregateTarget "libredo_prebinding.a" */;
-                       buildPhases = (
-                               7227AC7D1098EF6400BE33D7 /* ShellScript */,
-                       );
-                       dependencies = (
-                       );
-                       name = libredo_prebinding.a;
-                       productName = libredo_prebinding.a;
-               };
</del><span class="cx">           725740981097B051008AD4D7 /* darwinxref_plugins */ = {
</span><span class="cx">                  isa = PBXAggregateTarget;
</span><span class="cx">                  buildConfigurationList = 725740A01097B08A008AD4D7 /* Build configuration list for PBXAggregateTarget "darwinxref_plugins" */;
</span><span class="lines">@@ -112,7 +101,6 @@
</span><span class="cx">          7227AB67109899A600BE33D7 /* cfutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BE910965E7500C66E90 /* cfutils.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">          7227AB68109899A600BE33D7 /* DBPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BED10965E7500C66E90 /* DBPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">          7227AB7510989F8D00BE33D7 /* manifest.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C2E1096600B00C66E90 /* manifest.c */; };
</span><del>-               7227ACA01098FCAA00BE33D7 /* libredo_prebinding.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */; };
</del><span class="cx">           7227AD1C109A05FA00BE33D7 /* buildlist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB871098A7BF00BE33D7 /* buildlist */; };
</span><span class="cx">          7227AD1D109A05FA00BE33D7 /* buildorder in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB881098A7BF00BE33D7 /* buildorder */; };
</span><span class="cx">          7227AD1E109A05FA00BE33D7 /* ditto in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB891098A7BF00BE33D7 /* ditto */; };
</span><span class="lines">@@ -607,13 +595,6 @@
</span><span class="cx">                  remoteGlobalIDString = 72D05CAD11D267C400B33EDD;
</span><span class="cx">                  remoteInfo = query;
</span><span class="cx">          };
</span><del>-               DFCB82D9109A2F9A00D2DB2F /* PBXContainerItemProxy */ = {
-                       isa = PBXContainerItemProxy;
-                       containerPortal = 726DD14910965C5700D5AEAB /* Project object */;
-                       proxyType = 1;
-                       remoteGlobalIDString = 7227AC7E1098EF6400BE33D7;
-                       remoteInfo = libredo_prebinding.a;
-               };
</del><span class="cx"> /* End PBXContainerItemProxy section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin PBXCopyFilesBuildPhase section */
</span><span class="lines">@@ -721,7 +702,6 @@
</span><span class="cx">          72C86BE010965E4F00C66E90 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = File.cpp; path = darwinup/File.cpp; sourceTree = "<group>"; };
</span><span class="cx">          72C86BE110965E4F00C66E90 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = File.h; path = darwinup/File.h; sourceTree = "<group>"; };
</span><span class="cx">          72C86BE210965E4F00C66E90 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = darwinup/main.cpp; sourceTree = "<group>"; };
</span><del>-               72C86BE310965E4F00C66E90 /* redo_prebinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = redo_prebinding.h; path = darwinup/redo_prebinding.h; sourceTree = "<group>"; };
</del><span class="cx">           72C86BE410965E4F00C66E90 /* SerialSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SerialSet.cpp; path = darwinup/SerialSet.cpp; sourceTree = "<group>"; };
</span><span class="cx">          72C86BE510965E4F00C66E90 /* SerialSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SerialSet.h; path = darwinup/SerialSet.h; sourceTree = "<group>"; };
</span><span class="cx">          72C86BE610965E4F00C66E90 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Utils.cpp; path = darwinup/Utils.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -779,7 +759,6 @@
</span><span class="cx">          72C86C381096607900C66E90 /* darwinbuild */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = darwinbuild; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">          72C86C481096609500C66E90 /* darwinup */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = darwinup; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">          72C86C52109660CA00C66E90 /* darwintrace.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = darwintrace.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
</span><del>-               72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libredo_prebinding.a; path = /usr/local/lib/libredo_prebinding.a; sourceTree = "<absolute>"; };
</del><span class="cx">           72C86CE310974CC800C66E90 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = /usr/lib/libsqlite3.dylib; sourceTree = "<absolute>"; };
</span><span class="cx">          72D05CA911D2678F00B33EDD /* query.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = query.c; sourceTree = "<group>"; };
</span><span class="cx">          72D05CB711D267C400B33EDD /* query.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = query.so; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -985,7 +964,6 @@
</span><span class="cx">                  buildActionMask = 2147483647;
</span><span class="cx">                  files = (
</span><span class="cx">                          72C86CE410974CC800C66E90 /* libsqlite3.dylib in Frameworks */,
</span><del>-                               7227ACA01098FCAA00BE33D7 /* libredo_prebinding.a in Frameworks */,
</del><span class="cx">                   );
</span><span class="cx">                  runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">          };
</span><span class="lines">@@ -1014,7 +992,6 @@
</span><span class="cx">                          72C86BD610965DD000C66E90 /* darwinxref */,
</span><span class="cx">                          72C86BD510965DC900C66E90 /* darwinbuild */,
</span><span class="cx">                          72C86C391096607900C66E90 /* Products */,
</span><del>-                               72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */,
</del><span class="cx">                           72C86CE310974CC800C66E90 /* libsqlite3.dylib */,
</span><span class="cx">                          72574A0F10977F7A00B13BC3 /* CoreFoundation.framework */,
</span><span class="cx">                          72574A1410977FAD00B13BC3 /* libtcl.dylib */,
</span><span class="lines">@@ -1085,7 +1062,6 @@
</span><span class="cx">                          72C86BE010965E4F00C66E90 /* File.cpp */,
</span><span class="cx">                          72C86BE110965E4F00C66E90 /* File.h */,
</span><span class="cx">                          72C86BE210965E4F00C66E90 /* main.cpp */,
</span><del>-                               72C86BE310965E4F00C66E90 /* redo_prebinding.h */,
</del><span class="cx">                           72C86BE410965E4F00C66E90 /* SerialSet.cpp */,
</span><span class="cx">                          72C86BE510965E4F00C66E90 /* SerialSet.h */,
</span><span class="cx">                          72C86BE610965E4F00C66E90 /* Utils.cpp */,
</span><span class="lines">@@ -1755,7 +1731,6 @@
</span><span class="cx">                  buildRules = (
</span><span class="cx">                  );
</span><span class="cx">                  dependencies = (
</span><del>-                               DFCB82DA109A2F9A00D2DB2F /* PBXTargetDependency */,
</del><span class="cx">                   );
</span><span class="cx">                  name = darwinup;
</span><span class="cx">                  productName = darwinup;
</span><span class="lines">@@ -1858,7 +1833,6 @@
</span><span class="cx">                          7227AC151098D8DB00BE33D7 /* thinPackages */,
</span><span class="cx">                          7227AC1E1098DB9200BE33D7 /* installXcode */,
</span><span class="cx">                          7227AC271098DBDF00BE33D7 /* installXcode32 */,
</span><del>-                               7227AC7E1098EF6400BE33D7 /* libredo_prebinding.a */,
</del><span class="cx">                           720BE2EA120C90A700B3C4A5 /* digest */,
</span><span class="cx">                  );
</span><span class="cx">          };
</span><span class="lines">@@ -2045,19 +2019,6 @@
</span><span class="cx">                  shellPath = /bin/sh;
</span><span class="cx">                  shellScript = "/bin/cp $DERIVED_FILE_DIR/installXcode32 $BUILT_PRODUCTS_DIR/installXcode32";
</span><span class="cx">          };
</span><del>-               7227AC7D1098EF6400BE33D7 /* ShellScript */ = {
-                       isa = PBXShellScriptBuildPhase;
-                       buildActionMask = 2147483647;
-                       files = (
-                       );
-                       inputPaths = (
-                       );
-                       outputPaths = (
-                       );
-                       runOnlyForDeploymentPostprocessing = 0;
-                       shellPath = /bin/sh;
-                       shellScript = "set -x\nBUILD=10A432\nHOST=src.macosforge.org\n\n# make sure we only run when needed\nif [ -f /usr/local/lib/libredo_prebinding.a ]; then\n\texit 0;\nfi\n\n/usr/bin/curl -kL http://$HOST/Roots/$BUILD/cctools_ofiles.root.tar.gz > $CONFIGURATION_TEMP_DIR/cctools_ofiles.root.tar.gz\n\n/bin/mkdir -p $BUILT_PRODUCTS_DIR\n\n/usr/bin/tar zxOf $CONFIGURATION_TEMP_DIR/cctools_ofiles.root.tar.gz ./usr/local/lib/libredo_prebinding.a > $BUILT_PRODUCTS_DIR/libredo_prebinding.a\n\n/bin/mkdir -p $DSTROOT/$PREFIX/lib/\n\n/bin/cp $BUILT_PRODUCTS_DIR/libredo_prebinding.a $DSTROOT/$PREFIX/lib/\n";
-               };
</del><span class="cx"> /* End PBXShellScriptBuildPhase section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin PBXSourcesBuildPhase section */
</span><span class="lines">@@ -2620,11 +2581,6 @@
</span><span class="cx">                  target = 72D05CAD11D267C400B33EDD /* query */;
</span><span class="cx">                  targetProxy = 72D05CB911D2688D00B33EDD /* PBXContainerItemProxy */;
</span><span class="cx">          };
</span><del>-               DFCB82DA109A2F9A00D2DB2F /* PBXTargetDependency */ = {
-                       isa = PBXTargetDependency;
-                       target = 7227AC7E1098EF6400BE33D7 /* libredo_prebinding.a */;
-                       targetProxy = DFCB82D9109A2F9A00D2DB2F /* PBXContainerItemProxy */;
-               };
</del><span class="cx"> /* End PBXTargetDependency section */
</span><span class="cx"> 
</span><span class="cx"> /* Begin XCBuildConfiguration section */
</span><span class="lines">@@ -2865,27 +2821,6 @@
</span><span class="cx">                  };
</span><span class="cx">                  name = Release;
</span><span class="cx">          };
</span><del>-               7227AC7F1098EF6400BE33D7 /* Debug */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               PRODUCT_NAME = libredo_prebinding.a;
-                       };
-                       name = Debug;
-               };
-               7227AC801098EF6400BE33D7 /* Public */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               PRODUCT_NAME = libredo_prebinding.a;
-                       };
-                       name = Public;
-               };
-               7227AC811098EF6400BE33D7 /* Release */ = {
-                       isa = XCBuildConfiguration;
-                       buildSettings = {
-                               PRODUCT_NAME = libredo_prebinding.a;
-                       };
-                       name = Release;
-               };
</del><span class="cx">           72573F7C1097A488008AD4D7 /* Debug */ = {
</span><span class="cx">                  isa = XCBuildConfiguration;
</span><span class="cx">                  baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */;
</span><span class="lines">@@ -3777,16 +3712,6 @@
</span><span class="cx">                  defaultConfigurationIsVisible = 0;
</span><span class="cx">                  defaultConfigurationName = Public;
</span><span class="cx">          };
</span><del>-               7227AC841098EF8000BE33D7 /* Build configuration list for PBXAggregateTarget "libredo_prebinding.a" */ = {
-                       isa = XCConfigurationList;
-                       buildConfigurations = (
-                               7227AC7F1098EF6400BE33D7 /* Debug */,
-                               7227AC801098EF6400BE33D7 /* Public */,
-                               7227AC811098EF6400BE33D7 /* Release */,
-                       );
-                       defaultConfigurationIsVisible = 0;
-                       defaultConfigurationName = Public;
-               };
</del><span class="cx">           72573F7B1097A488008AD4D7 /* Build configuration list for PBXNativeTarget "dependencies" */ = {
</span><span class="cx">                  isa = XCConfigurationList;
</span><span class="cx">                  buildConfigurations = (
</span></span></pre></div>
<a id="trunkdarwintraceMakefile"></a>
<div class="delfile"><h4>Deleted: trunk/darwintrace/Makefile (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwintrace/Makefile       2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwintrace/Makefile  2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,39 +0,0 @@
</span><del>-include ../common.mk
-
-LIBS=$(shell if [ -e /usr/lib/libSystemStubs.a ]; then echo -lSystemStubs; fi)
-
-###
-### Variables for the 'install' phase
-###
-DATDIR:=$(DATDIR)/darwinbuild
-
-all: darwintrace.dylib
-
-VERSION=$(shell uname -r | cut -f1 -d. )
-ifeq ($(VERSION), 8)
-CFLAGS += -nostdlib
-else
-CFLAGS += -nodefaultlibs
-endif
-
-darwintrace.dylib: darwintrace.c
-       cc -o $(OBJROOT)/$@ \
-               $(CFLAGS) \
-               -Wall -Werror -pedantic -std=c99 \
-               -flat_namespace \
-               -fno-common \
-               $(CFLAGS) \
-               -undefined suppress \
-               -dynamiclib \
-               $^ $(LIBS)
-clean:
-       rm -f darwintrace.dylib
-
-install: all
-       [ -d $(DATDIR) ] || \
-               $(INSTALL) -d $(INSTALL_DIR_FLAGS) $(DATDIR)
-       $(INSTALL) $(INSTALL_DOC_FLAGS) $(OBJROOT)/darwintrace.dylib $(DATDIR)
-
-uninstall:
-       rm -f $(DATDIR)/darwintrace.dylib
-       -rmdir $(DATDIR)
</del></span></pre></div>
<a id="trunkdarwintracedarwintracec"></a>
<div class="modfile"><h4>Modified: trunk/darwintrace/darwintrace.c (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwintrace/darwintrace.c  2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwintrace/darwintrace.c     2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -40,136 +40,171 @@
</span><span class="cx"> #include <unistd.h>
</span><span class="cx"> #include <sys/stat.h>
</span><span class="cx"> #include <sys/param.h>
</span><del>-#include <sys/syscall.h>
</del><span class="cx"> #include <sys/paths.h>
</span><span class="cx"> #include <errno.h>
</span><span class="cx"> 
</span><span class="cx"> #define DARWINTRACE_LOG_FULL_PATH 1
</span><span class="cx"> #define DARWINTRACE_DEBUG_OUTPUT 0
</span><ins>+#define DARWINTRACE_START_FD 101
+#define DARWINTRACE_STOP_FD  200
+#define DARWINTRACE_BUFFER_SIZE        1024
</ins><span class="cx"> 
</span><del>-#define START_FD 81
-static int __darwintrace_fd = -2;
-#define BUFFER_SIZE    1024
-
-static char __darwintrace_progname[BUFFER_SIZE];
-static pid_t __darwintrace_pid = -1;
-
</del><span class="cx"> #if DARWINTRACE_DEBUG_OUTPUT
</span><span class="cx"> #define dprintf(...) fprintf(stderr, __VA_ARGS__)
</span><span class="cx"> #else
</span><span class="cx"> #define dprintf(...)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#define DARWINTRACE_INTERPOSE(_replacement,_replacee) \
+__attribute__((used)) static struct{ const void* replacement; const void* replacee; } _interpose_##_replacee \
+__attribute__ ((section ("__DATA,__interpose"))) = { (const void*)(unsigned long)&_replacement, (const void*)(unsigned long)&_replacee };
+
+static int darwintrace_fd = -2;
+static char darwintrace_progname[DARWINTRACE_BUFFER_SIZE];
+static pid_t darwintrace_pid = -1;
+
</ins><span class="cx"> /**
</span><span class="cx">  * Redirect file access 
</span><span class="cx">  */
</span><del>-static char *__darwintrace_redirect = NULL; 
-static char *__darwintrace_buildroot = NULL;
-static const char *__redirect_exceptions[] = {"/Developer/Library/Private",
-                                             "/Developer/Library/Frameworks",
-                                             "/Developer/usr/bin/../../Library/Private",
-                                             "/Developer/usr/bin/../../Library/Frameworks",
-                                             "/Developer/Library/Xcode",
-                                             "/Developer/Platforms/",
-                                             "/Developer/usr/bin/xcode",
-                                             "/System/Library/Frameworks/Carbon",
-                                             "/Volumes/BuildRoot_",
-                                             "/usr/bin/xcrun",
-                                             "/usr/bin/xcode",
-                                             "/usr/local/share/darwin",
-                                             "/usr/share/xcode",
-                                             "/var/folders/",
-                                             "/var/tmp/",
-                                             "/.vol/",
-                                             "/tmp/",
-                                             "/dev/"};
</del><ins>+static char *darwintrace_redirect = NULL; 
+static char *darwintrace_buildroot = NULL;
+static const char *darwintrace_exceptions[] = {
+  "/Developer/Library/Private",
+  "/Developer/Library/Frameworks",
+  "/Developer/usr/bin/../../Library/Private",
+  "/Developer/usr/bin/../../Library/Frameworks",
+  "/Developer/Library/Xcode",
+  "/Developer/Platforms/",
+  "/Developer/usr/bin/xcode",
+  "/System/Library/Frameworks/Carbon",
+  "/Volumes/BuildRoot_",
+  "/usr/bin/xcrun",
+  "/usr/bin/xcode",
+  "/usr/local/share/darwin",
+  "/usr/share/xcode",
+  "/var/folders/",
+  "/var/tmp/",
+  "/.vol/",
+  "/tmp/",
+  "/dev/",
+};
</ins><span class="cx"> 
</span><ins>+/* store root paths so we can ignore them when logging */
+static char   **darwintrace_ignores     = NULL;
+static size_t  *darwintrace_ignore_lens = NULL;
+
</ins><span class="cx"> /* check if str starts with one of the exceptions */
</span><del>-static inline bool __except(const char *str) {
-  size_t i, __exception_count = sizeof(__redirect_exceptions)/sizeof(*__redirect_exceptions); 
-  for (i = 0; i < __exception_count; i++) {                         
-    if (strncmp(__redirect_exceptions[i], str, strlen(__redirect_exceptions[i])) == 0) { 
</del><ins>+static inline bool darwintrace_except(const char *str) {
+  size_t c = sizeof(darwintrace_exceptions)/sizeof(*darwintrace_exceptions); 
+  size_t i;
+  for (i = 0; i < c; i++) {                         
+    if (strncmp(darwintrace_exceptions[i], str, strlen(darwintrace_exceptions[i])) == 0) { 
</ins><span class="cx">       return true;
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="cx">   return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* create __darwintrace_path and write the potentially-redirected path to it */
-#define __redirect_path()                                              \
-  char *__darwintrace_path;                                            \
-  __darwintrace_path = (char *)path;                                   \
-  if (__darwintrace_redirect                                           \
-      && path[0] == '/'                                                        \
-      && !__except(path)                                               \
-      && strncmp(__darwintrace_buildroot, path, strlen(__darwintrace_buildroot))!=0 \
-      && strncmp(__darwintrace_redirect, path, strlen(__darwintrace_redirect))!=0 ) { \
-    asprintf(&__darwintrace_path, "%s%s%s", __darwintrace_redirect, (*path == '/' ? "" : "/"), path); \
-    dprintf("darwintrace: redirect %s -> %s\n", path, __darwintrace_path);                \
</del><ins>+/* apply redirection heuristic to path */
+static inline char* darwintrace_redirect_path(const char* path) {
+  if (!darwintrace_redirect) return (char*)path;
+
+  char *redirpath;
+  redirpath = (char *)path;
+  if (path[0] == '/'
+      && !darwintrace_except(path)
+      && strncmp(darwintrace_buildroot, path, strlen(darwintrace_buildroot))!=0
+      && strncmp(darwintrace_redirect, path, strlen(darwintrace_redirect))!=0 ) {
+    asprintf(&redirpath, "%s%s%s", darwintrace_redirect, (*path == '/' ? "" : "/"), path);
+    dprintf("darwintrace: redirect %s -> %s\n", path, redirpath);
</ins><span class="cx">   }
</span><del>-#define __free_path()                              \
-  if (__darwintrace_path != path) {                \
-    free(__darwintrace_path);                      \
-  }
</del><span class="cx"> 
</span><ins>+  return redirpath;
+}
</ins><span class="cx"> 
</span><del>-static inline void __darwintrace_setup() {
-       if (__darwintrace_fd == -2) {
-         char* path = getenv("DARWINTRACE_LOG");
-         if (path != NULL) {
-               int olderrno = errno;
-               int fd = open(path,
-                             O_CREAT | O_WRONLY | O_APPEND,
-                             DEFFILEMODE);
-               int newfd;
-               for(newfd = START_FD; newfd < START_FD + 21; newfd++) {
-                 if(-1 == write(newfd, "", 0) && errno == EBADF) {
-                   if(-1 != dup2(fd, newfd))
-                     __darwintrace_fd = newfd;
-                   close(fd);
-                   fcntl(__darwintrace_fd, F_SETFD, 1); /* close-on-exec */
-                   break;
-                 }
-               }
-               errno = olderrno;
-         }
</del><ins>+/* free path if not the same as test */
+static inline void darwintrace_free_path(char* path, const char* test) {
+  if (path != test) free(path);
+}
</ins><span class="cx"> 
</span><del>-         /* read env vars needed for redirection */
-         __darwintrace_redirect = getenv("DARWINTRACE_REDIRECT");
-         __darwintrace_buildroot = getenv("DARWIN_BUILDROOT");
-       }
</del><ins>+static inline void darwintrace_setup() {
+       if (darwintrace_fd != -2) return;
+  
+  char* path = getenv("DARWINTRACE_LOG");
+  if (path != NULL) {
+    int olderrno = errno;
+    int fd = open(path,
+                  O_CREAT | O_WRONLY | O_APPEND,
+                  DEFFILEMODE);
+    int newfd;
+    for(newfd = DARWINTRACE_START_FD; newfd < DARWINTRACE_STOP_FD; newfd++) {
+      if(-1 == write(newfd, "", 0) && errno == EBADF) {
+        if(-1 != dup2(fd, newfd)) darwintrace_fd = newfd;
+        close(fd);
+        fcntl(darwintrace_fd, F_SETFD, 1); /* close-on-exec */
+        break;
+      }
+    }
+    errno = olderrno;
+  }
</ins><span class="cx"> 
</span><del>-       if (__darwintrace_pid == -1) {
-               __darwintrace_pid = getpid();
-               char** progname = _NSGetProgname();
-               if (progname && *progname) {
-                 if (strlcpy(__darwintrace_progname, *progname, sizeof(__darwintrace_progname)) 
-                     >= sizeof(__darwintrace_progname)) {
-                   dprintf("darwintrace: progname too long to copy: %s\n", *progname);
-                 }
-               }
-       }
-}
</del><ins>+  /* read env vars needed for redirection */
+  darwintrace_redirect = getenv("DARWINTRACE_REDIRECT");
+  darwintrace_buildroot = getenv("DARWIN_BUILDROOT");
</ins><span class="cx"> 
</span><del>-/* __darwintrace_setup must have been called already */
-static inline void __darwintrace_logpath(int fd, const char *procname, char *tag, const char *path) {
-#pragma unused(procname)
-  char __darwintrace_buf[BUFFER_SIZE];
-  int size;
-
-  size = snprintf(__darwintrace_buf, sizeof(__darwintrace_buf),
-                 "%s[%d]\t%s\t%s\n",
-                 procname ? procname : __darwintrace_progname, __darwintrace_pid,
-                 tag, path );
</del><ins>+  darwintrace_pid = getpid();
+  char** progname = _NSGetProgname();
+  if (progname && *progname) {
+    if (strlcpy(darwintrace_progname, *progname, sizeof(darwintrace_progname)) >= sizeof(darwintrace_progname)) {
+      dprintf("darwintrace: progname too long to copy: %s\n", *progname);
+    }
+  }
</ins><span class="cx">   
</span><del>-  write(fd, __darwintrace_buf, size);
-  fsync(fd);
</del><ins>+  /* create ignores list from root env vars */
+  if (getenv("DARWINTRACE_IGNORE_ROOTS")) {
+    darwintrace_ignores = (char**)calloc(4, sizeof(char*));
+    darwintrace_ignore_lens = (size_t*)calloc(4, sizeof(size_t));
+    if (darwintrace_ignores && darwintrace_ignore_lens) {
+      darwintrace_ignores[0] = getenv("OBJROOT");
+      if (darwintrace_ignores[0])
+        darwintrace_ignore_lens[0] = strlen(darwintrace_ignores[0]);
+      darwintrace_ignores[1] = getenv("SRCROOT");
+      if (darwintrace_ignores[1])
+        darwintrace_ignore_lens[1] = strlen(darwintrace_ignores[1]);
+      darwintrace_ignores[2] = getenv("DSTROOT");
+      if (darwintrace_ignores[2])
+        darwintrace_ignore_lens[2] = strlen(darwintrace_ignores[2]);
+      darwintrace_ignores[3] = getenv("SYMROOT");
+      if (darwintrace_ignores[3]) 
+        darwintrace_ignore_lens[3] = strlen(darwintrace_ignores[3]);
+    } else {
+      dprintf("unable to allocate memory for darwintrace_ignores"); 
+    }
+  }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/* darwintrace_setup must have been called already */
+static inline void darwintrace_logpath(int fd, const char *procname, char *tag, const char *path) {
+  if (darwintrace_ignores) {
+    for (int i=0; i < 4; i++) {
+      if (darwintrace_ignores[i] 
+          && strncmp(darwintrace_ignores[i], path, darwintrace_ignore_lens[i]) == 0) {
+        return;
+      }
+    }
+  }
+  char darwintrace_buf[DARWINTRACE_BUFFER_SIZE];
+  int size = snprintf(darwintrace_buf, sizeof(darwintrace_buf),
+                      "%s[%d]\t%s\t%s\n",
+                      procname ? procname : darwintrace_progname, darwintrace_pid,
+                      tag, path);
+  write(fd, darwintrace_buf, size);
+}
+
</ins><span class="cx"> /* remap resource fork access to the data fork.
</span><span class="cx">  * do a partial realpath(3) to fix "foo//bar" to "foo/bar"
</span><span class="cx">  */
</span><del>-static inline void __darwintrace_cleanup_path(char *path) {
</del><ins>+static inline void darwintrace_cleanup_path(char *path) {
</ins><span class="cx">   size_t pathlen, rsrclen;
</span><span class="cx">   size_t i, shiftamount;
</span><span class="cx">   enum { SAWSLASH, NOTHING } state = NOTHING;
</span><span class="lines">@@ -179,9 +214,9 @@
</span><span class="cx">   rsrclen = strlen(_PATH_RSRCFORKSPEC);
</span><span class="cx">   if(pathlen > rsrclen
</span><span class="cx">      && 0 == strncmp(path + pathlen - rsrclen,
</span><del>-                    _PATH_RSRCFORKSPEC, rsrclen)) {
-    path[pathlen - rsrclen] = '\0';
-    pathlen -= rsrclen;
</del><ins>+                     _PATH_RSRCFORKSPEC, rsrclen)) {
+       path[pathlen - rsrclen] = '\0';
+       pathlen -= rsrclen;
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   /* for each position in string (including
</span><span class="lines">@@ -192,15 +227,15 @@
</span><span class="cx">   for(i=0, shiftamount=0; i <= pathlen; i++) {
</span><span class="cx">     if(state == SAWSLASH) {
</span><span class="cx">       if(path[i] == '/') {
</span><del>-       /* consume it */
-       shiftamount++;
</del><ins>+        /* consume it */
+        shiftamount++;
</ins><span class="cx">       } else {
</span><del>-       state = NOTHING;
-       path[i - shiftamount] = path[i];
</del><ins>+        state = NOTHING;
+        path[i - shiftamount] = path[i];
</ins><span class="cx">       }
</span><span class="cx">     } else {
</span><span class="cx">       if(path[i] == '/') {
</span><del>-       state = SAWSLASH;
</del><ins>+        state = SAWSLASH;
</ins><span class="cx">       }
</span><span class="cx">       path[i - shiftamount] = path[i];
</span><span class="cx">     }
</span><span class="lines">@@ -209,29 +244,26 @@
</span><span class="cx">   dprintf("darwintrace: cleanup resulted in %s\n", path);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* Log calls to open(2) into the file specified by DARWINTRACE_LOG.
-   Only logs if the DARWINTRACE_LOG environment variable is set.
</del><ins>+/* 
</ins><span class="cx">    Only logs files where the open succeeds.
</span><span class="cx">    Only logs files opened for read access, without the O_CREAT flag set.
</span><span class="cx">    The assumption is that any file that can be created isn't necessary
</span><span class="cx">    to build the project.
</span><span class="cx"> */
</span><del>-
-int open(const char* path, int flags, ...) {
-#define open(x,y,z) syscall(SYS_open, (x), (y), (z))
</del><ins>+int darwintrace_open(const char* path, int flags, ...) {
</ins><span class="cx">   mode_t mode;
</span><span class="cx">  int result;
</span><span class="cx">  va_list args;
</span><span class="cx"> 
</span><del>-       __redirect_path();
</del><ins>+        char* redirpath = darwintrace_redirect_path(path);
</ins><span class="cx"> 
</span><span class="cx">  va_start(args, flags);
</span><span class="cx">  mode = va_arg(args, int);
</span><span class="cx">  va_end(args);
</span><del>-       result = open(__darwintrace_path, flags, mode);
-       if (result >= 0 && (flags & (O_CREAT | O_WRONLY /*O_RDWR*/)) == 0 ) {
-         __darwintrace_setup();
-         if (__darwintrace_fd >= 0) {
</del><ins>+        result = open(redirpath, flags, mode);
+       if (result >= 0 && (flags & (O_CREAT | O_WRONLY)) == 0 ) {
+         darwintrace_setup();
+         if (darwintrace_fd >= 0) {
</ins><span class="cx">       char realpath[MAXPATHLEN];
</span><span class="cx"> #if DARWINTRACE_LOG_FULL_PATH
</span><span class="cx">      int usegetpath = 1;
</span><span class="lines">@@ -239,76 +271,76 @@
</span><span class="cx">      int usegetpath = 0;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-           dprintf("darwintrace: original open path is %s\n", __darwintrace_path);
</del><ins>+            dprintf("darwintrace: original open path is %s\n", redirpath);
</ins><span class="cx"> 
</span><span class="cx">      /* for volfs paths, we need to do a GETPATH anyway */
</span><del>-           if(!usegetpath && strncmp(__darwintrace_path, "/.vol/", 6) == 0) {
</del><ins>+            if(!usegetpath && strncmp(redirpath, "/.vol/", 6) == 0) {
</ins><span class="cx">         usegetpath = 1;
</span><span class="cx">      }
</span><span class="cx">      
</span><span class="cx">      if(usegetpath) {
</span><del>-             if(0 == fcntl(result, F_GETPATH, realpath)) {
-               dprintf("darwintrace: resolved %s to %s\n", __darwintrace_path, realpath);
</del><ins>+        if(0 == fcntl(result, F_GETPATH, realpath)) {
+          dprintf("darwintrace: resolved %s to %s\n", redirpath, realpath);
</ins><span class="cx">         } else {
</span><del>-               /* use original path */
-               dprintf("darwintrace: failed to resolve %s\n", __darwintrace_path);
-               if (strlcpy(realpath, __darwintrace_path, sizeof(realpath)) >= sizeof(realpath)) {
-                 dprintf("darwintrace: in open: original path too long to copy: %s\n", __darwintrace_path);
-               }
-             }
-           } else {
-             if (strlcpy(realpath, __darwintrace_path, sizeof(realpath)) >= sizeof(realpath)) {
-               dprintf("darwintrace: in open (without getpath): path too long to copy: %s\n", __darwintrace_path);
-             }
-           }
</del><ins>+          /* use original path */
+          dprintf("darwintrace: failed to resolve %s\n", redirpath);
+          if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) {
+            dprintf("darwintrace: in open: original path too long to copy: %s\n", redirpath);
+          }
+        }
+      } else {
+             if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) {
+          dprintf("darwintrace: in open (without getpath): path too long to copy: %s\n", redirpath);
+        }
+      }
</ins><span class="cx"> 
</span><del>-           __darwintrace_cleanup_path(realpath);
-
-           __darwintrace_logpath(__darwintrace_fd, NULL, "open", realpath);
</del><ins>+            darwintrace_cleanup_path(realpath);
+           darwintrace_logpath(darwintrace_fd, NULL, "open", realpath);
</ins><span class="cx">     }
</span><span class="cx">  }
</span><del>-       __free_path();
</del><ins>+
+       darwintrace_free_path(redirpath, path);
</ins><span class="cx">   return result;
</span><span class="cx"> }
</span><ins>+DARWINTRACE_INTERPOSE(darwintrace_open, open)
</ins><span class="cx"> 
</span><del>-/* Log calls to readlink(2) into the file specified by DARWINTRACE_LOG.
-   Only logs if the DARWINTRACE_LOG environment variable is set.
</del><ins>+
+/* 
</ins><span class="cx">    Only logs files where the readlink succeeds.
</span><span class="cx"> */
</span><del>-
-ssize_t  readlink(const char * path, char * buf, size_t bufsiz) {
-#define readlink(x,y,z) syscall(SYS_readlink, (x), (y), (z))
</del><ins>+ssize_t darwintrace_readlink(const char * path, char * buf, size_t bufsiz) {
</ins><span class="cx">   ssize_t result;
</span><span class="cx"> 
</span><del>-       __redirect_path();
-       result = readlink(__darwintrace_path, buf, bufsiz);
</del><ins>+        char* redirpath = darwintrace_redirect_path(path);
+       result = readlink(redirpath, buf, bufsiz);
</ins><span class="cx">   if (result >= 0) {
</span><del>-         __darwintrace_setup();
-         if (__darwintrace_fd >= 0) {
</del><ins>+          darwintrace_setup();
+         if (darwintrace_fd >= 0) {
</ins><span class="cx">       char realpath[MAXPATHLEN];
</span><span class="cx"> 
</span><del>-           dprintf("darwintrace: original readlink path is %s\n", __darwintrace_path);
</del><ins>+            dprintf("darwintrace: original readlink path is %s\n", redirpath);
</ins><span class="cx"> 
</span><del>-           if (strlcpy(realpath, __darwintrace_path, sizeof(realpath)) >= sizeof(realpath)) {
-             dprintf("darwintrace: in readlink: path too long to copy: %s\n", __darwintrace_path);
</del><ins>+            if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) {
+             dprintf("darwintrace: in readlink: path too long to copy: %s\n", redirpath);
</ins><span class="cx">       }
</span><span class="cx">      
</span><del>-           __darwintrace_cleanup_path(realpath);
-
-           __darwintrace_logpath(__darwintrace_fd, NULL, "readlink", realpath);
</del><ins>+            darwintrace_cleanup_path(realpath);
+           darwintrace_logpath(darwintrace_fd, NULL, "readlink", realpath);
</ins><span class="cx">     }
</span><span class="cx">  }
</span><del>-       __free_path();
</del><ins>+  
+       darwintrace_free_path(redirpath, path);
</ins><span class="cx">   return result;
</span><span class="cx"> }
</span><ins>+DARWINTRACE_INTERPOSE(darwintrace_readlink, readlink)
</ins><span class="cx"> 
</span><del>-int execve(const char* path, char* const argv[], char* const envp[]) {
-#define execve(x,y,z) syscall(SYS_execve, (x), (y), (z))
</del><ins>+
+int darwintrace_execve(const char* path, char* const argv[], char* const envp[]) {
</ins><span class="cx">   int result;
</span><span class="cx">  
</span><del>-       __redirect_path();
-       __darwintrace_setup();
-       if (__darwintrace_fd >= 0) {
</del><ins>+        char* redirpath = darwintrace_redirect_path(path);
+       darwintrace_setup();
+       if (darwintrace_fd >= 0) {
</ins><span class="cx">     struct stat sb;
</span><span class="cx">    char realpath[MAXPATHLEN];
</span><span class="cx">    int printorig = 0;
</span><span class="lines">@@ -320,15 +352,15 @@
</span><span class="cx">    int usegetpath = 0;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-         dprintf("darwintrace: original execve path is %s\n", __darwintrace_path);
</del><ins>+          dprintf("darwintrace: original execve path is %s\n", redirpath);
</ins><span class="cx"> 
</span><span class="cx">    /* for symlinks, we wan't to capture
</span><span class="cx">     * both the original path and the modified one,
</span><span class="cx">     * since for /usr/bin/gcc -> gcc-4.0,
</span><span class="cx">     * both "gcc_select" and "gcc" are contributors
</span><span class="cx">     */
</span><del>-         if (lstat(__darwintrace_path, &sb) == 0) {
-           if(__darwintrace_path[0] != '/') {
</del><ins>+          if (lstat(redirpath, &sb) == 0) {
+           if(redirpath[0] != '/') {
</ins><span class="cx">         /* for relative paths, only print full path */
</span><span class="cx">        printreal = 1;
</span><span class="cx">        printorig = 0;
</span><span class="lines">@@ -343,15 +375,15 @@
</span><span class="cx">      }
</span><span class="cx"> 
</span><span class="cx">      if(printorig) {
</span><del>-             if (strlcpy(realpath, __darwintrace_path, sizeof(realpath)) >= sizeof(realpath)) {
-               dprintf("darwintrace: in execve: path too long to copy: %s\n", __darwintrace_path);
</del><ins>+              if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) {
+          dprintf("darwintrace: in execve: path too long to copy: %s\n", redirpath);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-             __darwintrace_cleanup_path(realpath);
-             __darwintrace_logpath(__darwintrace_fd, NULL, "execve", realpath);
</del><ins>+              darwintrace_cleanup_path(realpath);
+             darwintrace_logpath(darwintrace_fd, NULL, "execve", realpath);
</ins><span class="cx">       }
</span><span class="cx">          
</span><del>-           fd = open(__darwintrace_path, O_RDONLY, 0);
</del><ins>+            fd = open(redirpath, O_RDONLY, 0);
</ins><span class="cx">       if (fd != -1) {
</span><span class="cx"> 
</span><span class="cx">        char buffer[MAXPATHLEN];
</span><span class="lines">@@ -359,86 +391,89 @@
</span><span class="cx"> 
</span><span class="cx">        /* once we have an open fd, if a full path was requested, do it */
</span><span class="cx">        if(printreal) {
</span><del>-               
-               if(usegetpath) {
-                 if(0 == fcntl(fd, F_GETPATH, realpath)) {
-                   dprintf("darwintrace: resolved execve path %s to %s\n", __darwintrace_path, realpath);
-                 } else {
-                   dprintf("darwintrace: failed to resolve %s\n", __darwintrace_path);
-                   if (strlcpy(realpath, __darwintrace_path, sizeof(realpath)) >= sizeof(realpath)) {
-                     dprintf("darwintrace: in execve: original path too long to copy: %s\n", __darwintrace_path);
-                   }
-                 }
-               } else {
-                 if (strlcpy(realpath, __darwintrace_path, sizeof(realpath)) >= sizeof(realpath)) {
-                   dprintf("darwintrace: in execve (without getpath): path too long to copy: %s\n", __darwintrace_path);
-                 }
-               }
-               __darwintrace_cleanup_path(realpath);
</del><span class="cx"> 
</span><del>-               __darwintrace_logpath(__darwintrace_fd, NULL, "execve", realpath);
</del><ins>+          if(usegetpath) {
+            if(0 == fcntl(fd, F_GETPATH, realpath)) {
+              dprintf("darwintrace: resolved execve path %s to %s\n", redirpath, realpath);
+            } else {
+              dprintf("darwintrace: failed to resolve %s\n", redirpath);
+              if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) {
+                dprintf("darwintrace: in execve: original path too long to copy: %s\n", redirpath);
+              }
+            }
+          } else {
+            if (strlcpy(realpath, redirpath, sizeof(realpath)) >= sizeof(realpath)) {
+              dprintf("darwintrace: in execve (without getpath): path too long to copy: %s\n", redirpath);
+            }
+          }
+          
+          darwintrace_cleanup_path(realpath);
+          darwintrace_logpath(darwintrace_fd, NULL, "execve", realpath);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">        bzero(buffer, sizeof(buffer));
</span><span class="cx"> 
</span><span class="cx">        bytes_read = read(fd, buffer, MAXPATHLEN);
</span><span class="cx">        if (bytes_read > 2 &&
</span><del>-                 buffer[0] == '#' && buffer[1] == '!') {
-               char* interp = &buffer[2];
-               int i;
-               /* skip past leading whitespace */
-               for (i = 2; i < bytes_read; ++i) {
-                 if (buffer[i] != ' ' && buffer[i] != '\t') {
-                   interp = &buffer[i];
-                   break;
-                 }
-               }
-               /* found interpreter (or ran out of data)
-                  skip until next whitespace, then terminate the string */
-               for (; i < bytes_read; ++i) {
-                 if (buffer[i] == ' ' || buffer[i] == '\t' || buffer[i] == '\n') {
-                   buffer[i] = 0;
-                   break;
-                 }
-               }
-               /* we have liftoff */
-               if (interp && interp[0] != '\0') {
-                 const char* procname = NULL;
</del><ins>+            buffer[0] == '#' && buffer[1] == '!') {
+          char* interp = &buffer[2];
+          int i;
+          /* skip past leading whitespace */
+          for (i = 2; i < bytes_read; ++i) {
+            if (buffer[i] != ' ' && buffer[i] != '\t') {
+              interp = &buffer[i];
+              break;
+            }
+          }
+          /* found interpreter (or ran out of data)
+           skip until next whitespace, then terminate the string */
+          for (; i < bytes_read; ++i) {
+            if (buffer[i] == ' ' || buffer[i] == '\t' || buffer[i] == '\n') {
+              buffer[i] = 0;
+              break;
+            }
+          }
+          /* we have liftoff */
+          if (interp && interp[0] != '\0') {
+            const char* procname = NULL;
</ins><span class="cx"> 
</span><del>-                 /* look for slash to get the basename */
-                 procname = strrchr(argv[0], '/');
-                 if (procname == NULL) {
-                   /* no slash found, so assume whole string is basename */
-                   procname = argv[0];
-                 } else {
-                   /* advance pointer to just after slash */
-                   procname++;
-                 }
</del><ins>+            /* look for slash to get the basename */
+            procname = strrchr(argv[0], '/');
+            if (procname == NULL) {
+              /* no slash found, so assume whole string is basename */
+              procname = argv[0];
+            } else {
+              /* advance pointer to just after slash */
+              procname++;
+            }
</ins><span class="cx"> 
</span><del>-                 __darwintrace_cleanup_path(interp);
-
-                 __darwintrace_logpath(__darwintrace_fd, procname, "execve", interp);
-               }
</del><ins>+            darwintrace_cleanup_path(interp);
+            darwintrace_logpath(darwintrace_fd, procname, "execve", interp);
+          }
</ins><span class="cx">         }
</span><ins>+        
</ins><span class="cx">         close(fd);
</span><span class="cx">      }
</span><span class="cx">    }
</span><span class="cx">  }
</span><del>-       result = execve(__darwintrace_path, argv, envp);
-       __free_path();
</del><ins>+  
+       result = execve(redirpath, argv, envp);
+       darwintrace_free_path(redirpath, path);
</ins><span class="cx">   return result;
</span><span class="cx"> }
</span><ins>+DARWINTRACE_INTERPOSE(darwintrace_execve, execve)
</ins><span class="cx"> 
</span><del>-/* if darwintrace has  been initialized, trap
</del><ins>+
+/* 
+   if darwintrace has been initialized, trap
</ins><span class="cx">    attempts to close our file descriptor
</span><span class="cx"> */
</span><del>-int close(int fd) {
-#define close(x) syscall(SYS_close, (x))
-
-  if(__darwintrace_fd != -2 && fd == __darwintrace_fd) {
</del><ins>+int darwintrace_close(int fd) {
+  if(darwintrace_fd != -2 && fd == darwintrace_fd) {
</ins><span class="cx">     errno = EBADF;
</span><span class="cx">     return -1;
</span><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   return close(fd);
</span><span class="cx"> }
</span><ins>+DARWINTRACE_INTERPOSE(darwintrace_close, close)
</ins></span></pre></div>
<a id="trunkdarwinupDepotcpp"></a>
<div class="modfile"><h4>Modified: trunk/darwinup/Depot.cpp (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinup/Depot.cpp 2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinup/Depot.cpp    2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -695,7 +695,9 @@
</span><span class="cx">  if (INFO_TEST(file->info(), FILE_INFO_INSTALL_DATA)) {
</span><span class="cx">          ++context->files_modified;
</span><span class="cx"> 
</span><del>-               res = file->install(context->depot->m_archives_path, context->depot->m_prefix);
</del><ins>+                res = file->install(context->depot->m_archives_path,
+                        context->depot->m_prefix,
+                        context->reverse_files);
</ins><span class="cx">   } else {
</span><span class="cx">          res = file->install_info(context->depot->m_prefix);
</span><span class="cx">  }
</span><span class="lines">@@ -947,11 +949,13 @@
</span><span class="cx">                                                  S_ISDIR(preceding->mode())) {
</span><span class="cx">                                                  // use rename instead of mkdir so children are restored
</span><span class="cx">                                                  res = preceding->dirrename(context->depot->m_archives_path, 
</span><del>-                                                                                                          context->depot->m_prefix);                                                     
</del><ins>+                                                                                                                       context->depot->m_prefix,
+                                         context->reverse_files);                                                   
</ins><span class="cx"> 
</span><span class="cx">                                          } else {
</span><span class="cx">                                                  res = preceding->install(context->depot->m_archives_path, 
</span><del>-                                                                                                        context->depot->m_prefix);                                                       
</del><ins>+                                                                                                                     context->depot->m_prefix,
+                                       context->reverse_files);
</ins><span class="cx">                                           }
</span><span class="cx">                                  }
</span><span class="cx">                          } else if (INFO_TEST(flags, FILE_INFO_MODE_DIFFERS) ||
</span></span></pre></div>
<a id="trunkdarwinupDigestcpp"></a>
<div class="modfile"><h4>Modified: trunk/darwinup/Digest.cpp (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinup/Digest.cpp        2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinup/Digest.cpp   2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -40,15 +40,6 @@
</span><span class="cx"> #include <string.h>
</span><span class="cx"> #include <unistd.h>
</span><span class="cx"> 
</span><del>-// For SHA1DigestMachO
-#include <mach/mach_init.h>
-#include <mach/vm_map.h>
-extern "C" {
-// <rdar://problem/4319807> redo_prebinding.h should use extern "C"
-//#include <mach-o/redo_prebinding.h> // from cctools_ofiles
-#include "redo_prebinding.h"
-}
-
</del><span class="cx"> uint8_t*  Digest::data() { return m_data; }
</span><span class="cx"> uint32_t Digest::size() { return m_size; }
</span><span class="cx"> 
</span><span class="lines">@@ -123,45 +114,6 @@
</span><span class="cx">  CC_SHA1((const void*)data, (CC_LONG)size, md);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-SHA1DigestMachO::SHA1DigestMachO(const char* filename) {
-       char* error = NULL;
-       
-       // Check for Mach-O
-       int type = object_file_type(filename, NULL, &error);
-       if (type == OFT_EXECUTABLE ||
-               type == OFT_DYLIB ||
-               type == OFT_BUNDLE) {
-               // XXX - type == OFT_ARCHIVE?
-               void* block = NULL;
-               unsigned long blocklen = 0;
-               int ret = unprebind(filename,
-                       NULL,
-                       NULL,
-                       &error,
-                       1,
-                       NULL,
-                       0,
-                       &block,
-                       &blocklen);
-               if (ret == REDO_PREBINDING_SUCCESS && block != NULL) {
-                       digest(m_data, (uint8_t*)block, blocklen);
-               } else {
-                       //fprintf(stderr, "%s:%d: unexpected unprebind result: %s: %s (%d)\n", __FILE__, __LINE__, filename, error, ret);
-                       int fd = open(filename, O_RDONLY);
-                       digest(m_data, fd);
-                       close(fd);
-               }
-               if (block != NULL) {
-                       kern_return_t ret = vm_deallocate(mach_task_self(), (vm_address_t)block, (vm_size_t)blocklen);
-                       assert(ret == 0);
-               }
-       } else {
-               int fd = open(filename, O_RDONLY);
-               digest(m_data, fd);
-               close(fd);
-       }
-}
-
</del><span class="cx"> SHA1DigestSymlink::SHA1DigestSymlink(const char* filename) {
</span><span class="cx">  char link[PATH_MAX];
</span><span class="cx">  int res = readlink(filename, link, PATH_MAX);
</span></span></pre></div>
<a id="trunkdarwinupDigesth"></a>
<div class="modfile"><h4>Modified: trunk/darwinup/Digest.h (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinup/Digest.h  2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinup/Digest.h     2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -111,18 +111,6 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> ////
</span><del>-//  SHA1DigestMachO
-//  Digests of canonicalized Mach-O file formats.
-////
-struct SHA1DigestMachO : SHA1Digest {
-       // Computes the SHA-1 digest of the data in the file.
-       // If the file is a Mach-O executable or dynamic library,
-       // the SHA-1 digest is computed from its canonical
-       // representation.
-       SHA1DigestMachO(const char* filename);
-};
-
-////
</del><span class="cx"> //  SHA1DigestSymlink
</span><span class="cx"> //  Digests of the target of a symlink.
</span><span class="cx"> ////
</span></span></pre></div>
<a id="trunkdarwinupFilecpp"></a>
<div class="modfile"><h4>Modified: trunk/darwinup/File.cpp (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinup/File.cpp  2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinup/File.cpp     2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx">  free(dig);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int File::install(const char* prefix, const char* dest) {
</del><ins>+int File::install(const char* prefix, const char* dest, bool uninstall) {
</ins><span class="cx">   extern uint32_t force;
</span><span class="cx">  int res = 0;
</span><span class="cx">  Archive* archive = this->archive();
</span><span class="lines">@@ -160,6 +160,10 @@
</span><span class="cx">  char* dstpath;
</span><span class="cx">  join_path(&dstpath, dest, path);
</span><span class="cx"> 
</span><ins>+  // object changes are expected for some uninstall operations,
+  // otherwise require force flag
+  bool allow_change = (uninstall || force);
+
</ins><span class="cx">   if (dirpath) {
</span><span class="cx">          ssize_t len = snprintf(srcpath, sizeof(srcpath), "%s/%s", dirpath, path);
</span><span class="cx">          if ((size_t)len > sizeof(srcpath)) {
</span><span class="lines">@@ -176,7 +180,7 @@
</span><span class="cx">                          if (is_directory(dirpath) == 0) {
</span><span class="cx">                                  IF_DEBUG("[install] File::install on-demand archive expansion\n");
</span><span class="cx">                                  res = archive->expand_directory(prefix);
</span><del>-                                       if (res == 0) res = this->install(prefix, dest);
</del><ins>+                                        if (res == 0) res = this->install(prefix, dest, uninstall);
</ins><span class="cx">                           } else {
</span><span class="cx">                                  // archive was already expanded, so
</span><span class="cx">                                  // the file is truly missing (worry).
</span><span class="lines">@@ -184,13 +188,13 @@
</span><span class="cx">                                  fprintf(stderr, "%s:%d: %s: %s (%d)\n", 
</span><span class="cx">                                                  __FILE__, __LINE__, srcpath, strerror(errno), errno);
</span><span class="cx">                          }
</span><del>-                       } else if (force && errno == ENOTDIR) {
</del><ins>+                        } else if (allow_change && errno == ENOTDIR) {
</ins><span class="cx">                           // a) some part of destination path does not exist
</span><span class="cx">                          // b) from is a directory, but to is not
</span><span class="cx">                          IF_DEBUG("[install] File::install ENOTDIR\n");
</span><span class="cx">                          fprintf(stderr, "%s:%d: %s: %s (%d)\n", 
</span><span class="cx">                                          __FILE__, __LINE__, dstpath, strerror(errno), errno);
</span><del>-                       } else if (force && errno == EISDIR) {
</del><ins>+                        } else if (allow_change && errno == EISDIR) {
</ins><span class="cx">                           // to is a directory, but from is not
</span><span class="cx">                          IF_DEBUG("[install] replacing directory with a file\n");
</span><span class="cx">                          IF_DEBUG("[install] removefile(%s)\n", dstpath);
</span><span class="lines">@@ -206,7 +210,7 @@
</span><span class="cx">                          if (res == -1) fprintf(stderr, "%s:%d: %s: %s (%d)\n",
</span><span class="cx">                                                                     __FILE__, __LINE__, dstpath, strerror(errno), 
</span><span class="cx">                                                                     errno);
</span><del>-                       } else if (force && errno == ENOTEMPTY) {
</del><ins>+                        } else if (allow_change && errno == ENOTEMPTY) {
</ins><span class="cx">                           // to is a directory and is not empty
</span><span class="cx">                          IF_DEBUG("[install] File::install ENOTEMPTY\n");
</span><span class="cx">                          fprintf(stderr, "%s:%d: %s: %s (%d)\n", 
</span><span class="lines">@@ -228,7 +232,7 @@
</span><span class="cx">  return res;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int File::dirrename(const char* prefix, const char* dest) {
</del><ins>+int File::dirrename(const char* prefix, const char* dest, bool uninstall) {
</ins><span class="cx">   // only used for directories
</span><span class="cx">  assert(0);
</span><span class="cx"> }
</span><span class="lines">@@ -266,14 +270,14 @@
</span><span class="cx"> : File(serial, archive, info, path, mode, uid, gid, size, digest) {}
</span><span class="cx"> 
</span><span class="cx"> Regular::Regular(Archive* archive, FTSENT* ent) : File(archive, ent) {
</span><del>-       m_digest = new SHA1DigestMachO(ent->fts_accpath);
</del><ins>+        m_digest = new SHA1Digest(ent->fts_accpath);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Regular::Regular(uint64_t serial, Archive* archive, uint32_t info, const char* path, 
</span><span class="cx">                           mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest) 
</span><span class="cx"> : File(serial, archive, info, path, mode, uid, gid, size, digest) {
</span><span class="cx">  if (digest == NULL || serial == 0) {
</span><del>-               m_digest = new SHA1DigestMachO(path);
</del><ins>+                m_digest = new SHA1Digest(path);
</ins><span class="cx">   }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -345,15 +349,15 @@
</span><span class="cx">                                   Digest* digest) 
</span><span class="cx"> : File(serial, archive, info, path, mode, uid, gid, size, digest) {};
</span><span class="cx"> 
</span><del>-int Directory::install(const char* prefix, const char* dest) {
-       return this->_install(prefix, dest, false);
</del><ins>+int Directory::install(const char* prefix, const char* dest, bool uninstall) {
+       return this->_install(prefix, dest, uninstall, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int Directory::dirrename(const char* prefix, const char* dest) {
-       return this->_install(prefix, dest, true);   
</del><ins>+int Directory::dirrename(const char* prefix, const char* dest, bool uninstall) {
+       return this->_install(prefix, dest, uninstall, true);        
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int Directory::_install(const char* prefix, const char* dest, bool use_rename) {
</del><ins>+int Directory::_install(const char* prefix, const char* dest, bool uninstall, bool use_rename) {
</ins><span class="cx">   // We create a new directory instead of renaming the
</span><span class="cx">  // existing one, since that would move the entire
</span><span class="cx">  // sub-tree, and lead to a lot of ENOENT errors.
</span><span class="lines">@@ -362,6 +366,10 @@
</span><span class="cx">  char* dstpath;
</span><span class="cx">  join_path(&dstpath, dest, this->path());
</span><span class="cx">  
</span><ins>+  // object changes are expected for some uninstall operations,
+  // otherwise require force flag
+  bool allow_change = (uninstall || force);
+
</ins><span class="cx">   mode_t mode = this->mode() & ALLPERMS;
</span><span class="cx">  uid_t uid = this->uid();
</span><span class="cx">  gid_t gid = this->gid();
</span><span class="lines">@@ -403,7 +411,7 @@
</span><span class="cx">                  if (res == -1) fprintf(stderr, "%s:%d: %s: %s (%d)\n", 
</span><span class="cx">                                                             __FILE__, __LINE__, dstpath, strerror(errno), 
</span><span class="cx">                                                             errno);
</span><del>-               } else if (force) {
</del><ins>+                } else if (allow_change) {
</ins><span class="cx">                   // this could be bad, so require the force option
</span><span class="cx">                  IF_DEBUG("[install] original node is a file, we need to replace " \
</span><span class="cx">                                   "with a directory \n");
</span><span class="lines">@@ -415,7 +423,7 @@
</span><span class="cx">                                                             __FILE__, __LINE__, dstpath, strerror(errno), 
</span><span class="cx">                                                             errno);
</span><span class="cx">          }
</span><del>-       } else if (force && res == -1 && errno == ENOTDIR) {
</del><ins>+        } else if (allow_change && res == -1 && errno == ENOTDIR) {
</ins><span class="cx">           // some part of destination path is not a directory
</span><span class="cx">          IF_DEBUG("[install] Directory::install ENOTDIR \n");
</span><span class="cx">  } else if (res == -1) {
</span></span></pre></div>
<a id="trunkdarwinupFileh"></a>
<div class="modfile"><h4>Modified: trunk/darwinup/File.h (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinup/File.h    2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinup/File.h       2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -172,9 +172,9 @@
</span><span class="cx">  // Installs the file from the archive into the prefix
</span><span class="cx">  // i.e., for regular files:
</span><span class="cx">  // rename(prefix + this->archive()->uuid() + this->path(), dest + this->path());
</span><del>-       virtual int install(const char* prefix, const char* dest);
</del><ins>+        virtual int install(const char* prefix, const char* dest, bool uninstall);
</ins><span class="cx">   // only used for directories
</span><del>-       virtual int dirrename(const char* prefix, const char* dest);
</del><ins>+        virtual int dirrename(const char* prefix, const char* dest, bool uninstall);
</ins><span class="cx">   
</span><span class="cx">  // Sets the mode, uid, and gid of the file in the dest path
</span><span class="cx">  // XXX: rename as repair()?
</span><span class="lines">@@ -243,9 +243,9 @@
</span><span class="cx"> struct Directory : File {
</span><span class="cx">  Directory(Archive* archive, FTSENT* ent);
</span><span class="cx">  Directory(uint64_t serial, Archive* archive, uint32_t info, const char* path, mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest);
</span><del>-       virtual int install(const char* prefix, const char* dest);
-       virtual int dirrename(const char* prefix, const char* dest);
-       int _install(const char* prefix, const char* dest, bool use_rename);
</del><ins>+        virtual int install(const char* prefix, const char* dest, bool uninstall);
+       virtual int dirrename(const char* prefix, const char* dest, bool uninstall);
+       int _install(const char* prefix, const char* dest, bool uninstall, bool use_rename);
</ins><span class="cx">   virtual int remove();
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkdarwinupmaincpp"></a>
<div class="modfile"><h4>Modified: trunk/darwinup/main.cpp (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinup/main.cpp  2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinup/main.cpp     2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -245,10 +245,6 @@
</span><span class="cx">                          res = depot->process_archive(argv[0], argv[i]);
</span><span class="cx">                  } else if (strcmp(argv[0], "uninstall") == 0) {
</span><span class="cx">                          if (i==1 && depot->initialize(true)) exit(15);
</span><del>-                               // uninstall is always in force mode so it can
-                               // uninstall archives that were installed under
-                               // force mode
-                               force = 1;
</del><span class="cx">                           res = depot->process_archive(argv[0], argv[i]);
</span><span class="cx">                  } else if (strcmp(argv[0], "verify") == 0) {
</span><span class="cx">                          if (i==1 && depot->initialize(true)) exit(16);
</span></span></pre></div>
<a id="trunkdarwinupredo_prebindingh"></a>
<div class="delfile"><h4>Deleted: trunk/darwinup/redo_prebinding.h (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/darwinup/redo_prebinding.h 2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/darwinup/redo_prebinding.h    2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,273 +0,0 @@
</span><del>-/*
- * Copyright (c) 2005-2010 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_BSD_LICENSE_HEADER_START@
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @APPLE_BSD_LICENSE_HEADER_END@
- */
-#define REDO_PREBINDING_VERSION 2
-#include <mach/machine.h>
-/*
- * For all APIs in this file the parameters program_name and error_message
- * are used the same.  For unrecoverable resource errors like being unable to
- * allocate memory each API prints a message to stderr precede with program_name
- * then calls exit(2) with the value EXIT_FAILURE.  If an API is unsuccessful
- * and if error_message pass to it is not NULL it is set to a malloc(3)'ed
- * buffer with a NULL terminated string with the error message.  For all APIs 
- * when they return they release all resources (memory, open file descriptors,
- * etc). 
- * 
- * The file_name parameter for these APIs may be of the form "foo(bar)" which is
- * NOT interpreted as an archive name and a member name in that archive.  As
- * these API deal with prebinding and prebound binaries ready for execution
- * can't be in archives.
- * 
- * If the executable_path parameter for these APIs is not NULL it is used for
- * any dependent library has a path that starts with "@executable_path". Then
- * "@executable_path" is replaced with executable_path. 
- * 
- * If the root_dir parameter is not NULL it is prepended to all the rooted
- * dependent library paths. 
- */
-
-/*
- * dependent_libs() takes a file_name of a binary and returns a malloc(3)'ed
- * array of pointers (NULL terminated) to names (also malloc(3)'ed and '\0'
- * terminated names) of all the dependent libraries for that binary (not
- * recursive) for all of the architectures of that binary.  If successful
- * dependent_libs() returns a non NULL value (at minimum a pointer to one NULL
- * pointer). If unsuccessful dependent_libs() returns NULL.
- */ 
-extern
-char **
-dependent_libs(
-const char *file_name,
-const char *program_name,
-char **error_message);
-
-/*
- * install_name() takes a file_name of a binary and returns a malloc(3)'ed
- * pointer to a NULL terminated string containing the install_name value for
- * the binary. If unsuccessful install_name() returns NULL.  In particular,
- * NULL is returned if the binary is not a dylib and there is no error_message
- * set.  If the all of the arch's are dylibs but all the install names don't
- * match NULL is returned and a error_message is set.  If some but not all of
- * the archs are dylibs NULL is returned and a error_message is set.
- */ 
-extern
-char *
-install_name(
-const char *file_name,
-const char *program_name,
-char **error_message);
-
-/* return values for redo_prebinding() */
-enum redo_prebinding_retval {
-    REDO_PREBINDING_SUCCESS,
-    REDO_PREBINDING_FAILURE,
-    /* the following can only be returned if the parameter only_if_needed set */
-    REDO_PREBINDING_NOT_NEEDED,
-    REDO_PREBINDING_NOT_PREBOUND,
-    REDO_PREBINDING_NEEDS_REBUILDING
-};
-
-/*
- * redo_prebinding() takes a file_name of a binary and redoes the prebinding on
- * it.  If output_file is not NULL the update file is written to output_file,
- * if not it is written to file_name.  If redo_prebinding() is successful it
- * returns REDO_PREBINDING_SUCCESS otherwise it returns REDO_PREBINDING_FAILURE.
- * If the parameter allow_missing_architectures is zero and not all
- * architectures can be updated it is not successful and nothing is done and
- * this returns REDO_PREBINDING_FAILURE.  If the parameter
- * allow_missing_architectures is non-zero then only problems with missing
- * architectures for the architecure of the cputype specified by 
- * allow_missing_architectures will cause this call to fail.  Other
- * architectures that could not be prebound due to missing architectures in
- * depending libraries will not have their prebinding updated but will not
- * cause this call to fail.
- * If the slide_to_address parameter is non-zero and the binary is a
- * dynamic library it is relocated to have that has its prefered address.  If
- * only_if_needed is non-zero the prebinding is checked first and only done if
- * needed.  The checking includes checking the prefered address against the
- * slide_to_address value if it is non-zero.  If only_if_needed is non-zero
- * and the prebinding does not have to be redone REDO_PREBINDING_NOT_NEEDED is
- * returned, if the binary is not prebound REDO_PREBINDING_NOT_PREBOUND is
- * returned and if the new load commands do not fit in the binary and it needs
- * to be rebuilt REDO_PREBINDING_NEEDS_REBUILDING is returned.
- * If zero_out_prebind_checksum is non-zero then the cksum field of the
- * LC_PREBIND_CKSUM load command (if any) is set to zero on output (this should
- * always be set by B&I tools and never set by the update_prebinding(1)
- * command).
- * If throttle is non-NULL it points to a value of the maximum bytes per second
- * to use for writting the output.  If the value is ULONG_MAX then the actual
- * bytes per second is returned indirectly through *throttle.
- */
-extern 
-enum redo_prebinding_retval
-redo_prebinding(
-const char *file_name,
-const char *executable_path,
-const char *root_dir,
-const char *output_file,
-const char *program_name,
-char **error_message,
-unsigned long slide_to_address,
-int only_if_needed,
-int zero_out_prebind_checksum,
-cpu_type_t allow_missing_architectures,
-unsigned long *throttle);
-
-
-/* return values for needs_redo_prebinding() */
-enum needs_redo_prebinding_retval {
-    PREBINDING_UPTODATE,  /* a binary who's prebinding is up todate */
-    PREBINDING_OUTOFDATE, /* a binary who's prebinding is out of date */
-    NOT_PREBOUND,        /* a binary, but not built prebound */
-    NOT_PREBINDABLE,     /* not a binary or statically linked,
-                            prebinding does not apply */
-    PREBINDING_UNKNOWN   /* a binary who's prebinding can't be determined
-                            because it is malformed, a library it depends
-                            on is missing, etc. */
-};
-
-/*
- * needs_redo_prebinding() takes a file_name and determines if it is a binary
- * and if its prebinding is uptodate.  It returns one of the return values
- * above depending on the state of the binary and libraries. If the parameter
- * allow_missing_architectures is zero then the value returned is based on the
- * first architecture for fat files.  If the parameter
- * allow_missing_architectures is non-zero then the value returned is based on
- * the cputype specified by allow_missing_architectures.  If that architecture
- * is not present then PREBINDING_UPTODATE is returned.  If the parameter
- * expected_address is not zero and the binary is a dynamic library then the
- * library is checked to see if it is at the expected_address if not the
- * prebinding is assumed to be out of date and PREBINDING_OUTOFDATE is returned.
- */
-extern
-enum needs_redo_prebinding_retval
-needs_redo_prebinding(
-const char *file_name,
-const char *executable_path,
-const char *root_dir,
-const char *program_name,
-char **error_message,
-unsigned long expected_address,
-cpu_type_t allow_missing_architectures);
-
-
-/*
- * unprebind() takes a file_name of a binary and resets or removes prebinding
- * information from it.  If inbuf is non-NULL, the memory pointed to by inbuf is
- * used as the input file contents.  Otherwise, the contents are loaded from 
- * the file at path file_name.  Even if inbuf is non-NULL, a file_name 
- * parameter should be specified for error reporting.  Similarly, if outbuf is 
- * non-NULL, upon return, outbuf will point to a buffer containing the 
- * unprebound binary and outlen will point to the length of the output buffer.  
- * This buffer is vm_allocate'd and therefore should be vm_deallocate'd when it 
- * is no longer needed.  If outbuf is NULL, and output_file is not NULL the 
- * update file is written to output_file, if outbuf is NULL and output_file is 
- * NULL, it is written to file_name.  
- * If unprebind() is successful it returns REDO_PREBINDING_SUCCESS otherwise it
- * returns REDO_PREBINDING_FAILURE If the binary is already unprebound (i.e. it
- * has the MH_PREBINDABLE flag set) then REDO_PREBINDING_NOT_NEEDED is returned.
- * If the binary is not prebound and not prebindable, 
- * REDO_PREBINDING_NOT_PREBOUND is returned.  If zero_checksum is non-zero then
- * the cksum field the LC_PREBIND_CKSUM load command (if any) is set to zero on
- * output, otherwise it is left alone.
- * Unprebinding slides dynamic libraries to address zero, resets prebound 
- * symbols to address zero and type undefined, resets symbol pointers, removes 
- * LC_PREBOUND_DYLIB commands, resets library timestamps, resets two-level hints
- * and updates relocation entries if necessary.  Unprebound binaries have
- * the MH_PREBINDABLE flag set, but not MH_PREBOUND.  It will also set the the
- * MH_ALLMODSBOUND flag if all two-level libraries were used and all modules
- * were found to be bound in the LC_PREBOUND_DYLIB commands.
- * As unprebinding is intended to produce a canonical Mach-O
- * binary, bundles and non-prebound executables and dylibs are acceptable
- * as input.  For these files, the  unprebind operation will zero library 
- * time stamps and version numbers and zero entries in the two-level hints
- * table.  These files will not gain the MH_PREBINDABLE flag.
- * All resulting binaries successfully processed by unprebind() will have
- * the MH_CANONICAL flag.
- */
-extern
-enum redo_prebinding_retval
-unprebind(
-const char *file_name,
-const char *output_file,
-const char *program_name,
-char **error_message,
-int zero_checksum,
-void *inbuf,
-unsigned long inlen,
-void **outbuf,
-unsigned long *outlen);
-
-enum object_file_type_retval {
-    OFT_OTHER,
-    OFT_EXECUTABLE,
-    OFT_DYLIB,
-    OFT_BUNDLE,
-    OFT_ARCHIVE,
-    OFT_INCONSISTENT,
-    OFT_FILE_ERROR
-};
-
-/*
- * object_file_type() takes a file_name and determines what type of object
- * file it is.  If it is a fat file and the architectures are not of the same
- * type then OFT_INCONSISTENT is returned.  If the file_name can't be opened,
- * read or malformed then OFT_FILE_ERROR is returned.
- */
-extern
-enum object_file_type_retval
-object_file_type(
-const char *file_name,
-const char *program_name,
-char **error_message);
-
-struct prebind_cksum_arch {
-    cpu_type_t cputype;                /* cpu specifier */
-    cpu_subtype_t cpusubtype;  /* machine specifier */
-    unsigned long has_cksum;   /* 1 if the arch as an LC_PREBIND_CKSUM */
-    unsigned long cksum;       /* value of the cksum in LC_PREBIND_CKSUM */
-};
-
-/*
- * get_prebind_cksums() takes a file_name that is a Mach-O file or fat file
- * containing Mach-O files and returns a malloc(3)'ed array of
- * prebind_cksum_arch structs indirectly through the cksums parameter.  The
- * number of prebind_cksum_arch structs is returned indirectly through the
- * ncksums parameter.  If successful it returns zero else it returns non-zero.
- */
-extern
-int
-get_prebind_cksums(
-const char *file_name,
-struct prebind_cksum_arch **cksums,
-unsigned long *ncksums,
-const char *program_name,
-char **error_message);
</del></span></pre></div>
<a id="trunktestingdarwintraceclosetest"></a>
<div class="delfile"><h4>Deleted: trunk/testing/darwintrace/close-test (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- branches/PR-8817822/testing/darwintrace/close-test       2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/testing/darwintrace/close-test        2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,16 +0,0 @@
</span><del>-#!/usr/bin/env python
-import os
-for i in range(101,200):
-       print " ... trying to close(%s)" % i
-       try:
-               os.close(i)
-               print " ... closed %s" % i
-               exit(1)
-       except Exception, e:
-               # test for EBADF
-               if e.errno == 9:
-                       print " ... got EBADF as expected"
-               else:
-                       print " ... got wrong error back: %s" % e
-                       exit(2)
-exit(0)
</del></span></pre></div>
<a id="trunktestingdarwintraceclosetestfromrev933branchesPR8817822testingdarwintraceclosetest"></a>
<div class="copfile"><h4>Copied: trunk/testing/darwintrace/close-test (from rev 933, branches/PR-8817822/testing/darwintrace/close-test) (0 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/testing/darwintrace/close-test                             (rev 0)
+++ trunk/testing/darwintrace/close-test        2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+#!/usr/bin/env python
+import os
+for i in range(101,200):
+       print " ... trying to close(%s)" % i
+       try:
+               os.close(i)
+               print " ... closed %s" % i
+               exit(1)
+       except Exception, e:
+               # test for EBADF
+               if e.errno == 9:
+                       print " ... got EBADF as expected"
+               else:
+                       print " ... got wrong error back: %s" % e
+                       exit(2)
+exit(0)
</ins></span></pre></div>
<a id="trunktestingdarwintraceexec"></a>
<div class="delfile"><h4>Deleted: trunk/testing/darwintrace/exec (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- branches/PR-8817822/testing/darwintrace/exec     2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/testing/darwintrace/exec      2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,3 +0,0 @@
</span><del>-#!/usr/bin/env python
-import subprocess, sys
-subprocess.call(sys.argv[1:])
</del></span></pre></div>
<a id="trunktestingdarwintraceexecfromrev933branchesPR8817822testingdarwintraceexec"></a>
<div class="copfile"><h4>Copied: trunk/testing/darwintrace/exec (from rev 933, branches/PR-8817822/testing/darwintrace/exec) (0 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/testing/darwintrace/exec                           (rev 0)
+++ trunk/testing/darwintrace/exec      2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+#!/usr/bin/env python
+import subprocess, sys
+subprocess.call(sys.argv[1:])
</ins></span></pre></div>
<a id="trunktestingdarwintracerealpath"></a>
<div class="delfile"><h4>Deleted: trunk/testing/darwintrace/realpath (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- branches/PR-8817822/testing/darwintrace/realpath 2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/testing/darwintrace/realpath  2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,4 +0,0 @@
</span><del>-#!/usr/bin/env python
-import os
-import sys
-print os.path.realpath(sys.argv[1])
</del></span></pre></div>
<a id="trunktestingdarwintracerealpathfromrev933branchesPR8817822testingdarwintracerealpath"></a>
<div class="copfile"><h4>Copied: trunk/testing/darwintrace/realpath (from rev 933, branches/PR-8817822/testing/darwintrace/realpath) (0 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/testing/darwintrace/realpath                               (rev 0)
+++ trunk/testing/darwintrace/realpath  2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+#!/usr/bin/env python
+import os
+import sys
+print os.path.realpath(sys.argv[1])
</ins></span></pre></div>
<a id="trunktestingdarwintraceredirectiontest"></a>
<div class="delfile"><h4>Deleted: trunk/testing/darwintrace/redirection-test (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- branches/PR-8817822/testing/darwintrace/redirection-test 2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/testing/darwintrace/redirection-test  2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,5 +0,0 @@
</span><del>-#!/bin/bash
-PREFIX=$1
-ROOT=$PREFIX/root
-
-/bin/cat $PREFIX/datafile
</del></span></pre></div>
<a id="trunktestingdarwintraceredirectiontestfromrev933branchesPR8817822testingdarwintraceredirectiontest"></a>
<div class="copfile"><h4>Copied: trunk/testing/darwintrace/redirection-test (from rev 933, branches/PR-8817822/testing/darwintrace/redirection-test) (0 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/testing/darwintrace/redirection-test                               (rev 0)
+++ trunk/testing/darwintrace/redirection-test  2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+#!/bin/bash
+PREFIX=$1
+ROOT=$PREFIX/root
+
+/bin/cat $PREFIX/datafile
</ins></span></pre></div>
<a id="trunktestingdarwintraceruntestssh"></a>
<div class="delfile"><h4>Deleted: trunk/testing/darwintrace/run-tests.sh (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- branches/PR-8817822/testing/darwintrace/run-tests.sh     2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/testing/darwintrace/run-tests.sh      2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -1,130 +0,0 @@
</span><del>-#!/bin/bash
-#
-# Run test suite for darwintrace
-#
-set -e
-set -x
-pushd $(dirname $0) >> /dev/null
-
-PREFIX=/tmp/testing/darwintrace
-LOGS=$PREFIX/logs
-ROOT=$PREFIX/root
-BIN=$PREFIX/bin
-
-DARWINTRACE="/usr/local/share/darwinbuild/darwintrace.dylib"
-export DYLD_INSERT_LIBRARIES=$DARWINTRACE
-export DARWINTRACE_LOG="${LOGS}/trace.log"
-
-echo "INFO: Cleaning up testing area ..."
-rm -rf $PREFIX
-mkdir -p $PREFIX
-mkdir -p $ROOT
-mkdir -p $LOGS
-mkdir -p $BIN
-
-REALPATH=$BIN/realpath
-cp realpath $REALPATH
-
-EXEC=$BIN/exec
-cp exec $EXEC
-
-CLOSETEST=$BIN/close-test
-cp close-test $CLOSETEST
-
-REDIRECTIONTEST=$BIN/redirection-test
-cp redirection-test $REDIRECTIONTEST
-
-
-echo "========== TEST: execve() Trace =========="
-for FILE in cp echo chmod  date df expr hostname ls ps pwd test;
-do
-       # some of these commands will error out when run without arguments,
-       #  so just ignore that since all we want is the execve() call to happen
-       set +e  
-       $EXEC /bin/$FILE 2>&1 >> /dev/null
-       set -e
-       LOGPAT="Python\[[0-9]+\][[:space:]]execve[[:space:]]/bin/${FILE}"
-       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
-  test $C -eq 1
-done
-set -e
-
-
-echo "========== TEST: close() Safety =========="
-$CLOSETEST
-
-
-echo "========== TEST: open() Trace =========="
-for FILE in /System/Library/LaunchDaemons/*.plist;
-do
-       cat $FILE >> /dev/null;
-       RP=$($REALPATH $FILE);
-       LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
-       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
-  test $C -eq 1
-done
-
-
-echo "========== TEST: readlink() Trace =========="
-for FILE in $(find /System/Library/Frameworks/*Foundation.framework -type l | xargs);
-do
-       readlink $FILE
-       LOGPAT="readlink\[[0-9]+\][[:space:]]readlink[[:space:]]${FILE}"
-       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
-  test $C -eq 1
-done
-
-
-echo "========== TEST: ROOT Ignores =========="
-export DARWINTRACE_IGNORE_ROOTS=""
-export DSTROOT="/System/Library/LaunchAgents"
-for FILE in /var/log/*.log;
-do
-       cat $FILE >> /dev/null;
-       RP=$($REALPATH $FILE);
-       LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
-       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
-  test $C -eq 1
-done
-
-for FILE in /System/Library/LaunchAgents/com.apple.*;
-do
-       cat $FILE >> /dev/null;
-       RP=$($REALPATH $FILE);
-       LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
-  set +e
-       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
-  set -e
-  test $C -eq 0
-done
-unset DARWINTRACE_IGNORE_ROOTS
-unset DSTROOT
-
-
-echo "========== TEST: Redirection =========="
-mkdir -p $ROOT/$PREFIX
-mkdir -p $ROOT/usr/lib
-cp /usr/lib/libSystem.B.dylib $ROOT/usr/lib/libSystem.B.dylib
-mkdir -p $ROOT/bin
-cp /bin/cat $ROOT/bin/cat
-echo "Outside of root" > $PREFIX/datafile
-echo "Inside of root" > $ROOT/$PREFIX/datafile
-export DARWINTRACE_REDIRECT="${ROOT}"
-export DARWIN_BUILDROOT="${ROOT}"
-$REDIRECTIONTEST $PREFIX
-unset DARWINTRACE_REDIRECT
-unset DARWIN_BUILDROOT
-# test that execve(/bin/cat) was redirected
-RP=$($REALPATH ${ROOT}/bin/cat)
-LOGPAT="bash\[[0-9]+\][[:space:]]execve[[:space:]]${RP}"
-C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
-test $C -eq 1
-# test that open(/tmp/.../datafile) does not get redirected
-#  since /tmp/ is one of the redirection exceptions
-RP=$($REALPATH ${PREFIX}/datafile)
-LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
-C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
-test $C -eq 1
-
-popd >> /dev/null
-echo "INFO: Done testing!"
</del></span></pre></div>
<a id="trunktestingdarwintraceruntestsshfromrev933branchesPR8817822testingdarwintraceruntestssh"></a>
<div class="copfile"><h4>Copied: trunk/testing/darwintrace/run-tests.sh (from rev 933, branches/PR-8817822/testing/darwintrace/run-tests.sh) (0 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/testing/darwintrace/run-tests.sh                           (rev 0)
+++ trunk/testing/darwintrace/run-tests.sh      2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -0,0 +1,130 @@
</span><ins>+#!/bin/bash
+#
+# Run test suite for darwintrace
+#
+set -e
+set -x
+pushd $(dirname $0) >> /dev/null
+
+PREFIX=/tmp/testing/darwintrace
+LOGS=$PREFIX/logs
+ROOT=$PREFIX/root
+BIN=$PREFIX/bin
+
+DARWINTRACE="/usr/local/share/darwinbuild/darwintrace.dylib"
+export DYLD_INSERT_LIBRARIES=$DARWINTRACE
+export DARWINTRACE_LOG="${LOGS}/trace.log"
+
+echo "INFO: Cleaning up testing area ..."
+rm -rf $PREFIX
+mkdir -p $PREFIX
+mkdir -p $ROOT
+mkdir -p $LOGS
+mkdir -p $BIN
+
+REALPATH=$BIN/realpath
+cp realpath $REALPATH
+
+EXEC=$BIN/exec
+cp exec $EXEC
+
+CLOSETEST=$BIN/close-test
+cp close-test $CLOSETEST
+
+REDIRECTIONTEST=$BIN/redirection-test
+cp redirection-test $REDIRECTIONTEST
+
+
+echo "========== TEST: execve() Trace =========="
+for FILE in cp echo chmod  date df expr hostname ls ps pwd test;
+do
+       # some of these commands will error out when run without arguments,
+       #  so just ignore that since all we want is the execve() call to happen
+       set +e  
+       $EXEC /bin/$FILE 2>&1 >> /dev/null
+       set -e
+       LOGPAT="Python\[[0-9]+\][[:space:]]execve[[:space:]]/bin/${FILE}"
+       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+  test $C -eq 1
+done
+set -e
+
+
+echo "========== TEST: close() Safety =========="
+$CLOSETEST
+
+
+echo "========== TEST: open() Trace =========="
+for FILE in /System/Library/LaunchDaemons/*.plist;
+do
+       cat $FILE >> /dev/null;
+       RP=$($REALPATH $FILE);
+       LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
+       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+  test $C -eq 1
+done
+
+
+echo "========== TEST: readlink() Trace =========="
+for FILE in $(find /System/Library/Frameworks/*Foundation.framework -type l | xargs);
+do
+       readlink $FILE
+       LOGPAT="readlink\[[0-9]+\][[:space:]]readlink[[:space:]]${FILE}"
+       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+  test $C -eq 1
+done
+
+
+echo "========== TEST: ROOT Ignores =========="
+export DARWINTRACE_IGNORE_ROOTS=""
+export DSTROOT="/System/Library/LaunchAgents"
+for FILE in /var/log/*.log;
+do
+       cat $FILE >> /dev/null;
+       RP=$($REALPATH $FILE);
+       LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
+       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+  test $C -eq 1
+done
+
+for FILE in /System/Library/LaunchAgents/com.apple.*;
+do
+       cat $FILE >> /dev/null;
+       RP=$($REALPATH $FILE);
+       LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
+  set +e
+       C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+  set -e
+  test $C -eq 0
+done
+unset DARWINTRACE_IGNORE_ROOTS
+unset DSTROOT
+
+
+echo "========== TEST: Redirection =========="
+mkdir -p $ROOT/$PREFIX
+mkdir -p $ROOT/usr/lib
+cp /usr/lib/libSystem.B.dylib $ROOT/usr/lib/libSystem.B.dylib
+mkdir -p $ROOT/bin
+cp /bin/cat $ROOT/bin/cat
+echo "Outside of root" > $PREFIX/datafile
+echo "Inside of root" > $ROOT/$PREFIX/datafile
+export DARWINTRACE_REDIRECT="${ROOT}"
+export DARWIN_BUILDROOT="${ROOT}"
+$REDIRECTIONTEST $PREFIX
+unset DARWINTRACE_REDIRECT
+unset DARWIN_BUILDROOT
+# test that execve(/bin/cat) was redirected
+RP=$($REALPATH ${ROOT}/bin/cat)
+LOGPAT="bash\[[0-9]+\][[:space:]]execve[[:space:]]${RP}"
+C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+test $C -eq 1
+# test that open(/tmp/.../datafile) does not get redirected
+#  since /tmp/ is one of the redirection exceptions
+RP=$($REALPATH ${PREFIX}/datafile)
+LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
+C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+test $C -eq 1
+
+popd >> /dev/null
+echo "INFO: Done testing!"
</ins></span></pre></div>
<a id="trunktestingdarwinupruntestssh"></a>
<div class="modfile"><h4>Modified: trunk/testing/darwinup/run-tests.sh (933 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/testing/darwinup/run-tests.sh      2011-02-10 15:12:58 UTC (rev 933)
+++ trunk/testing/darwinup/run-tests.sh 2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -97,6 +97,18 @@
</span><span class="cx">  done
</span><span class="cx"> fi
</span><span class="cx"> 
</span><ins>+echo "========== TEST: Test uninstall build check safety =========="
+$DARWINUP install $PREFIX/root2
+sqlite3 $DEST/.DarwinDepot/Database-V100 "UPDATE archives SET osbuild = '$(sw_vers -buildVersion)X'"
+set +e
+$DARWINUP uninstall root2
+if [ $? -eq 0 ]; then exit 1; fi
+set -e
+$DARWINUP -f uninstall root2
+echo "DIFF: diffing original test files to dest (should be no diffs) ..."
+$DIFF $ORIG $DEST 2>&1
+
+
</ins><span class="cx"> echo "========== TEST: Try installing a symlink-to-directory =========="
</span><span class="cx"> ln -s root2 $PREFIX/root_link
</span><span class="cx"> # test without trailing slash
</span></span></pre></div>
<a id="trunktestingrunalltestsshfromrev933branchesPR8817822testingrunalltestssh"></a>
<div class="copfile"><h4>Copied: trunk/testing/run-all-tests.sh (from rev 933, branches/PR-8817822/testing/run-all-tests.sh) (0 => 934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/testing/run-all-tests.sh                           (rev 0)
+++ trunk/testing/run-all-tests.sh      2011-02-10 15:22:14 UTC (rev 934)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+#!/bin/bash
+set -e
+pushd $(dirname $0) >> /dev/null
+
+for X in *;
+do
+       if [ -d $X ]; then
+               $X/run-tests.sh
+       fi
+done
+
+echo "INFO: All testing completed!"
</ins></span></pre>
</div>
</div>

</body>
</html>