On 01/29/2011 10:33 AM, Vt Ondruch wrote:
> Dne 29.1.2011 17:27, Jeremy Bopp napsal(a):
>> On 01/29/2011 10:19 AM, Nobuyoshi Nakada wrote:
>>> Issue #4343 has been updated by Nobuyoshi Nakada.
>>>
>>>
>>>> Why there is for the first case listed "bla." instead of just "bla".
>>> Because you gave "bla.".  Dir.glob respects the given pattern as
>>> possible.
>>> And "bla." and "bla" are same on NTFS.
>> Wouldn't that fact imply that "bla.*" should also match "bla" in that
>> case?  I think that is where the confusion lies.  Some globs, such as
>> "bla.*", won't match "bla" while others, such as "bla.", will match.
>>
>> I would argue that for compatibility reasons, globbing on "bla." should
>> *not* match even on Windows.  Globbing under the Windows cmd shell is
>> different than under Unix shells, but Ruby should enforce a single
>> globbing strategy for all supported platforms for consistency.
>>
>> -Jeremy
>>
> 
> Well ruby should enforce as much as it can, but you should remember that
> while you can do this on linux:
> 
> vita@vita-desktop:~$ echo something > bla
> vita@vita-desktop:~$ echo something > bla.
> vita@vita-desktop:~$ ls bla*
> bla  bla.
> 
> 
> the windows version will have different result no matter what:
> 
> 
> C:\temp>echo something > bla
> 
> C:\temp>echo something > bla.
> 
> C:\temp>dir bla*
>  Svazek v jednotce C je Windows7_x64_OS.
>  Sriov slo svazku je 2C6E-5F69.
> 
>  Vpis adrese C:\temp
> 
> 29.01.2011  17:31                12 bla
>            Soubor:      1,   Bajt:                     12
>            Adres:     0,   Volnch bajt: 21 459 759 104
> 
> C:\temp>dir bla*.*
>  Svazek v jednotce C je Windows7_x64_OS.
>  Sriov slo svazku je 2C6E-5F69.
> 
>  Vpis adrese C:\temp
> 
> 29.01.2011  17:31                12 bla
>            Soubor:      1,   Bajt:                     12
>            Adres:     0,   Volnch bajt: 21 459 759 104

My ultimate argument is that Ruby should support only Unix-style
globbing, except in cases where a cross platform extension to globbing
is implemented.  Globbing under the Windows cmd shell is slightly
broken, IMHO.  I agree that Windows users expect globbing to be
implemented like that, but having slightly different globbing
implementations in Ruby makes it much more difficult than it needs to be
to write cross platform Ruby scripts.

I could possibly see adding a new flag for globbing that enables
Windows-style globbing for any platform, but that should never be
enabled by default.  Most scripts using globbing probably expect
Unix-style globbing since that is basically what we have now.  Enabling
Windows-style globbing by default would likely introduce subtle defects
in those scripts.

-Jeremy