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

Toolchain::find_all unwrap can panic #4189

Closed
konstin opened this issue Jun 10, 2024 · 5 comments · Fixed by #4163
Closed

Toolchain::find_all unwrap can panic #4189

konstin opened this issue Jun 10, 2024 · 5 comments · Fixed by #4163
Labels
bug Something isn't working preview Experimental behavior

Comments

@konstin
Copy link
Member

konstin commented Jun 10, 2024

The following unwrap in toolchain discovery can panic:

.map(|path| InstalledToolchain::new(path).unwrap())

thread 'seed' panicked at crates/uv-toolchain/src/managed.rs:104:55:
called `Result::unwrap()` on an `Err` value: NameError("not enough `-`-separated values")
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: uv_toolchain::managed::InstalledToolchains::find_all::{{closure}}
   4: core::iter::adapters::map::map_try_fold::{{closure}}
   5: core::iter::traits::double_ended::DoubleEndedIterator::try_rfold
   6: <core::iter::adapters::map::Map<I,F> as core::iter::traits::double_ended::DoubleEndedIterator>::try_rfold
   7: <core::iter::adapters::rev::Rev<I> as core::iter::traits::iterator::Iterator>::try_fold
   8: <core::iter::adapters::filter::Filter<I,P> as core::iter::traits::iterator::Iterator>::try_fold
   9: core::iter::traits::iterator::Iterator::find
  10: <core::iter::adapters::filter::Filter<I,P> as core::iter::traits::iterator::Iterator>::next
  11: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  12: alloc::vec::Vec<T,A>::extend_desugared
  13: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
  14: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
  17: core::iter::traits::iterator::Iterator::collect
  18: venv::common::python_path_with_versions::{{closure}}::{{closure}}
  19: core::result::Result<T,E>::map
  20: venv::common::python_path_with_versions::{{closure}}
  21: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
  22: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
  23: <core::iter::adapters::fuse::Fuse<I> as core::iter::adapters::fuse::FuseImpl<I>>::next
  24: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::next
  25: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
  26: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
  27: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  28: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
  29: core::iter::traits::iterator::Iterator::collect
  30: venv::common::python_path_with_versions
  31: venv::VenvTestContext::new
  32: venv::seed
  33: venv::seed::{{closure}}
  34: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@konstin konstin added bug Something isn't working preview Experimental behavior labels Jun 10, 2024
@zanieb
Copy link
Member

zanieb commented Jun 10, 2024

I've fixed this already in one of the upcoming pull requests to productionize toolchain management.

@charliermarsh
Copy link
Member

Is this panic user-accessible on main?

@charliermarsh
Copy link
Member

(Do we need to fix it prior to today's release?)

@konstin
Copy link
Member Author

konstin commented Jun 10, 2024

I think it's from the downloaded toolchains, so a preview feature

@zanieb
Copy link
Member

zanieb commented Jun 10, 2024

This has been accessible on main for a while now. It's only relevant if you are using managed toolchains and pollute the toolchain directory. I could fix it separately from my stack if you want though?

zanieb added a commit that referenced this issue Jun 10, 2024
Adds the `uv toolchain` namespace and a `list` command to get us
started.

```
❯ cargo run -q -- toolchain list
warning: `uv toolchain list` is experimental and may change without warning.
3.8.12   (cpython-3.8.12-macos-aarch64-none)
3.8.13   (cpython-3.8.13-macos-aarch64-none)
3.8.14   (cpython-3.8.14-macos-aarch64-none)
3.8.15   (cpython-3.8.15-macos-aarch64-none)
3.8.16   (cpython-3.8.16-macos-aarch64-none)
3.8.17   (cpython-3.8.17-macos-aarch64-none)
3.8.18   (cpython-3.8.18-macos-aarch64-none)
3.8.18   (cpython-3.8.18-macos-aarch64-none)
3.8.19   (cpython-3.8.19-macos-aarch64-none)
3.9.2    (cpython-3.9.2-macos-aarch64-none)
3.9.3    (cpython-3.9.3-macos-aarch64-none)
3.9.4    (cpython-3.9.4-macos-aarch64-none)
3.9.5    (cpython-3.9.5-macos-aarch64-none)
3.9.6    (cpython-3.9.6-macos-aarch64-none)
3.9.7    (cpython-3.9.7-macos-aarch64-none)
3.9.10   (cpython-3.9.10-macos-aarch64-none)
3.9.11   (cpython-3.9.11-macos-aarch64-none)
3.9.12   (cpython-3.9.12-macos-aarch64-none)
3.9.13   (cpython-3.9.13-macos-aarch64-none)
3.9.14   (cpython-3.9.14-macos-aarch64-none)
3.9.15   (cpython-3.9.15-macos-aarch64-none)
3.9.16   (cpython-3.9.16-macos-aarch64-none)
3.9.17   (cpython-3.9.17-macos-aarch64-none)
3.9.18   (cpython-3.9.18-macos-aarch64-none)
3.9.19   (cpython-3.9.19-macos-aarch64-none)
3.10.0   (cpython-3.10.0-macos-aarch64-none)
3.10.2   (cpython-3.10.2-macos-aarch64-none)
3.10.3   (cpython-3.10.3-macos-aarch64-none)
3.10.4   (cpython-3.10.4-macos-aarch64-none)
3.10.5   (cpython-3.10.5-macos-aarch64-none)
3.10.6   (cpython-3.10.6-macos-aarch64-none)
3.10.7   (cpython-3.10.7-macos-aarch64-none)
3.10.8   (cpython-3.10.8-macos-aarch64-none)
3.10.9   (cpython-3.10.9-macos-aarch64-none)
3.10.11  (cpython-3.10.11-macos-aarch64-none)
3.10.12  (cpython-3.10.12-macos-aarch64-none)
3.10.13  (cpython-3.10.13-macos-aarch64-none)
3.10.14  (cpython-3.10.14-macos-aarch64-none)
3.11.1   (cpython-3.11.1-macos-aarch64-none)
3.11.3   (cpython-3.11.3-macos-aarch64-none)
3.11.4   (cpython-3.11.4-macos-aarch64-none)
3.11.5   (cpython-3.11.5-macos-aarch64-none)
3.11.6   (cpython-3.11.6-macos-aarch64-none)
3.11.7   (cpython-3.11.7-macos-aarch64-none)
3.11.8   (cpython-3.11.8-macos-aarch64-none)
3.11.9   (cpython-3.11.9-macos-aarch64-none)
3.12.0   (cpython-3.12.0-macos-aarch64-none)
3.12.1   (cpython-3.12.1-macos-aarch64-none)
3.12.2   (cpython-3.12.2-macos-aarch64-none)
3.12.3   (cpython-3.12.3-macos-aarch64-none)
```

Closes #4189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Experimental behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants