Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16414
| From | correio@goncalo.pt |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder. |
| Date | 2020-06-20 01:51 +0100 |
| Message-ID | <mailman.133.1592614476.2574.bug-bash@gnu.org> (permalink) |
| References | <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt> |
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-parentheses -Wno-format-security 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 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. Repeat-By: mkdir oldfolder cd oldfolder #Prompt shows oldfolder... mv ../oldfolder ../newfolder #Prompt continues to show oldfolder and not oldfolder... ls -la ls -la .. | grep folder #We confirmed the folder is newfolder and oldfolder doesn't exist anymore... echo $PWD #We confirm that the $PWD keeps the old name and not the new one, thus, not letting prompt being updated... cd .. cd newfolder #Only now the prompt has the new folder name... Fix: 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. ~ ~
Back to gnu.bash.bug | Previous | Next | Find similar
Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder. correio@goncalo.pt - 2020-06-20 01:51 +0100
csiph-web