Skip to content

fs: Avoid resolving symlinks when trashing - #58339

Merged
dinocosta merged 1 commit into
mainfrom
54900-symlink-trashing
Jun 2, 2026
Merged

fs: Avoid resolving symlinks when trashing#58339
dinocosta merged 1 commit into
mainfrom
54900-symlink-trashing

Conversation

@dinocosta

Copy link
Copy Markdown
Member

Use std::path::absolute instead of RealFs::canonicalize to make the path absolute in RealFs::trash as canonicalize also resolves symlinks, so trashing a symlink moved its target to the trash and left the link dangling.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
    • Not applicable as we don't have a good infrastructure for testing RealFs changes without hitting the machine's actual filesystem and testing this on FakeFs implementation wouldn't prevent a future regression, unfortunately.
  • Performance impact has been considered and is acceptable

Closes #54900

Release Notes:

  • Fixed trashing of symlinks in project panel to actually trash the link and not its target.

Use `std::path::absolute` instead of `RealFs::canonicalize` to make the
path absolute in `RealFs::trash` as `canonicalize` also resolves
symlinks, so trashing a symlink moved its target to the trash and left
the link dangling.
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 2, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 2, 2026
@dinocosta
dinocosta added this pull request to the merge queue Jun 2, 2026
@dinocosta dinocosta self-assigned this Jun 2, 2026
Merged via the queue into main with commit 381f2f4 Jun 2, 2026
44 checks passed
@dinocosta
dinocosta deleted the 54900-symlink-trashing branch June 2, 2026 16:43
dandv pushed a commit to dandv/zed that referenced this pull request Jun 3, 2026
Use `std::path::absolute` instead of `RealFs::canonicalize` to make the
path absolute in `RealFs::trash` as `canonicalize` also resolves
symlinks, so trashing a symlink moved its target to the trash and left
the link dangling.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- Not applicable as we don't have a good infrastructure for testing
`RealFs` changes without hitting the machine's actual filesystem and
testing this on `FakeFs` implementation wouldn't prevent a future
regression, unfortunately.
- [x] Performance impact has been considered and is acceptable

Closes zed-industries#54900 

Release Notes:

- Fixed trashing of symlinks in project panel to actually trash the link
and not its target.
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
Use `std::path::absolute` instead of `RealFs::canonicalize` to make the
path absolute in `RealFs::trash` as `canonicalize` also resolves
symlinks, so trashing a symlink moved its target to the trash and left
the link dangling.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- Not applicable as we don't have a good infrastructure for testing
`RealFs` changes without hitting the machine's actual filesystem and
testing this on `FakeFs` implementation wouldn't prevent a future
regression, unfortunately.
- [x] Performance impact has been considered and is acceptable

Closes zed-industries#54900 

Release Notes:

- Fixed trashing of symlinks in project panel to actually trash the link
and not its target.
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Use `std::path::absolute` instead of `RealFs::canonicalize` to make the
path absolute in `RealFs::trash` as `canonicalize` also resolves
symlinks, so trashing a symlink moved its target to the trash and left
the link dangling.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- Not applicable as we don't have a good infrastructure for testing
`RealFs` changes without hitting the machine's actual filesystem and
testing this on `FakeFs` implementation wouldn't prevent a future
regression, unfortunately.
- [x] Performance impact has been considered and is acceptable

Closes zed-industries#54900 

Release Notes:

- Fixed trashing of symlinks in project panel to actually trash the link
and not its target.
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Use `std::path::absolute` instead of `RealFs::canonicalize` to make the
path absolute in `RealFs::trash` as `canonicalize` also resolves
symlinks, so trashing a symlink moved its target to the trash and left
the link dangling.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- Not applicable as we don't have a good infrastructure for testing
`RealFs` changes without hitting the machine's actual filesystem and
testing this on `FakeFs` implementation wouldn't prevent a future
regression, unfortunately.
- [x] Performance impact has been considered and is acceptable

Closes zed-industries#54900 

Release Notes:

- Fixed trashing of symlinks in project panel to actually trash the link
and not its target.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trashing a symlink to a folder trashes the target folder, not the symlink

2 participants