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


Groups > gnu.bash.bug > #16414

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

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From correio@goncalo.pt
Newsgroups gnu.bash.bug
Subject Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.
Date Sat, 20 Jun 2020 01:51:07 +0100
Lines 62
Approved bug-bash@gnu.org
Message-ID <mailman.133.1592614476.2574.bug-bash@gnu.org> (permalink)
References <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII; format=flowed
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1592614476 24013 209.51.188.17 (20 Jun 2020 00:54:36 GMT)
X-Complaints-To action@cs.stanford.edu
Cc correio@goncalo.pt, goncalo_nuno@sapo.pt
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=goncalo.pt; s=default; h=Content-Type:Message-ID:Subject:Cc:To:From:Date:MIME-Version: Sender:Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BQtT2XWfZhCIVq/KkzsTJQ9AXlqJALIziCcy5PfCksU=; b=rmWTYKKu0r2+YxuG84v3y4Z4aC gTCHb8oly6t+MydXkhCIZmNzEpelqpeu8hPUPb43L3SN6mztzyrHoWus3GYaTHH8pzZ+TK2GbANWQ pQB20lrypPnDz3PfueOUnAr4o;
User-Agent Roundcube Webmail/1.4.4
X-Sender correio@goncalo.pt
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - euk-89281.eukservers.com
X-AntiAbuse Original Domain - gnu.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - goncalo.pt
X-Get-Message-Sender-Via euk-89281.eukservers.com: authenticated_id: correio@goncalo.pt
X-Authenticated-Sender euk-89281.eukservers.com: correio@goncalo.pt
X-Source
X-Source-Args
X-Source-Dir
Received-SPF pass client-ip=213.175.201.187; envelope-from=correio@goncalo.pt; helo=euk-89281.eukservers.com
X-detected-operating-system by eggs.gnu.org: First seen = 2020/06/19 20:51:09
X-ACL-Warn Detected OS = Linux 3.11 and newer
X-Spam_score_int -18
X-Spam_score -1.9
X-Spam_bar -
X-Spam_report (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action no action
X-Mailman-Approved-At Fri, 19 Jun 2020 20:54:35 -0400
X-Content-Filtered-By Mailman/MimeDel 2.1.23
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt>
Xref csiph.com gnu.bash.bug:16414

Show key headers only | View raw


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


Thread

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