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

Workspace::new fails when workspace contains * in members on Windows #14717

Open
Sytten opened this issue Oct 22, 2024 · 3 comments
Open

Workspace::new fails when workspace contains * in members on Windows #14717

Sytten opened this issue Oct 22, 2024 · 3 comments
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-workspaces Area: workspaces C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

Comments

@Sytten
Copy link

Sytten commented Oct 22, 2024

Problem

Hi!
I am using cargo-patch in the LLRT project (https://github.com/awslabs/llrt).
We wanted to use * in our workspace like:

[workspace]
resolver = "2"
members = ["modules/*", "libs/*", "llrt_core", "llrt_modules", "llrt"]

It works fine on macos and linux, but it looks like it fails on Windows. The error is:

  Error: failed to load manifest for workspace member `\\?\D:\a\llrt\llrt\modules\*`

  Caused by:
      0: failed to read `\\?\D:\a\llrt\llrt\modules\*\Cargo.toml`
      1: The filename, directory name, or volume label syntax is incorrect. (os error 123)

Here is the full stacktrace:

Stack backtrace:
     0: std::backtrace_rs::backtrace::dbghelp64::trace
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
     1: std::backtrace_rs::backtrace::trace_unsynchronized
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
     2: std::backtrace::Backtrace::create
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\backtrace.rs:331
     3: std::backtrace::Backtrace::capture
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\backtrace.rs:296
     4: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
     5: <core::result::Result<T,F> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible,E>>>::from_residual
     6: cargo::core::workspace::Packages::get
     7: cargo::core::workspace::Workspace::find_members::{{closure}}
     8: cargo::core::workspace::Workspace::load_workspace_config
     9: cargo::core::workspace::Workspace::new
    10: <cargo_patch::PatchFailed as core::fmt::Display>::fmt
    11: cargo_patch::patch
    12: <core::option::Option<T> as core::iter::traits::collect::IntoIterator>::into_iter
    13: core::ops::function::FnOnce::call_once
    14: std::sys::backtrace::__rust_begin_short_backtrace
    15: std::rt::lang_start::{{closure}}
    16: std::rt::lang_start_internal::closure$1
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\rt.rs:174
    17: std::panicking::try::do_call
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\panicking.rs:557
    18: std::panicking::try
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\panicking.rs:520
    19: std::panic::catch_unwind
               at /rustc/43928[474](https://github.com/awslabs/llrt/actions/runs/11466127105/job/31906174235?pr=640#step:11:475)10ddd67f6734dd9845f9742ff9e85c83\library/std\src\panic.rs:358
    20: std::rt::lang_start_internal
               at /rustc/4392847410ddd67f6734dd9845f9742ff9e85c83\library/std\src\rt.rs:174
    21: std::rt::lang_start
    22: main
    23: invoke_main
               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
    24: __scrt_common_main_seh
               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
    25: BaseThreadInitThunk
    26: RtlUserThreadStart

Steps

  1. Be on windows
  2. Clone https://github.com/caido/dependency-llrt/tree/ef-refactor-crates
  3. cargo build -p llrt

Possible Solution(s)

No response

Notes

No response

Version

No response

@Sytten Sytten added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Oct 22, 2024
@weihanglo weihanglo added the A-workspaces Area: workspaces label Oct 22, 2024
@weihanglo
Copy link
Member

weihanglo commented Oct 22, 2024

See https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/.60glob.60.20crate.20issue.

tl;dr: fundamentally in verbatim paths * is the name of the directory or file called * not a special character for glob. (Cargo doesn't handle verbatim paths well, though)

See also rust-lang/glob#132.

@weihanglo
Copy link
Member

While Cargo is not good with verbatim paths, this is kinda blocked on glob and other external tools.

@weihanglo weihanglo added S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix and removed S-triage Status: This issue is waiting on initial triage. labels Oct 22, 2024
@epage epage added the A-cargo-api Area: cargo-the-library API and internal code issues label Oct 23, 2024
@epage
Copy link
Contributor

epage commented Oct 23, 2024

Crates like https://crates.io/crates/dunce could help people work around this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo-api Area: cargo-the-library API and internal code issues A-workspaces Area: workspaces C-bug Category: bug S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Projects
None yet
Development

No branches or pull requests

3 participants