[Swift-commit] r6054 - trunk/libexec

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Nov 17 03:38:55 CST 2012


Author: hategan
Date: 2012-11-17 03:38:47 -0600 (Sat, 17 Nov 2012)
New Revision: 6054

Modified:
   trunk/libexec/_swiftwrap
Log:
be more careful about symbolic links since in certain circumstances long enough chains of links can be created to crash stuff

Modified: trunk/libexec/_swiftwrap
===================================================================
--- trunk/libexec/_swiftwrap	2012-11-17 08:10:08 UTC (rev 6053)
+++ trunk/libexec/_swiftwrap	2012-11-17 09:38:47 UTC (rev 6054)
@@ -421,7 +421,15 @@
 		else
 			[ -f $WFDIR/shared/$L ]
 			checkError 254 "Could not locate input file: $L"
-			ln -s "$WFDIR/shared/$L" "$DIR/$L" 2>&1 >& $INFO
+			# if it's a link, be careful about creating
+			# long link chains because there is a rather low 
+			# limit to how long that chain can be
+			if [ -L $WFDIR/shared/$L ]; then
+				# this might be of questionable portability
+				cp -P "$WFDIR/shared/$L" "$DIR/$L" 2>&1 >& $INFO
+			else
+				ln -s "$WFDIR/shared/$L" "$DIR/$L" 2>&1 >& $INFO
+			fi
 			checkError 254 "Failed to link input file $L"
 			log "Linked input: $WFDIR/shared/$L to $DIR/$L"
 		fi




More information about the Swift-commit mailing list