This is an archive of the discontinued LLVM Phabricator instance.

Use `ln -n` to prevent forming a symlink cycle, instead of rm'ing the source
ClosedPublic

Authored by thakis on Jul 7 2019, 4:01 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

thakis created this revision.Jul 7 2019, 4:01 PM
rnk accepted this revision.Jul 8 2019, 1:31 PM
rnk added a subscriber: zturner.

lgtm

I think @zturner wanted to teach lit to completely remove the Output/ directory for every test so we don't have to deal with stale files from previous tests hanging around. I remember objecting that we can't do that on startup since it's slow and not parallelized. However, I think we could probably add it as an early step to TestRunner.executeShTest so we don't have to add these extra 'rm' commands anymore.

This revision is now accepted and ready to land.Jul 8 2019, 1:31 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 8 2019, 5:37 PM
aganea added a subscriber: aganea.EditedJul 9 2019, 11:25 AM
In D64301#1574304, @rnk wrote:

I think @zturner wanted to teach lit to completely remove the Output/ directory for every test so we don't have to deal with stale files from previous tests hanging around. I remember objecting that we can't do that on startup since it's slow and not parallelized. However, I think we could probably add it as an early step to TestRunner.executeShTest so we don't have to add these extra 'rm' commands anymore.

Just a reminder, the DeleteFile API, and thus rm on Windows are async. There's no guarantee the files were deleted once rm completes. See this. Occasionally, the tests are failing locally on my PC because of that (maybe 1 out of 50 times).

This comment was removed by aganea.

ln -n is not a standard option that is portably supported. I'll be restoring the use of rm (with -f instead of -rf) and the associated comment for removing %t.fake.

ln -n is not a standard option that is portably supported. I'll be restoring the use of rm (with -f instead of -rf) and the associated comment for removing %t.fake.

Which platforms doesn't it work on?

Which platforms doesn't it work on?

ln -n means something different on AIX: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/l_commands/ln.html
-n is not documented as a standard option for the ln utility by POSIX.1-2017: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ln.html

Thanks for sharing! (And for the fix, and apologies for breaking you.)