On Tue, May 23, 2017 at 8:51 AM, <idal...@home.idallen.ca> wrote: [...] > Bash Version: 4.3 > Patch Level: 48 > Release Status: release
I can reproduce with 4.4.11(1)-release and the latest devel branch [...] > As implemented, I now have to start every shell script that > uses $PWD before using "cd" with either 'cd "$(/bin/pwd)"' or > 'set -o physical ; cd .' to get PWD into a usable state. As an aside: any reason you use /bin/pwd instead of the shell builtin pwd? The problem seems to be that `sh_canonpath' is called to set the working directory (`set_working_directory'), but the value of PWD is not updated with the canonical version. Here's what I think is the fix. I'm not sure if the set_auto_export is needed, most likely it isn't. dualbus@debian:~/src/gnu/bash$ git diff -- variables.c diff --git a/variables.c b/variables.c index 944de86e..e0a258dd 100644 --- a/variables.c +++ b/variables.c @@ -852,6 +852,8 @@ set_pwd () current_dir = get_working_directory ("shell_init"); else set_working_directory (current_dir); + temp_var = bind_variable ("PWD", current_dir, 0); + set_auto_export (temp_var); free (current_dir); } else if (home_string && interactive_shell && login_shell &&