|
From: | Jan Schampera |
Subject: | Re: pwd does not update when path component is renamed |
Date: | Mon, 20 Sep 2010 23:15:11 +0200 |
User-agent: | Mozilla-Thunderbird 2.0.0.24 (X11/20100329) |
Krzysztof Zelechowski wrote:
Description: The text of pwd and the value of $PWD return a cached value, regardless of the actual current path. Repeat-By: mkdir '-p' 'a' && cd 'a' && mv '../a' '../b' && enable '-n' 'pwd' && builtin 'pwd' && pwd Fix: cd '-P' '.'
I think it's the same mechanism that catches symlinked directory names, i.e. the shell has its own "view" to the filesystem.
For symlinked directories this is not a bug.For this case, I don't think there's a reliable and portable way to catch it. The open directory is valid (since it's open) for the shell process, but $PWD given to other programs will make them fail. But i don't think a getcwd() after every command or every now and then is efficient.
The"no solution provided"Bonsai
[Prev in Thread] | Current Thread | [Next in Thread] |