# fs: Fix no-overwrite rename races \(\#51090\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/4e9e94435751b173e5f3b6c576f4a28638070ce8)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 4e9e94435751b173e5f3b6c576f4a28638070ce8

Requested commit: 4e9e94435751b173e5f3b6c576f4a28638070ce8

Commit: 4e9e94435751b173e5f3b6c576f4a28638070ce8

Tree: f6b73e657261442e73f74307d4c6e39b4b2a7be4

Author: Smit Barmase

Committer: GitHub

## Message

```
fs: Fix no-overwrite rename races (#51090)

Closes #46661

This PR changes `fs.rename` to use the platform’s atomic no-overwrite
rename on all platforms when `overwrite` is `false`. This fixes a case
where concurrent renames to the same target could race past a separate
metadata check and end up overwriting each other.

In Project Panel, we can still rename entries in parallel without
worrying about OS internals not handling it correctly or making these
renames sequential.

Release Notes:

- Fixed an issue in the Project Panel where conflicting file moves could
overwrite each other instead of leaving the losing file in place.
```

## Parents

- [0634ddb960be2ec6d3fadf4e1e6a5ba703237d0f](https://git.cafe/gitcafe/zed/commit/0634ddb960be2ec6d3fadf4e1e6a5ba703237d0f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/4e9e94435751b173e5f3b6c576f4a28638070ce8?format=markdown)
