[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug on bash shell - $PWD (and consequentely prompt) not updated while re
Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.
Sat, 20 Jun 2020 01:51:07 +0100
Configuration Information [Automatically generated, do not change]:
Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
uname output: Linux localhost.localdomain 5.5.10-200.fc31.x86_64 #1 SMP
Wed Mar 18 14:21:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu
Bash Version: 5.0
Patch Level: 11
Release Status: release
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.
#Prompt shows oldfolder...
mv ../oldfolder ../newfolder
#Prompt continues to show oldfolder and not oldfolder...
ls -la .. | grep folder
#We confirmed the folder is newfolder and oldfolder doesn't exist
#We confirm that the $PWD keeps the old name and not the new one, thus,
not letting prompt being updated...
#Only now the prompt has the new folder name...
Probably: Trigger the current working directory refresh event, like it
is already done with the cd command. Because we can be renaming our own
current working directory, so a simple trigger is needed when mv is
executed and renaming the current working directory. At the same time,
if different shells have the same current working directory, probably
sending a signal to trigger environment variables on other shells is not
practical, maybe each shell should take care of that trigger, to update
those variables when noticing the current working directory's name would
change, this way each shell would take care of the problem if its own
current working directory's name would change.
Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder., Chet Ramey, 2020/06/20
- Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.,