lkml.org 
[lkml]   [2002]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: Symlink indirection
    Date
    On Friday 13 December 2002 09:30 am, Richard B. Johnson wrote:
    > On Fri, 13 Dec 2002, Marc-Christian Petersen wrote:
    > > On Friday 13 December 2002 16:06, Andrew Walrond wrote:
    > >
    > > Hi Andrew,
    > >
    > > > 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?
    > >
    > > fs/namei.c
    > >
    > > if (current->link_count >= 5)
    > >
    > > change to a higher value.
    > >
    > > So, the answer is: Kernel :)
    > >
    > > ciao, Marc
    >
    > No, that thing (whetever it is) is different.
    >
    > Script started on Fri Dec 13 10:26:30 2002
    > # file *
    > foo: symbolic link to ../foo
    > typescript: empty
    > # pwd
    > /root/foo
    > # cd *
    > # cd *
    > # cd *
    > # cd *
    > # cd *
    > # cd *
    > # pwd
    > /root/foo/foo/foo/foo/foo/foo/foo
    > # cd *
    > # cd *
    > # cd *
    > # pwd
    > /root/foo/foo/foo/foo/foo/foo/foo/foo/foo/foo
    > # cd *
    > # cd *
    > # cd *
    > # pwd
    > /root/foo/foo/foo/foo/foo/foo/foo/foo/foo/foo/foo/foo/foo
    > # exit
    > exit
    >
    > Script done on Fri Dec 13 10:27:21 2002
    >
    >
    > You can do this until you run out of string-space. Your "link-count"
    > has something to do with something else.

    Example isn't the same thing:

    [pollard@merlin ~/test]$ echo "test" >target
    [pollard@merlin ~/test]$ ln -s target a - 1 link
    [pollard@merlin ~/test]$ ln -s a b - 2 links
    [pollard@merlin ~/test]$ ln -s b c - 3
    [pollard@merlin ~/test]$ ln -s c d - 4
    [pollard@merlin ~/test]$ cat d
    test
    [pollard@merlin ~/test]$ ln -s d e -5
    [pollard@merlin ~/test]$ cat e
    test
    [pollard@merlin ~/test]$ ln -s e f -6
    [pollard@merlin ~/test]$ cat f
    cat: f: Too many levels of symbolic links

    This catches problem situations like:

    [pollard@merlin ~/test]$ ln -s loop loop
    [pollard@merlin ~/test]$ ls -l loop
    lrwxrwxrwx 1 pollard NA0101 4 Dec 13 10:24 loop -> loop
    [pollard@merlin ~/test]$ cat loop
    cat: loop: Too many levels of symbolic links

    --
    -------------------------------------------------------------------------
    Jesse I Pollard, II
    Email: pollard@navo.hpc.mil

    Any opinions expressed are solely my own.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:31    [W:0.022 / U:0.208 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site