-
Notifications
You must be signed in to change notification settings - Fork 2.1k
from toml works differently on Windows than Linux #8139
Copy link
Copy link
Closed
Labels
category:bugSomething isn't workingSomething isn't workingcategory:inconsistent-behaviorBehavior between different commands or types inconsistent/unexpectedBehavior between different commands or types inconsistent/unexpected
Milestone
Description
Describe the bug
Linux
cargo llvm-cov show-env | from toml
╭───────────────────────────┬────────────────────────────────────────────────────────────────╮
│ CARGO_INCREMENTAL │ 0 │
│ CARGO_LLVM_COV_TARGET_DIR │ /home/fdncred/src/forks/nushell/target │
│ LLVM_PROFILE_FILE │ /home/fdncred/src/forks/nushell/target/nushell-%p-%m.profraw │
│ NEXTEST_TEST_THREADS │ 1 │
│ RUSTFLAGS │ -C instrument-coverage --cfg=coverage --cfg=trybuild_no_target │
│ RUST_TEST_THREADS │ 1 │
╰───────────────────────────┴────────────────────────────────────────────────────────────────╯
Windows
cargo llvm-cov show-env | from toml
Error: nu::shell::cant_convert (link)
× Can't convert to structured toml data.
╭─[entry #3:1:1]
1 │ cargo llvm-cov show-env | from toml
· ──┬──
· ╰── can't convert string to structured toml data
╰────
I believe this is because Windows is returning double quoted variables, which enables string escape interpreting, with the traditional Windows path back slashes which are being interpreted as escapes.
RUSTFLAGS="-C link-args=-stack:10000000 -C target-feature=+crt-static -C instrument-coverage --cfg=coverage --cfg=trybuild_no_target"
LLVM_PROFILE_FILE="C:\CarTar\nushell-%p-%m.profraw"
CARGO_INCREMENTAL="0"
RUST_TEST_THREADS="1"
NEXTEST_TEST_THREADS="1"
CARGO_LLVM_COV_TARGET_DIR="C:\CarTar"
This works fine (although the syntax for str replace is just odd, perhaps another bug)
cargo llvm-cov show-env | str replace '\\' '\\' -a | from toml
╭───────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ CARGO_INCREMENTAL │ 0 │
│ CARGO_LLVM_COV_TARGET_DIR │ C:\CarTar │
│ LLVM_PROFILE_FILE │ C:\CarTar\nushell-%p-%m.profraw │
│ NEXTEST_TEST_THREADS │ 1 │
│ RUSTFLAGS │ -C link-args=-stack:10000000 -C target-feature=+crt-static -C instrument-coverage --cfg=coverage --cfg=trybuild_no_target │
│ RUST_TEST_THREADS │ 1 │
╰───────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
I'm not sure what the correct fix is.
- Should double quotes passed in behave like escapes?
- Should from toml somehow accommodate windows paths somehow?
- Should we just change our behavior here because this is how it's supposed to work?
Line 25 in b9be416
cargo llvm-cov show-env | from toml | load-env
How to reproduce
See above
Expected behavior
Just work
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.75.1 |
| branch | main |
| commit_hash | daeb3e5 |
| build_os | windows-x86_64 |
| build_target | x86_64-pc-windows-msvc |
| rust_version | rustc 1.66.1 (90743e729 2023-01-10) |
| rust_channel | 1.66.1-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.66.1 (ad779e08b 2023-01-10) |
| pkg_version | 0.75.1 |
| build_time | 2023-02-17 07:26:04 -06:00 |
| build_rust_channel | release |
| features | database, dataframe, default, trash, which, zip |
| installed_plugins | custom-value generate, custom-value generate2, custom-value update, from eml, from ics, from ini, from parquet, from plist, from vcf, gstat, hist, inc, nu-example-1, nu-example-2, nu-example-3, periodic-table, plot, pnet, query, query json, query web, query xml, regex, xyplot |
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category:bugSomething isn't workingSomething isn't workingcategory:inconsistent-behaviorBehavior between different commands or types inconsistent/unexpectedBehavior between different commands or types inconsistent/unexpected