Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sha computation of symlinks was failing sometimes #641

Merged
merged 1 commit into from
May 6, 2024

Conversation

wolfv
Copy link
Contributor

@wolfv wolfv commented May 3, 2024

Sometimes linking was failing because we tried to compute the SHA hash of a symlink-file. When computing the hash, we follow the symlink. But since we are symlinking everything at once, and in parallel, the symlinked file is sometimes not yet there.

In that case, the SHA hash computation was failing.

With this PR, we change it so that we always store 000...000 for symlinks.
Conda and mamba 'wait' for the files to be ready and then compute (or find) the hash. We could also do that, but on the other hand the "sha" hash of a symlink doesn't make that much sense anyways.

Thoughts?

ref. prefix-dev/pixi#1309

@wolfv
Copy link
Contributor Author

wolfv commented May 3, 2024

Note: before, if we had the paths.json, then we would use the SHA hash that is stored in there (which is also not correct if the symlink target file had a prefix replacement).

Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the final solution because the hashes are now incorrect for symlinks (they also already were). We are planning to add a proper solution where we first process all non-symlinks and process the symlinks after.

@baszalmstra baszalmstra merged commit 831754c into conda:main May 6, 2024
14 checks passed
@baszalmstra baszalmstra mentioned this pull request May 6, 2024
@wolfv wolfv deleted the fix-sha branch May 6, 2024 09:22
baszalmstra added a commit that referenced this pull request May 6, 2024
## 🤖 New release
* `rattler`: 0.23.2 -> 0.24.0 (⚠️ API breaking changes)
* `rattler_conda_types`: 0.22.0 -> 0.22.1 (✓ API compatible changes)
* `rattler_networking`: 0.20.4 -> 0.20.5 (✓ API compatible changes)
* `rattler_package_streaming`: 0.20.7 -> 0.20.8
* `rattler_shell`: 0.20.1 -> 0.20.2
* `rattler_lock`: 0.22.4 -> 0.22.5
* `rattler_repodata_gateway`: 0.19.10 -> 0.19.11
* `rattler_solve`: 0.21.0 -> 0.21.1
* `rattler_virtual_packages`: 0.19.8 -> 0.19.9
* `rattler_index`: 0.19.9 -> 0.19.10

### ⚠️ `rattler` breaking changes

```
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.31.0/src/lints/enum_variant_added.ron

Failed in:
  variant LinkFileError:FailedToComputeSha in /tmp/.tmpB34zKy/rattler/crates/rattler/src/install/link.rs:108
  variant LinkFileError:FailedToComputeSha in /tmp/.tmpB34zKy/rattler/crates/rattler/src/install/link.rs:108
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `rattler`
<blockquote>

##
[0.24.0](rattler-v0.23.2...rattler-v0.24.0)
- 2024-05-06

### Fixed
- use the output of `readlink` as hash for softlinks
([#643](#643))
- sha computation of symlinks was failing sometimes
([#641](#641))
</blockquote>

## `rattler_conda_types`
<blockquote>

##
[0.22.1](rattler_conda_types-v0.22.0...rattler_conda_types-v0.22.1)
- 2024-05-06

### Added
- expose `*Record.noarch` in Python bindings
([#635](#635))
</blockquote>

## `rattler_networking`
<blockquote>

##
[0.20.5](rattler_networking-v0.20.4...rattler_networking-v0.20.5)
- 2024-05-06

### Added
- respect `RATTLER_AUTH_FILE` when using
AuthenticationStorage::default()
([#636](#636))
</blockquote>

## `rattler_package_streaming`
<blockquote>

##
[0.20.8](rattler_package_streaming-v0.20.7...rattler_package_streaming-v0.20.8)
- 2024-05-06

### Other
- updated the following local packages: rattler_conda_types,
rattler_networking
</blockquote>

## `rattler_shell`
<blockquote>

##
[0.20.2](rattler_shell-v0.20.1...rattler_shell-v0.20.2)
- 2024-05-06

### Other
- updated the following local packages: rattler_conda_types
</blockquote>

## `rattler_lock`
<blockquote>

##
[0.22.5](rattler_lock-v0.22.4...rattler_lock-v0.22.5)
- 2024-05-06

### Other
- updated the following local packages: rattler_conda_types
</blockquote>

## `rattler_repodata_gateway`
<blockquote>

##
[0.19.11](rattler_repodata_gateway-v0.19.10...rattler_repodata_gateway-v0.19.11)
- 2024-05-06

### Other
- updated the following local packages: rattler_conda_types,
rattler_networking
</blockquote>

## `rattler_solve`
<blockquote>

##
[0.21.1](rattler_solve-v0.21.0...rattler_solve-v0.21.1)
- 2024-05-06

### Other
- updated the following local packages: rattler_conda_types
</blockquote>

## `rattler_virtual_packages`
<blockquote>

##
[0.19.9](rattler_virtual_packages-v0.19.8...rattler_virtual_packages-v0.19.9)
- 2024-05-06

### Other
- updated the following local packages: rattler_conda_types
</blockquote>

## `rattler_index`
<blockquote>

##
[0.19.10](rattler_index-v0.19.9...rattler_index-v0.19.10)
- 2024-05-06

### Other
- updated the following local packages: rattler_conda_types
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Signed-off-by: Bas <4995967+baszalmstra@users.noreply.github.com>
Co-authored-by: Bas <4995967+baszalmstra@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants