[PATCH] D64301: Use `ln -n` to prevent forming a symlink cycle, instead of rm'ing the source

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 7 16:03:30 PDT 2019


thakis created this revision.
thakis added a reviewer: rnk.

This is a better fix for the problem fixed in r334972.

Also remove the rm'ing of the symlink destination that was there to
clean up the bots -- it's over a year later, bots should be happy now.


https://reviews.llvm.org/D64301

Files:
  clang/test/Driver/no-canonical-prefixes.c


Index: clang/test/Driver/no-canonical-prefixes.c
===================================================================
--- clang/test/Driver/no-canonical-prefixes.c
+++ clang/test/Driver/no-canonical-prefixes.c
@@ -1,15 +1,13 @@
 // Due to ln -sf:
 // REQUIRES: shell
-// RUN: rm -rf %t.real
 // RUN: mkdir -p %t.real
 // RUN: cd %t.real
 // RUN: ln -sf %clang test-clang
 // RUN: cd ..
-// Important to remove %t.fake: If it already is a symlink to %t.real when
-// `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself,
-// forming a cycle.
-// RUN: rm -rf %t.fake
-// RUN: ln -sf %t.real %t.fake
+// If %.fake already is a symlink to %t.real when `ln -sf %t.real %t.fake`
+// runs, then that would symlink %t.real to itself, forming a cycle.
+// The `-n` flag prevents this.
+// RUN: ln -sfn %t.real %t.fake
 // RUN: cd %t.fake
 // RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
 // RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=NON-CANONICAL %s


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64301.208302.patch
Type: text/x-patch
Size: 1027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190707/847b0383/attachment-0001.bin>


More information about the cfe-commits mailing list