You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Copy task currently uses a FileState which is a wrapper around a WIN32_FILE_ATTRIBUTE_DATA. That allows it to populate timestamps + file size with a single syscall, but if the input is a symlink, the data will be for the symlink, not its target. That means that additional work may be done in a <Copy SkipUnchangedFiles="true" /> invocation, because the timestamp of the copy destination from last time will match the symlink target, not the symlink itself.
This is not a terrible problem, because Copy doesn't behave incrementally based on timestamps (like target execution). It uses timestamp + file size as a proxy for identicality. If it looks at a symlink, the timestamp and file size will differ, so the copy will happen. Since the copy destination's timestamp will match the source file's after the copy, this won't cause a rebuild cascade, because anything downstream that consumes the copied file will see the correct timestamp.
It's tempting to say that we could just call GetFileInformationByHandle instead of GetFileAttributesEx, but BY_HANDLE_FILE_INFORMATION doesn't have a size field, so that doesn't get us the full set of data we'd want.
If you use a glob with ** somewhere that references a symlink, we follow that symlink. If that symlink points to a directory above itself, we check all the directories under that, including the same symlink and follow it again and again. I put a fix into FileMatcher.GetFilesRecursive in #7685 that uses an API only introduced in NET6.0, so it's imperfect. It also needs to avoid impairing performance, as that's a very common code path. As a compromise, I didn't address a few cases, as noted in the comments.
Activity
rainersigwald commentedon Jun 16, 2016
More details in #322 (comment)
chamons commentedon Nov 26, 2018
I've worked around this by shelling out to
cp -ron macOS.Forgind commentedon Jun 8, 2022
If you use a glob with ** somewhere that references a symlink, we follow that symlink. If that symlink points to a directory above itself, we check all the directories under that, including the same symlink and follow it again and again. I put a fix into FileMatcher.GetFilesRecursive in #7685 that uses an API only introduced in NET6.0, so it's imperfect. It also needs to avoid impairing performance, as that's a very common code path. As a compromise, I didn't address a few cases, as noted in the comments.