nushell: Tilde expansion for external commands is surprising and cannot be opted out of

Describe the bug

The encoding of a string can change when passed to an external command:

grafik

How to reproduce

  1. ^echo "~" | into binary

Expected behavior

I expect nushell to not change the encoding of strings when I’m not looking.

Screenshots

grafik

Configuration

key value
version 0.73.0
branch
commit_hash
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.65.0 (897e37553 2022-11-02)
rust_channel stable-x86_64-pc-windows-msvc
cargo_version cargo 1.65.0 (4bc8f24d3 2022-10-20)
pkg_version 0.73.0
build_time 2023-01-02 18:02:43 +01:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Confirmed using strace that we are expanding the tilde when running semver-explain "~0.5.3":

[pid 442837] execve("/home/reilly/.cargo/bin/semver-explain", ["semver-explain", "/home/0.5.3"], 0x5598e5835790 /* 44 vars */ <unfinished ...>

That is bad and we shouldn’t be doing it.

It’s interesting that it’s not even getting the tilde expansion right; it’s missing my username in both cases.

Very OT, (sorry) but it’s actually the right expansions, as ~NAME != ~/NAME. ~NAME == Home of user NAME