Skip to content

Conversation

@sabiwara
Copy link
Contributor

Tentative fix for #14924

I don't like it too much, because we could still have a race condition and the src file could have been removed in between the two calls - but the current code works with two successive calls anyway so it's probably acceptable.

The core issue is that :file.copy, called in do_cp_file, would return {:error, :enoent} in both those cases without allowing us to distinguish:

  • :file.copy(non_existing_file, existing_dir)
  • :file.copy(existing_file, non_existing_dir)

@sabiwara sabiwara merged commit f9745a2 into elixir-lang:main Nov 20, 2025
13 checks passed
@sabiwara sabiwara deleted the fix-cp-r branch November 20, 2025 10:35
@sabiwara
Copy link
Contributor Author

@josevalim OK to backport this too?

@josevalim
Copy link
Member

Yes!

@sabiwara
Copy link
Contributor Author

Backported ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants