From 90c87dc65452889cd79debdc58d46fee76d17726 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 19 Nov 2024 09:18:56 +0000 Subject: ash: match behaviour of cmd.exe in cd builtin The Windows API strips trailing dots and spaces from the last component of a path. cmd.exe handles this quirk when changing directory by adjusting its idea of the current directory to match reality. The shell in busybox-w32 didn't do this, leading to some confusion. Fix the shell's cd builtin so it works more like cmd.exe. Adds 64-80 bytes. (GitHub issue #478) --- shell/ash.c | 1 + 1 file changed, 1 insertion(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 1fc2a44b1..3919118f0 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -3338,6 +3338,7 @@ updatepwd(const char *dir) if (new > lim) STUNPUTC(new); *new = 0; + strip_dot_space((char *)stackblock()); fix_path_case((char *)stackblock()); return bs_to_slash((char *)stackblock()); #else -- cgit v1.2.3-55-g6feb