We have assets backed by Perforce that we need to duplicate into another folder hiearchy. To do this we use mklink /H to create hard links to the source files. Our makefile deletes this folder hierarchy every build, and relinks the files that are present. But I'm seeing that rmdir (or del) both change the read-only state of the source files when deleting the hard links. This then messes with Perforce's read-only tracking state, and it can't clobber the files as a result.
How is it that rmdir/del can't just delete the hardlink without modifying the attribute state?
This is on Win10.
Version 10.0.19045 Build 19045
Here's an easy repro. Create src/test.txt file and set it read-only. Then run this script 2x. Note that the rmdir changes the src/test.txt read-only state to false. That should not happen.
test.bat
rmdir /S /Q dst
mkdir dst
mklink test.txt ..\src.test\text.txt
Also why does mklink symlink creation fail for the same dual workingDir case that hard links only work for. This whole realtive to link also breaks any code that was using ln -s for posix. I don't have a path relative to the link, I just have the two folders of where the files are.
rem this succeeds, but has the read-only bug
rem mklink /H dst\test.txt src\test.txt
rem this succeeds, but creates an invalid link
rem mklink dst\test.txt src\test.txt
rem this works, but means a massive change to code using ln -s or mklink /H
rem mklink dst\test.txt ..\src\test.txt