[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug on bash shell - $PWD (and consequentely prompt) not updated while re

From: correio
Subject: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.
Date: Sat, 20 Jun 2020 01:51:07 +0100
User-agent: Roundcube Webmail/1.4.4

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=format-security
-fstack-protector-strong -grecord-gcc-switches
-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.
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
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...
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.
~ ~

reply via email to

[Prev in Thread] Current Thread [Next in Thread]