apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe Jr." <wr...@apache.org>
Subject Re: Researched and adapted pre-vista/2008 windows symlinks
Date Thu, 28 Jul 2011 20:38:52 GMT
On 7/28/2011 1:15 PM, Bert Huijben wrote:
> 
>> -----Original Message-----
>> From: Mladen Turk [mailto:mturk@apache.org]
>> Sent: donderdag 28 juli 2011 22:07
>> To: Bert Huijben
>> Subject: Re: Researched and adapted pre-vista/2008 windows symlinks
>>
>> On 07/28/2011 09:22 PM, Bert Huijben wrote:
>>>
>>>>
>>>> So just asking, should we adopt this, before I start to work on it?
>>>
>>
>> Attached a working solution :)
>> The APR-zing should be quite simple
>>
>>
>>> I don't think we should implement 'fake symlinks' for Windows as
>> suggested here (and a few times on the Subversion list). That deliberately
>> introduce a compatibility problem with the real symlinks that are supported
>> on Windows Vista and later. And because we use an alternative symlink, we
>> would have to maintain the not-real-thing forever and can't start supporting
>> the real thing. And normal Windows applications would do everything in a
>> different way.
>>>
>>
>> FYI on Vista+ symlinks *are* Junction points. Their limit is still 32 per dir.
>> It just happens Microsoft created an nice API for making them.
> 
> F:\tst>dir
>  Volume in drive F is Projects
>  Volume Serial Number is 8817-32E5
> 
>  Directory of F:\tst
> 
> 28-07-2011  22:12    <DIR>          .
> 28-07-2011  22:12    <DIR>          ..
> 28-07-2011  22:10    <SYMLINKD>     dirlink [subdir]
> 28-07-2011  22:11                 3 file
> 28-07-2011  22:12    <SYMLINK>      filelink [file]
> 28-07-2011  22:11    <JUNCTION>     junction [F:\tst\subdir]
> 28-07-2011  22:10    <DIR>          subdir
>                2 File(s)              3 bytes
>                5 Dir(s)  97.194.647.552 bytes free
> 
> F:\tst>
> 
> How can dir see the difference if they are supposed to be the same thing?
> 
> My documentation says (if I remember correctly) they are stored in completely different
ways: One as a specific NTFS object type and one as a reparse point with external data.

They are two different things, however...

  Mount Points are Reparse Points
  Junctions are Reparse Points
  Directory Symlinks are Reparse Points
  File Symlinks are Reparse Points

Junctions are not mount points are not directory symlinks are not file symlinks.

However, directory symlinks, file symlinks and junctions share common characteristics.

Both junctions and directory symlinks may point at directories.  Junctions must
be absolute links.  Mladen could rename c:\tmp to c:\tmp2 and the relative dir
symlink would not be broken, any junction or absolute directory symlink would be
broken.  To support creating junctions, apr would have to translate relative links
into absolute links, possibly to the developer's surprise.

>From apr's own perspective, both must be reported as symlinks.

File symlinks and hardlinks both must point to files.  Obviously ntfs cannot
distinguish between the original file and additional hardlinks.  But using
Garrett's suggestion on win2003, we can (using an additional stream to tag
the canonical name of the file) for a faux-hardlinked softlink we create.

>From apr's perspective, both can be reported as symlinks.

Obviously, any create softlink feature of apr must distinguish whether the
target is a file or a directory, and while it is at it, it would be trivial
to work around permission issues using a fallback approach.

All of the above will be traversed in the same manner as unix symlinks.
It is agreeably stupid that create-symlink permissions were more narrow
than either hardlink or junction creation, but that is what we have.

Nobody is suggesting supporting .lnk files.

Please re-review Garrett's solution in light of this information.


Mime
View raw message