ZIm/crates/languages
0x5457 176c445817
Avoid symlink conflicts when re-extracting eslint-xx.tar.gz (#36068)
Closes #34325

**Background**
When upgrading/reinstalling the ESLint language server, extracting the
archive over an existing version directory that contains symlinks can
fail and interrupt the installation.
```
failed to unpack .../vscode-eslint-2.4.4/.../client/src/shared
File exists (os error 17) when symlinking ../../$shared/ to .../client/src/shared
```

**Root cause**
Extracting into a non-empty directory conflicts with leftover
files/symlinks (e.g., `client/src/shared -> ../../$shared`), causing
“File exists (os error 17)”.

When `fs::metadata(&server_path).await.is_err()` is true, the code falls
back to cached_server_binary, but that still targets the same
(potentially corrupted/half-installed) directory and does not run `npm
install` or `npm run compile`, so the system cannot recover and remains
broken.

**Change**
Before downloading and extracting, delete the target version directory
(vscode-eslint-<version>) to ensure an empty extraction destination and
avoid conflicts.

**Alternative approaches**
temp directory + rename: extract into a clean temp directory and rename
into place to avoid half-installed states

[async-tar](https://github.com/dignifiedquire/async-tar) enhancement:
tolerate already-existing symlinks (or add a “replace-existing” option).

Release Notes:

- Fixed eslint installation not clearing files after previous attempts'
2025-08-19 10:28:24 +03:00
..
src Avoid symlink conflicts when re-extracting eslint-xx.tar.gz (#36068) 2025-08-19 10:28:24 +03:00
Cargo.toml Verify downloaded rust-analyzer and clang binaries by checking the artifact digest (#35642) 2025-08-06 08:32:25 +00:00
LICENSE-GPL chore: Extract languages from zed crate (#8270) 2024-02-23 15:56:08 +01:00