delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/13/13:10:03

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E22E29B.27FEF1B7@phekda.freeserve.co.uk>
Date: Mon, 13 Jan 2003 16:00:27 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Bugs in __solve_symlinks
References: <200212192013 DOT gBJKDm125557 AT brother DOT ludd DOT luth DOT se> <3E02432B DOT EF550904 AT phekda DOT freeserve DOT co DOT uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Richard Dawe wrote:
[snip]
> So if I stat 'a' above, I would expect it to resolve the symlink to 'a' and
> then return information about the symlink 'a', e.g.: the st_mode field would
> have the S_IFLNK bit set.
> 
> Hmmm, it doesn't work that on Linux. Test program:
> 
> ---Start teststat.c---
> #include <stdio.h>
> #include <stdlib.h>
> #include <sys/stat.h>
> #include <unistd.h>
> 
> int
> main (int argc, char *argv[])
> {
>   struct stat sbuf;
>   int ret, i;
> 
>   for (i = 1; i < argc; i++) {
>     ret = stat(argv[i], &sbuf);
>     if (ret < 0)
>       perror(argv[0]);
>   }
> 
>   return(EXIT_SUCCESS);
> }
> ---End teststat.c---
> 
> iolanthe:~ =] ln -nsf a a
> iolanthe:~ =] ls -l a
> lrwxrwxrwx    1 rich     rich            1 Dec 19 22:05 a -> a
> iolanthe:~ =] ./src/tmp/teststat a
> ./src/tmp/teststat: Too many levels of symbolic links
> 
> I guess I read the standard wrong. Sorry.
> 
> The left 'a' in 'a -> a' above is bright blue, to indicate that the link is
> satisfied. An equivalent test with DJGPP shows the left 'a' in black on a
> red background, indicating that the link is broken. I wonder why that is.

Well, it turns out that my Linux set-up (RedHat Linux 6.2) has the same
colour-coding for satisfied and unsatisfied symlinks. I think it's a
relatively recent addition to have different colours for the two cases.

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019