Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= Newsgroups: gnu.bash.bug Subject: Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder. Date: Sat, 20 Jun 2020 13:28:03 -0400 Lines: 45 Approved: bug-bash@gnu.org Message-ID: References: <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt> <6BF29BAB-6F57-4D88-85BC-56E1AA14F29F@larryv.me> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1592674092 22840 209.51.188.17 (20 Jun 2020 17:28:12 GMT) X-Complaints-To: action@cs.stanford.edu Cc: correio@goncalo.pt, goncalo_nuno@sapo.pt, bug-bash@gnu.org To: Ilkka Virta Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=larryv.me; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm3; bh=T Cari1ZPtWOHjJxCkY2ZPcNr5I8opROVd6vNOFJmdYI=; b=GRRHaEguGf8vH4LPZ 0VhtmcqRjWdxXCVFrI+cPXj17lH++9bYhc7uldPclY0Qi9zKBuD/BbIqKJoudlXa bobbemAw3l9BiglL+daD9pJwD9Qb4XjKH+iuDvqPwOLt7GNUGKAyqspO77XoH5K/ 9hVlE7jx6BbGSwPHqYXB50mucZ1rrGzI02WIpSxJSH3CJNKZbOHyBCskY//pjet3 kJBIzBjKG2udLRnY0kgz1niRsUvvelKg6BWzR/0cMbsai/Er/nij8sVNZAZ3vVcv rvHzbnGuKMUrBBTMufeX95FYilixbQ4eNo2nVVn6sadCXaP1wDAE0bY8gkWfpTZJ VxUUA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=TCari1ZPtWOHjJxCkY2ZPcNr5I8opROVd6vNOFJmd YI=; b=EMbJtjJrnOLsa7tZbaRD6MY+y1Mh8Tz8YNQeC4JDBxFMSPtqWAZAg66iy f+81bHEF0VAyJookx8QoareH7SuzE2TOJrZ0xobZvKxdn/0juSQhX+OTaaqnaPXR 5DefSIBo3AdwojV3FpFF6d2jNT8b1zuJnz96pcOf6/4zs+563wnGiw7qTCgqMoXr kay5UeJ2TCDOrDp6WXSVVwhFlwkfUaf+wo9QzeXRBVQaFJe117NrVf6SWXnvFqrT Rsc83sawMOmeXkLWCMh1ySDKRq6DvR77Axwn2tjSC1g1rywBEAN8UBO5WHEIdjRj pc3QP9esA1nBZYbPxRBrkAZLIQ4MA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejkedguddugecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpegtggfuhfgjfffgkfhfvffosehtjehmtdhhtddvnecuhfhrohhmpefnrgif rhgvnhgtvggpgggvlhojiihquhgviicuoehvqheslhgrrhhrhihvrdhmvgeqnecuggftrf grthhtvghrnhepudektdevhedvveevheetkeehieelgeefgeehgeejuefguddtffdvudeg leeiieejnecukfhppedujedvrdehkedrvdeftddrudefleenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehvqheslhgrrhhrhihvrdhmvg X-ME-Proxy: In-Reply-To: X-Mailer: Apple Mail (2.3445.104.14) Received-SPF: pass client-ip=64.147.123.25; envelope-from=vq@larryv.me; helo=wout2-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/20 13:28:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <6BF29BAB-6F57-4D88-85BC-56E1AA14F29F@larryv.me> X-Mailman-Original-References: <051e2fbabf3a9912e5d4248efba0f02b@goncalo.pt> Xref: csiph.com gnu.bash.bug:16417 > On Jun 20, 2020, at 11:26 AM, Ilkka Virta wrote: > >> On 20.6. 3.51, correio@goncalo.pt wrote: >> >> 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". 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, > > The directory can get renamed by some completely unrelated background > process, without any action from the shell, so you'd need to recheck > it every time the prompt is printed, not just when a particular > command, or any command, is launched. (The name of the directory > could even change while the shell is waiting for a command line to > be input.) > > Running cd . should reset PWD to show the new name, and if you > need that often, I suppose you could run it from PROMPT_COMMAND: > > /tmp$ PROMPT_COMMAND='cd .' > /tmp$ mkdir old > /tmp$ cd old > /tmp/old$ mv /tmp/old /tmp/new > /tmp/new$ echo $PWD > /tmp/new Here's something fun though: $ PROMPT_COMMAND='cd .' $ readlink /tmp private/tmp $ mkdir /tmp/old $ cd /tmp/old $ echo "$PWD" /tmp/old $ mv /tmp/old /tmp/new $ echo "$PWD" /private/tmp/new Not wrong, but maybe unexpected to some. vq