Skip to content

Conversation

@nickhuang99
Copy link

  1. using std::filesystem's read_link.
  2. This is an improvement so only test when failure to avoid expensive system call.
  3. Hopefully this avoid race condition.

Copy link
Contributor

@mgautierfr mgautierfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On code side, only a small change needed.

On the functionality itself, I'm a bit reluctant as we should not have this kind of situation. If symlinks already exist, there is a lot of probability that contents already exist too. Only checking for symlink is useless here. And if we overwrite content/symlink we should probably have a option at command line level to allow it.

But anyway, even with my concerns, I don't see how this can harm so I will not block this PR.

write_to_file(directory + SEPARATOR, outputPath, content.c_str(), content.size());
}

inline static bool testSymLink(const std::string& sym, const std::string& target) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testSymlink convey very few information. (What is tested ?)

It would be better to rename it to checkSymlinkTarget or symlinkPointsTo.

@kelson42
Copy link
Contributor

@nickhuang99 Have you abandoned this PR? Can you please answer feedback from @mgautierfr ?

@kelson42 kelson42 force-pushed the testSymlinkAfterFail branch from 67975bf to b1b1ad0 Compare November 5, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants