[TUHS] moving directories in svr2
    Bakul Shah 
    bakul at iitbombay.org
       
    Thu Dec 30 02:59:04 AEST 2021
    
    
  
On Dec 29, 2021, at 8:01 AM, Bakul Shah <bakul at iitbombay.org> wrote:
> On Dec 29, 2021, at 7:18 AM, Clem Cole <clemc at 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).
    
    
More information about the TUHS
mailing list