Subject: bug#34447: `pwd` doesn't show real working directory if directory is renamed by another session

From: Chris Wright <[email-masked]>
Date: Mon, 11 Feb 2019 23:33:15 +0000

Hi,

I found that if a session's working directory is renamed or moved, `pwd` doesn't show the real working directory.

Example:

Session 1:

```
~/ $ mkdir test
~/ $ cd test
~/test $ touch file
```

Session 2:

```
~/ $ mv test test_2
~/ $ mkdir test
~/ $ cd test
~/ $ touch file2
~/ $ ls
file2
~/ $
```

Session 1 (still running during session 2):

```
~/test $ ls
file
~/test $ pwd
/Users/<user>/test
~/test $ realpath file
/Users/<user>/test_2/file
~/test $ realpath nonExistenFile
/Users/<user>/test_2/nonExistenFile
```

It seems that `realpath` does show the updated path, but `pwd` doesn't

Tested on MacOS (10.14.3) and Ubuntu 16.04 / 18.04

Thanks,
Chris