mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
2f6b290084
This PR fix the "invalid cross-device link" error occurred in linux when trying to write the settings file atomically, like when click the "Enable vim mode" checkbox at first start. ```plain [2024-02-26T22:59:25+08:00 ERROR util] .../zed/crates/settings/src/settings_file.rs:135: Failed to write settings to file "/home/$USER/.config/zed/settings.json" Caused by: 0: failed to persist temporary file: Invalid cross-device link (os error 18) 1: Invalid cross-device link (os error 18) ``` Currently the `fs::RealFs::atomic_write()` method write to a temp file created with `NamedTempFile::new()` and then call `persist()` method to write to the config file path, which actually do a `rename` syscall under the hood. As the [issue](https://github.com/Stebalien/tempfile/issues/245) said > `NamedTempFile::new()` will create a temporary file in your system's temporary file directory. You need `NamedTempFile::new_in()`. The temporary file directory in linux is in `/tmp`, which is mounted to `tmpfs` filesystem, and in most case(all case I guess) `$HOME/.config/zed` is mounted to a different filesystem. And the `rename` syscall between different filesystems will return a `EXDEV` errno, as described in the man page [rename(2)](https://man7.org/linux/man-pages/man2/renameat2.2.html): ```plain EXDEV oldpath and newpath are not on the same mounted filesystem. (Linux permits a filesystem to be mounted at multiple points, but rename() does not work across different mount points, even if the same filesystem is mounted on both.) ``` And as the issue above said, use a different temp dir with `NamedTempFile::new_in()` for linux platform might be a solution, since the `rename` syscall provides atomicity. Release Notes: - Fix `settings.json` save failed with invalid cross-device link error in linux |
||
---|---|---|
.cargo | ||
.config | ||
.github | ||
.zed | ||
assets | ||
crates | ||
docs | ||
script | ||
.dockerignore | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
.mailmap | ||
Cargo.lock | ||
Cargo.toml | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
debug.plist | ||
docker-compose.sql | ||
docker-compose.yml | ||
Dockerfile | ||
LICENSE-AGPL | ||
LICENSE-APACHE | ||
LICENSE-GPL | ||
livekit.yaml | ||
Procfile | ||
README.md | ||
rust-toolchain.toml | ||
typos.toml |
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
You can download Zed today for macOS (v10.15+).
Support for additional platforms is on our roadmap:
- Linux (tracking issue)
- Windows (tracking issue)
- Web (tracking issue)
For macOS users, you can also install Zed from Homebrew:
brew install zed
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Licensing
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about
to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specified
error for a crate you've created? If so, addpublish = false
under[package]
in your crate's Cargo.toml. - Is the error
failed to satisfy license requirements
for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theaccepted
array inscript/licenses/zed-licenses.toml
. - Is
cargo-about
unable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml
, as specified in the cargo-about book.