-----BEGIN PGP SIGNED MESSAGE-----

On Thursday 27 Feb 2003 2:23 am, Patrick Lesslie wrote:

> # ln /tmp /tmp2
> ln: `/tmp': hard link not allowed for directory

This is an error generated by the "ln" command doing its own checks on the 
arguments and deciding you're not allowed to do it.

> # ln --directory /tmp /tmp2
> ln: creating hard link `/tmp2' to `/tmp': Operation not permitted

This is an error from the OS being reported by "ln" after trying to do the 
link.  Thus your kernel is prohibiting the symlink, even though "ln" will 
allow you to try it.

Remember the GNU fileutils are for more than just Linux, and there will be 
systems out there that support this.

Further investigation shows that under Linux this is a feature of the 
filesystem, rather than being enforced generically across the kernel. So, in 
both /usr/src/linux/fs/ext3 and /usr/src/linux/fs/ext2 you will find the 
following check in namei.c in the functions ext3_link() and ext2_link() 
respectively:

        if (S_ISDIR(inode->i_mode))
                return -EPERM;

Thus, if you are trying to link to a directory then return EPERM, which is 
translated to "Operation not permitted" by the "ln" command.

ReiserFS does an identical check too.

It looks like XFS does a similar check as well (but it's not as clear).

cheers,
Chris
- -- 
 Chris Samuel  :  http://csamuel.org/  :  Wollongong, NSW

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iQEVAwUBPl1yuo1yjaOTJg85AQFrzgf/UplZrYP+Ul+dlMMwmUxqPd2ZkPbiVSlu
SbP08ZEokJBrquNUG950mIfmoyw215azNw7YdVCoMV3fvllA+0sMLRiJ0J/OyCN+
Ltsa3oLlJpoWGl2LyQxDsng3mGEsD9bdBVgNrG4RVvJgDIox5PRARhbomFoKG/H9
pk93tgg7BH3j5Am+iZUuhVDvThSTd4oiPFoAul5YtEVjzU/mQbdDRh4k4ZpUHfgG
e52eT2aBf6ng7wSn8DuxbXC1keVxq0oojNAeUdUGdRInpt7/j/oz6WzoZJYXHkmr
hphf53GR3d/OwTzE7nnvTXshrWmeHH/VMy8WSwqLvbzHjK8EVYUTjQ==
=WoZR
-----END PGP SIGNATURE-----

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to