FileState/Copy task support for symlinks
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
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 `` 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`](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364952%28v=vs.85%29.aspx) instead of [`GetFileAttributesEx`](https://msdn.microsoft.com/en-us/library/windows/desktop/aa364946%28v=vs.85%29.aspx), 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.