Skip to content

don't join paths to cwd ever in calls to external functions - #5180

Merged
kubouch merged 1 commit into
nushell:mainfrom
strega-nil:less-normalizing-paths
Apr 13, 2022
Merged

kubouch merged 1 commit into
nushell:mainfrom
strega-nil:less-normalizing-paths

Conversation

@strega-nil

@strega-nil strega-nil commented Apr 13, 2022 •

Copy link
Copy Markdown
Contributor

This is a follow-up to #5131, since I don't personally like the way it worked.

Description

Instead of attempting to normalize paths by pasting cwd on the front, this skips all path normalization except for tilde and ...+. This is more in line with other shells, like bash:

$ cat test.c
int main(int argc, char** argv) {
  int printf(char const*, ...);
  printf("called as: '%s' '%s'\n", argv[0], argv[1]);
}
$ ./a.exe ~/foo
called as: './a.exe' 'C:\Users\nimazzuc/foo'
$ ./a.exe ../foo
called as: './a.exe' '../foo'
$ ./a.exe .../foo
called as './a.exe' '../../foo'
$ ./a.exe ./foo
called as './a.exe' './foo'

Tests

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --all --all-features -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo build; cargo test --all --all-features to check that all the tests pass (the only tests that didn't pass were related to symlinks, since I don't have perms to create them)

This is a follow-up to nushell#5131, since I don't personally like the way it worked.
@kubouch

kubouch commented Apr 13, 2022

Copy link
Copy Markdown
Contributor

Yeah, we could do that and leave the . and .. expansion up to the external. Thanks!

@kubouch
kubouch merged commit 87c684c into nushell:main Apr 13, 2022
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