On Dec 29, 2021, at 8:01 AM, Bakul Shah <bakul(a)iitbombay.org> wrote:
On Dec 29, 2021, at 7:18 AM, Clem Cole
<clemc(a)ccc.com> wrote:
Think about the UNIX FS and the link system call. How is mv implemented? You link the
file to the new directory and the unlink it from the old one. But a directory file can
not be in two directories at the same time as the .. link would fail.
Don’t see why linking a dir in two places is a problem.
To expand on this a bit, the “cd ..” case can be handled by not storing a ..
link in a dir. in the first place! Store the $PWD path in the u struct. Then
cd .. would simply lop off the last component, if one exists. Thus .. takes
you back only on the path you used! This also takes care of the issue with
symlinks (& does what csh did in user code).
Plan 9 eventually did something like this. I don't remember the
details.
Arnold