mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amos Waterland <apw@us.ibm.com>
To: Jeff Bailey <jbailey@nisa.net>
Cc: root@chaos.analogic.com, Andrew Walrond <andrew@walrond.org>,
	linux-kernel@vger.kernel.org, libc-alpha@sources.redhat.com
Subject: Re: Symlink indirection
Date: Fri, 13 Dec 2002 11:15:16 -0600	[thread overview]
Message-ID: <20021213111515.A26218@kvasir.austin.ibm.com> (raw)
In-Reply-To: <1039798306.921.11.camel@outpost.dnsalias.org>; from jbailey@nisa.net on Fri, Dec 13, 2002 at 11:51:46AM -0500

I think that you and Richard are dicussing a slightly different issue
than the original poster asked about.  The original question was:

On Fri, 13 Dec 2002, Andrew Walrond wrote:
> Is the number of allowed levels of symlink indirection (if that is the 
> right phrase; I mean symlink -> symlink -> ... -> file) dependant on the 
> kernel, or libc ? Where is it defined, and can it be changed?

To which Richard replied:

> Since a symlink is just a file containing a name, the resulting path
> length is simply the maximum path length that user-space tools allow.
> This should be defined as "PATH_MAX". Posix defines this as 255
> characters but I think posix requires that this be the minimum and all
> file-name handling buffers must be at least PATH_MAX in length.
>
> A hard link is just another directory-entry for the same file. This,
> therefore follows the same rules. There must be enough space on the
> device to contain the number of directory entries, as well as enough
> buffer length in the tools necessary to manipulate these "nested"
> directories, which are not really "nested" at all. 

But Richard is not actually completely correct.  There is a limit of 5
levels of symlink indirection in vanilla 2.4 series Linux kernels.

  % touch 0
  % for i in `seq 1 10`; do ln -s `ls | sort | tail -1` $i; done
  % ls
  0  1  10  2  3  4  5  6  7  8  9
  % cat 5
  % cat 6
  cat: 6: Too many levels of symbolic links
  % strace cat 6 2>&1 | grep 'open("6",'
  open("6", O_RDONLY|O_LARGEFILE) = -1 ELOOP (Too many levels of symbolic links)

This has been discussed by Al Viro et al. many times on lkml.  I believe
that it is not a user-space or POSIX issue, but rather a kernel issue.
Thanks.

Amos Waterland

  reply	other threads:[~2002-12-13 17:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-13 15:06 Andrew Walrond
2002-12-13 15:11 ` Marc-Christian Petersen
2002-12-13 15:20   ` Andrew Walrond
2002-12-13 17:22     ` Alan Cox
2002-12-13 15:30   ` Richard B. Johnson
2002-12-13 16:17     ` James Antill
2002-12-13 16:34       ` Andrew Walrond
2002-12-13 17:24         ` James Antill
2002-12-13 16:24     ` Andrew Walrond
2002-12-13 16:26     ` Jesse Pollard
2002-12-13 15:23 ` Richard B. Johnson
2002-12-13 16:41   ` Alfred M. Szmidt
2002-12-13 16:51   ` Jeff Bailey
2002-12-13 17:15     ` Amos Waterland [this message]
2002-12-13 17:51       ` Richard B. Johnson
     [not found] ` <mailman.1039792562.8768.linux-kernel2news@redhat.com>
2002-12-13 16:16   ` Pete Zaitcev
2002-12-13 16:48     ` Andrew Walrond
2002-12-13 16:55       ` Pete Zaitcev
2002-12-13 17:04         ` Andrew Walrond
2002-12-14  5:57           ` Joseph Fannin
2002-12-14 12:47             ` Andrew Walrond
2002-12-14 13:55               ` John Bradford
2002-12-14 14:00                 ` Andrew Walrond
2002-12-14 16:13                   ` John Bradford
2002-12-14 19:50                   ` Stephen Wille Padnos
2002-12-15  0:41                     ` Andrew Walrond
2002-12-23  5:58                       ` Thomas Zimmerman
2002-12-13 17:32     ` James Antill
     [not found] <fa.eib7vkv.1tju08k@ifi.uio.no>
     [not found] ` <fa.cnblikv.qjmuqd@ifi.uio.no>
2002-12-15  7:24   ` junkio
2002-12-15 12:17     ` Andrew Walrond
2002-12-15 12:58       ` John Bradford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021213111515.A26218@kvasir.austin.ibm.com \
    --to=apw@us.ibm.com \
    --cc=andrew@walrond.org \
    --cc=jbailey@nisa.net \
    --cc=libc-alpha@sources.redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®