Skip to content

Remove std::fs::read_link in fs#50974

Merged
reflectronic merged 2 commits intozed-industries:mainfrom
foxmsft:foxmsft/devdrive-canonicalize
Mar 15, 2026
Merged

Remove std::fs::read_link in fs#50974
reflectronic merged 2 commits intozed-industries:mainfrom
foxmsft:foxmsft/devdrive-canonicalize

Conversation

@foxmsft
Copy link
Copy Markdown
Contributor

@foxmsft foxmsft commented Mar 6, 2026

Closes #46307

Before you mark this PR as ready for review, make sure that you have:

  • Added a solid test coverage and/or screenshots from doing manual testing
  • Done a self-review taking into account security and performance aspects
  • Aligned any UI changes with the UI checklist

Release Notes:

  • Improved compatibility with mounted VHDs on Windows.

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 6, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @foxmsft on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 6, 2026
@foxmsft
Copy link
Copy Markdown
Contributor Author

foxmsft commented Mar 6, 2026

@cla-bot check

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 6, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @foxmsft on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 6, 2026

The cla-bot has been summoned, and re-checked this pull request!

@foxmsft
Copy link
Copy Markdown
Contributor Author

foxmsft commented Mar 6, 2026

@reflectronic does this seem fine? I doubt read_link helps with anything.

@foxmsft
Copy link
Copy Markdown
Contributor Author

foxmsft commented Mar 6, 2026

@cla-bot check

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 6, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @foxmsft on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 6, 2026

The cla-bot has been summoned, and re-checked this pull request!

@reflectronic reflectronic self-assigned this Mar 7, 2026
@foxmsft
Copy link
Copy Markdown
Contributor Author

foxmsft commented Mar 7, 2026

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 7, 2026
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Mar 7, 2026

The cla-bot has been summoned, and re-checked this pull request!

@reflectronic
Copy link
Copy Markdown
Member

reflectronic commented Mar 14, 2026

The function is meant to canonicalize the path (resolve symlinks, normalize case, etc.), so removing the read_link would sort of defeat the purpose.

The reason the function was so complex is that std::fs::canonicalize resolves mapped network drives to UNC paths, which some programs have trouble with. I've rewritten the function to simplify it overall and eliminate these corner cases. I've tested that it works as expected for mapped network drives and mounted VHDs.

@reflectronic reflectronic merged commit cbc3966 into zed-industries:main Mar 15, 2026
30 checks passed
tommyming pushed a commit to tommyming/zed that referenced this pull request Mar 15, 2026
Closes zed-industries#46307

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [X] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Improved compatibility with mounted VHDs on Windows.

---------

Co-authored-by: John Tur <john-tur@outlook.com>
Veykril pushed a commit that referenced this pull request Mar 24, 2026
…Windows (#51453)

Closes #47007 

After #50974, symlinked `settings.json` can be opened and saved, but the
worktree ends up rooted at the file itself rather than its parent
directory, which causes this error to be logged when changing settings
via the settings GUI:

```
2026-03-18T22:24:05+01:00 ERROR [worktree] ignoring event
"C:\\Users\\Bryan\\dev\\bryanpth\\dotfiles\\config\\zed\\settings.json~RF1ab7ae0.TMP" outside of root path
"C:\\Users\\Bryan\\dev\\bryanpth\\dotfiles\\config\\zed\\settings.json"
```

Fixed by canonicalizing the symlink path before passing to `open_paths`.
Tested with a symlinked settings.json, both directly and through WSL.

Release Notes:
- Fixed incorrect worktree root when settings.json is a symlink on
Windows
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 first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canonicalization of VHD mounted directories results in limited terminal functionality

2 participants