Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Aug 1996 15:14:09 +1000 (EST)
From:      David Leonard <leonard@dstc.edu.au>
To:        questions@freebsd.org
Subject:   mkdir over symlinks
Message-ID:  <199608310514.PAA23562@azure.dstc.edu.au>

next in thread | raw e-mail | index | archive | help

I want to know if I can rely on a certain behaviour of symlink directory
resolution wrt mkdir and rm.

I have a symlink pointing to a non-existent directory on a 'scratch' disk,
/u3:

# ll /usr/obj
0 lrwxr-xr-x  1 root  wheel  7 Aug 19 11:35 /usr/obj@ -> /u3/obj

now, 

# rm -rf /u3/obj 

and then try to make the directory on the symlink. I tried this with 
the extensions '', '/.' and '/' of which the last form works!

# mkdir /usr/obj
mkdir: /usr/obj: File exists
# mkdir /usr/obj/.
mkdir: /usr/obj/.: No such file or directory
# mkdir /usr/obj/
# ll -d /u3/obj
4 drwxrwxr-x  2 root  wheel  512 Aug 31 14:58 /u3/obj/

question: can I rely on this behaviour of directory resolution with symlinks?
is it a posix thing? i couldnt find the relevant info on posix symlinks
(don't even know if it exists)

also, there is an analogue to 'rm -rf' where the /u3/obj directory
is deleted when you 'rm -rf /usr/obj/' but the symlink /usr/obj remains
behind. this is handy.

d
-- 
David Leonard                            Developer, DSTC
The University of Queensland             david.leonard@dstc.edu.au
					 http://www.dstc.edu.au/~leonard/
 >> Distributed Solutions Event  http://www.dstc.edu.au/events/dse96/ <<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608310514.PAA23562>