delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/16/12:23:04

Message-ID: <3E26F8E8.2080709@mif.vu.lt>
Date: Thu, 16 Jan 2003 19:24:40 +0100
From: Laurynas Biveinis <laurynas DOT biveinis AT mif DOT vu DOT lt>
Organization: VU MIF
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130
X-Accept-Language: lt, en, en-us
MIME-Version: 1.0
To: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
CC: DJGPP Workers <djgpp-workers AT delorie DOT com>
Subject: Re: Rewritten __solve_symlinks to fix bugs [PATCH]
References: <E18ZBjr-0000Mi-00 AT phekda DOT freeserve DOT co DOT uk>
In-Reply-To: <E18ZBjr-0000Mi-00@phekda.freeserve.co.uk>
X-OriginalArrivalTime: 16 Jan 2003 17:22:42.0905 (UTC) FILETIME=[E0C33490:01C2BD83]
Reply-To: djgpp-workers AT delorie DOT com

Richard Dawe wrote:
> Hello.
> 
> I mentioned a while ago that __solve_symlinks() doesn't work
> with relative symlinks that have too many ".."s, i.e.: when they
> have more ".."s than required to reach the root directory.
> 
> (It's possible that it also does not work with symlinks to a file
> in a directory accessed via a symlink to the directory. E.g.:
> 
>     mkdir foo
>     touch foo/bar
>     ln -s foo baz
>     cat baz/foo
               ^^^
               bar ?

I'm not sure I understand the situation you describe here, but previous 
implementation should work with commands as you have written them.

> * How do you know how many directory levels are present? If you have
>   a path like /dev/env/DJDIR, then you need to expand it, to find out
>   how many directory levels are present.
> 
> * How do you collapse ".."s. You could call _fixpath(), but you have to be
>   careful - that may over-optimise and remove too many ".."s. You can only
>   call _fixpath() on what you have resolved so far.

Uhm, I guess I could fix these with current implementation. Of course, I 
cannot tell for sure without trying first :)

> * It's a complete rewrite.

Of course I'm biased here, because my code is being thrown out here :) 
but is a complete rewrite justified? Current algorithm has been in 
testing for some time already. It does not have serious design issues
or at least the basic algorithm is identical with yours.

Would you be satisfied if I tried to make current implementation work 
with your testcases over a weekend? I'm sorry I have missed discussion 
about these bugs (busy times).

If it turns out that fixing these requires more work than I'm expecting, 
then I'm fine with your implementation.

--
Laurynas



- Raw text -


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