delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/10/24/06:34:19

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: <ams AT ludd DOT ltu DOT se>
Message-Id: <200410241033.i9OAXDd3000526@speedy.ludd.ltu.se>
Subject: Re: bug in __solve_symlink()
In-Reply-To: <41238053.6000205@ujf-grenoble.fr> "from Maurice Lombardi at Aug
18, 2004 06:14:11 pm"
To: djgpp-workers AT delorie DOT com
Date: Sun, 24 Oct 2004 12:33:13 +0200 (CEST)
CC: Maurice DOT Lombardi AT ujf-grenoble DOT fr
X-Mailer: ELM [version 2.4ME+ PL78 (25)]
MIME-Version: 1.0
X-ltu-MailScanner-Information: Please contact the ISP for more information
X-ltu-MailScanner: Found to be clean
X-MailScanner-From: ams AT ludd DOT ltu DOT se
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

According to Maurice Lombardi:
> I thus added a new test modelled from the previous one in the suite with the following diff
> 
> --- tests\libc\compat\unistd\xsymlink.c.orig	2003-02-10 21:41:10.000000000 +0000
> +++ tests\libc\compat\unistd\xsymlink.c	2004-08-18 17:40:58.000000000 +0000

1. You should use forward slashes when generating patches. As it is it
won't apply.

2. Even when I corrected that it wouldn't apply. I don't know why but
I suspect your mail tool messed up on spaces or something.


> --- src\libc\compat\unistd\xsymlink.c.orig	2003-02-06 20:42:38.000000000 +0000
> +++ src\libc\compat\unistd\xsymlink.c	2004-08-02 15:57:42.000000000 +0000
> @@ -74,7 +74,9 @@
>       */
>      start = __real_path;
>      end = strpbrk(__real_path, "/\\");
> -   if (!end || (start == end))
> +   if (start == end)
> +      end = strpbrk(__real_path + 1, "/\\");
> +   if (!end)
>         end = __real_path + strlen(__real_path);
>      while (start && *start)
>      {

I've applied the test diff and the above src diff and results are as
Maurice tells us.

Hence I'm going to commit this sometime (inlcuding the test diff that
I've cut out), unless somebody objects. Note that I haven't tried to
understand the symlink code; my observations are based on the new test
case. So I sure hope this is correct.

> recompiling src and running the same test gives
> 
> DJ204 C:\dj204\tests\libc\compat\unistd>xsymlink
> Running __solve_symlinks() and readlink() testsuite:
...
> Tests that check __solve_symlinks() based on current directory:
> Test 1: Solving c:/dj204/tests/libc/compat/unistd/../../../../../dj204/tests/lib
> c/compat/unistd/test1
> Test 1 passed
> Test 2: Solving /dj204/tests/libc/compat/unistd/../../../../../dj204/tests/libc/
> compat/unistd/dir1/test1
> Test 2 passed
> Test 3: Solving c:../../../../../dj204/tests/libc/compat/unistd/test1
> Test 3 passed
> Test 4: Solving c:../../../../../../dj204/tests/libc/compat/unistd/test1
> Test 4 failed - __solve_symlinks returns wrong resolved path
> Returned path: c:/dj204/tests/libc/compat/unistd/test1
> Expected path: c:/dj204/tests/libc/compat/unistd/file1
> Tests that check __solve_symlinks() failure cases:
> Test 1 passed
> Test 2 passed
> FAIL
> 
> Test 2 of the second series now succeeds as expected.
> 
> Test 4 which fails in both cases was described in a thread on djgpp-workers
> in 2003/02: it occurs with Win98se (I use), not with Win2k, and apparently
> it remained as is since then.

I eagerly await your correction for test case 4
above. (Hint-hint-nudge-nudge-wink-hint.)


Right,

						MartinS

- Raw text -


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