On Tue, Sep 13, 2011 at 3:15 AM, Nobuyoshi Nakada <nobu / ruby-lang.org> wrote:
> Hi,
>
> At Sun, 11 Sep 2011 23:02:39 +0900,
> Luis Lavena wrote in [ruby-core:39472]:
>> Problems:
>>
>> 1) Current symlink functionality requires not only Vista or greater
>> but also elevation of privileges to create them.
>
> It's only for creation, so it'd not be a matter at resolving.
>
>> 2) Some directory symlinks can point to UNC paths or other drive letters.
>
> Sure.   >
>> > # "Resolving hardlinks" makes no sense on any platforms.
>
> I was wrong here: it's necessary for security issues on
> Windows, because of automatically created short names.
>

It makes no problem, except current implementation has no acknowledge
for these scenarios.

Changing that right now for sure will break assumptions of lot of
programs on Windows, more on newer versions of Windows where symlinks
and hardlinks are more common (Vista, 7 and 2008 Server).

>> >> This means: build absolute path, expand if required, combine with
>> >> GetFileAttributesEx to check for existance.
>> >
>> > Is this what you want?
>> >
>> >  >> >
>>
>> Something similar, mainly because File.absolute_path is performing a
>> FindFirstFileA (globbing operation to resolve shortnames using ANSI)
>> and then winnt_stat() is doing FindFirstFileW (another globbing
>> operation) to obtain stats:
>
> Ohter API results were varying across Windows versions, so
> FindFirstFile was the last resort for stat.
>

In the context of setting Windows XP SP1 (0x0501) as minimum version,
perhaps this can be minimized?

>> From what I see here, neither File.absolute_path or File.expand_path
>> should be performing FS-operations (they don't on UNIX), the only one
>> that does is File.realpath because it resolves symlinks.
>
> The reason why they don't on UNIX is that automatically and
> implicitly created aliases are uncommon on UNIX.
>
> Since these come from the spec of Windows filesystem and
> security requirements, so it's not acceptable to change the
> behavior of File.expand_path, unfortunately.
>

Wouldn't be responsibility of File.realpath to solve
symlinks/hardlinks and shortnames?

-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupy