Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Watch out for mv command and symlinks on Samba shares' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Watch out for mv command and symlinks on Samba shares
Authored by: beerguy on Nov 06, '03 11:21:16AM

Actually I think there is a bug here but it's not what the poster was geting at. The mv command should complain that target and destination are the same file.

[iMac-otto:~] otto% mkdir something
[iMac-otto:~] otto% ln -s something something_else
[iMac-otto:~] otto% cd something_else
[iMac-otto:~/something_else] otto% touch foo
[iMac-otto:~/something_else] otto% mv foo ../something
[iMac-otto:~/something_else] otto% ls
foo
[iMac-otto:~/something_else] otto% cd ..
[iMac-otto:~] otto% cd something
[iMac-otto:~/something] otto% ls -l
total 0
-rw-r--r-- 1 otto staff 0 6 Nov 08:13 foo


It works like it's supposed to here. It is considered bad form to not use full pathnames when making sym links.


Also consider the directory structure when you link.

Let's say I had a directory called /data/stuff/files

and I link it to /users/mystuff/files/backup

(cd /users/mystuff/files; ln -s /data/stuff/files backup)

If I cd /users/mystuff/files/backup and then do a cd .. I will be in /data/stuff not /users/mystuff/files. That can lead to confusion and files that seem to be lost but really aren't.

Cheers



[ Reply to This | # ]
Watch out for mv command and symlinks on Samba shares
Authored by: mojo6771 on Nov 06, '03 12:21:19PM
On freebsd 4.5, the move works without a error.

On Redhat 6.2 it gives a error as: mv: `c' and `../a/c' are the same file.

--
From the above post, it appears OS X works similar to freebsd.
The Samba share is most likely messing up.


[ Reply to This | # ]