You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A:external-commandsIssues related to external commandsA:globBehavior around file-system globbing with regular commands or `glob`. See also A:quoting/expansioncategory:bugSomething isn't working
This is caused by PR #12921, which changed how arguments to external commands are expanded.
Here's how the bug works. Nushell will perform glob-expansion on any bare strings, and since . is considered a bare string, it is expanded into an absolute path (e.g. /tmp/.). Since working with absolute paths is tedious (^ls * would print a bunch of absolute paths), we also use Path::strip_prefix() against the current directory to shorten the path when possible. However, Path::strip_prefix() has this weird behavior where if you shorten /tmp/. against /tmp, you get an empty path instead of ., which causes this bug.
Technically speaking, the behavior of Path::strip_prefix() is correct because the standard library considers /tmp/. and /tmp equal. I think adding a special case for this should suffice?
A:external-commandsIssues related to external commandsA:globBehavior around file-system globbing with regular commands or `glob`. See also A:quoting/expansioncategory:bugSomething isn't working
Activity
yizhepku commentedon May 24, 2024
This is caused by PR #12921, which changed how arguments to external commands are expanded.
Here's how the bug works. Nushell will perform glob-expansion on any bare strings, and since
.is considered a bare string, it is expanded into an absolute path (e.g./tmp/.). Since working with absolute paths is tedious (^ls *would print a bunch of absolute paths), we also usePath::strip_prefix()against the current directory to shorten the path when possible. However,Path::strip_prefix()has this weird behavior where if you shorten/tmp/.against/tmp, you get an empty path instead of., which causes this bug.Technically speaking, the behavior of
Path::strip_prefix()is correct because the standard library considers/tmp/.and/tmpequal. I think adding a special case for this should suffice?Fixes `.` expanded incorrectly as external argument (#12950)