Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16415

Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.

From Lawrence Velázquez <vq@larryv.me>
Newsgroups gnu.bash.bug
Subject Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.
Date 2020-06-19 22:15 -0400
Message-ID <mailman.137.1592619351.2574.bug-bash@gnu.org> (permalink)
References <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt> <FE80D704-5A77-4E5B-8A31-CDACAFCD6305@larryv.me>

Show all headers | View raw


Hi,

> On Jun 19, 2020, at 8:51 PM, correio@goncalo.pt wrote:
> 
> Bash Version: 5.0
> Patch Level: 11
> Release Status: release 
> Description: 
> When we rename the current working directory, $PWD doesn't get updated
> as it would as it would if we just did a simple "cd directory". Because
> of that, the prompt will continue also to show the old current
> directory's name, and not the new name the folder has. But the problem
> comes from the current working directory's variable itself (proven by
> "echo $PWD") and not by the prompt itself. So it's a lot worse than a
> simple prompt update but, it has to do with with environment variables
> themselves. As environment variables are session-specific, I submitted
> this to you and not to the kernel bug tracking. Please tell me if I
> should inform other bug tracking also. Thanks.

I'd be hard-pressed to call this a bug, considering that bash is hardly the
only shell that behaves this way.

% cat /tmp/test
rm -fR /tmp/old /tmp/new
mkdir /tmp/old
cd /tmp/old
printf 'pre-mv:  %s\n' "$PWD"
mv /tmp/old /tmp/new
printf 'post-mv: %s\n' "$PWD"

% bash --version | head -n 1
GNU bash, version 5.0.17(1)-release (x86_64-apple-darwin18.7.0)
% bash /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% zsh --version
zsh 5.8 (x86_64-apple-darwin18.7.0)
% zsh /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% ksh --version
  version         sh (AT&T Research) 93u+ 2012-08-01
% ksh /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% port -q installed dash
  dash @0.5.10.2_0 (active)
% dash /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% yash --version | head -n 1
Yet another shell, version 2.48
% yash /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

--
vq

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder. Lawrence Velázquez <vq@larryv.me> - 2020-06-19 22:15 -0400

csiph-web