problems with the ln command

Patrick Boutilier boutilpj at ednet.ns.ca
Mon Jul 5 19:24:49 UTC 2004



Fons van der Beek wrote:
>>>Hello all,
>>>
>>> I am having a bit of a problem with the ln command.
>>>If i give the command
>>>
>>>    ln -s "/data/mp3/Nelly" "/datastore/alfabet/N/Nelly"
>>>
>>>Then I expect only in the directory "/datastore/alfabet/N/"
>>>a symboly link named  "Nelly" being created.
>>>BUT also (!) in  "/data/mp3/Nelly" a symbolic link "Nelly"
>>>is created and it is referenced to /data/mp3/Nelly
>>>(there was already a directory calles "DaDerrty.......blablabla)
>>>
>>>drwxrwxrwx    3 apache apache  4096 Jul  5 15:12 .
>>>drwxrwxrwx  403 apache apache 12288 Jul  4 09:58 ..
>>>drwxrwxrwx    2 apache apache  4096 May  5 11:29
> 
> DaDerrtyVersionsTheReinven
> 
>>>lrwxrwxrwx    1 root   root      15 Jul  5 15:12 Nelly ->
> 
> /data/mp3/Nelly
> 
>>>What am i doing wrong ?????????????????????????
>>
>>The ln command looks fine. Are you sure you didn't accidentally create
>>the link  Nelly -> /data/mp3/Nelly  when you were trying to create the
>>link previously?
> 
> nope
> 
>>Remove the bogus link and the correct link. Then try:
>>
>>ln -s "/data/mp3/Nelly" "/datastore/alfabet/N/Nelly"
>>
>>again. Should not get the bogus link.
>>
>>
> 
> 
> (?) Solved (?): Cure found -> illnes unknown
> When the target link already exists the the problem occurs!
> So:
> rm  "/datastore/alfabet/N/Nelly"
> ln -s "/data/mp3/Nelly" "/datastore/alfabet/N/Nelly"
> is ok, but a second
> ln -s "/data/mp3/Nelly" "/datastore/alfabet/N/Nelly"
> creates the link in the origin....!
> 
> is this is a bug??? or is this RTFM related??


That is correct behaviour because the second time you run the command 
you are creating the link in directory /datastore/alfabet/N/Nelly which 
is a link.





> I tried if this problem only occurs on mounted directories but no, it is not
> mount related.
> 
> Now when i think about it, in the "old days" there was a problem with
> symbolic links on a root drive
> but that was solved years ago.... (old days = SGI IRIX 4.x or something)
> 
> 
> 
> 
> 
> 





More information about the fedora-list mailing list