Re: Fw: Case-sensitive :e globbing under cygwin?

2007-03-16 Thread A.J.Mechelynck

John Wiersba wrote:

Thanks, Tony, for your reply.


My pleasure. I did see this present post of yours on the list; the reason I 
didn't answer is I had nothing significant to contribute.




As far as I can tell everything is set up to give case-sensitive 
globbing.  Bash does case-sensitive globbing at the command line and in 
a simple script


#!/bin/bash
echo file*

Do you believe vim is shelling out to do globbing under cygwin, rather 
than doing globbing internally?  I tried to verify that vim is calling 
/bin/sh by replacing /bin/sh.exe with a script /bin/sh which leaves a 
debugging trail.  But it appears that /bin/sh is not being called for :e 
file* (it is called for :sh, however).


I had the impression it did; but I guess I was wrong.



Is there an easy way to debug this from within vim?  I see what appear 
to be various debugging commands in the source code.  Is it easy to 
enable them and see their output somewhere?  


If exists(:debug) returns 2, you can (a) use the :debug command or start Vim 
with the -D command-line switch, which will give you a  prompt for each 
ex-command, at which point you can examine variables etc.; and (b) set 
breakpoints etc. in vimscript. Output is to the bottom of the Vim window (like 
:echo, :version, etc.), so you should use this neither for commands which 
modify the contents of the file windows, nor for Insert mode.


See :help debug-scripts.

There is also a project whose name I have forgotten, but which you should be 
able to find either at vim-online or by searching the vim-dev archive, to 
allow easier debugging of the Vim C code with gdb (if compiled with gcc). To 
use that at the fullest, you should have the Vim sources from which you 
compiled your own Vim, and use a Vim executable with symbols, i.e., the one in 
src/ which came out of the make process, not the one which make install 
wrote (after stripping) in /usr/local/bin (assuming a Unix-like Vim).




Is there anything else you can think of to solve this?


No there isn't; that's why I didn't answer when you sent this same email to 
the list.




-- John


Best regards,
Tony.
--
Xerox does it again and again and again and ...



Re: Fw: Case-sensitive :e globbing under cygwin?

2007-03-16 Thread Michael Schaap

On 16-Mar-2007 20:59, A.J.Mechelynck wrote:




As far as I can tell everything is set up to give case-sensitive 
globbing. Bash does case-sensitive globbing at the command line and 
in a simple script


#!/bin/bash
echo file*

Do you believe vim is shelling out to do globbing under cygwin, 
rather than doing globbing internally? I tried to verify that vim is 
calling /bin/sh by replacing /bin/sh.exe with a script /bin/sh which 
leaves a debugging trail. But it appears that /bin/sh is not being 
called for :e file* (it is called for :sh, however).


I had the impression it did; but I guess I was wrong.

Indeed, vim does its own globbing; it looks like the main function for 
this is ExpandOne() in ex_getln.c.
It determines whether to do based on whether CASE_INSENSITIVE_FILENAME 
is #define'd. For Cygwin, this is done in os_unix.h:


#if defined(__CYGWIN__) || defined(__CYGWIN32__)
# define WIN32UNIX /* Compiling for Win32 using Unix files. */
# define BINARY_FILE_IO

# define CASE_INSENSITIVE_FILENAME
# define USE_FNAME_CASE /* Fix filename case differences. */
#endif

Like it or not, this is the proper thing to do on Cygwin, since any 
normal Windows file systems are case insensitive.
Arguably, this should be a file system property, not an operating system 
property – after all, you can mount a case-insensitive Windows file 
system under Linux. But I doubt that there is a good way to determine 
this on a file system by file system basis...


It would perhaps be an improvement if this was an option, instead of a 
compile-time decision. But there's an awful lot of #ifdef 
CASE_INSENSITIVE_FILENAME's in the code, so that's probably a rather 
non-trivial change...


– Michael


Re: Fw: Case-sensitive :e globbing under cygwin?

2007-03-16 Thread John Wiersba
Michael,

Thanks for your reply.  You're right -- disabling the CASE_INSENSITIVE_FILENAME 
compile-time option changes this behavior.  However, I disagree that case 
insensitivity is the correct behavior.  Cygwin is perfectly capable of 
supporting case-sensitive globbing behavior and unix tools, by default, do just 
that when run under cygwin.  For example, bash is, by default, case-sensitive 
under cygwin.  So, I submitted a bug report.

-- John

- Original Message 
From: Michael Schaap [EMAIL PROTECTED]
To: A.J.Mechelynck [EMAIL PROTECTED]
Cc: John Wiersba [EMAIL PROTECTED]; Vim mailing list vim@vim.org
Sent: Friday, March 16, 2007 4:21:01 PM
Subject: Re: Fw: Case-sensitive :e globbing under cygwin?

On 16-Mar-2007 20:59, A.J.Mechelynck wrote:


 As far as I can tell everything is set up to give case-sensitive 
 globbing. Bash does case-sensitive globbing at the command line and 
 in a simple script

 #!/bin/bash
 echo file*

 Do you believe vim is shelling out to do globbing under cygwin, 
 rather than doing globbing internally? I tried to verify that vim is 
 calling /bin/sh by replacing /bin/sh.exe with a script /bin/sh which 
 leaves a debugging trail. But it appears that /bin/sh is not being 
 called for :e file* (it is called for :sh, however).

 I had the impression it did; but I guess I was wrong.

Indeed, vim does its own globbing; it looks like the main function for 
this is ExpandOne() in ex_getln.c.
It determines whether to do based on whether CASE_INSENSITIVE_FILENAME 
is #define'd. For Cygwin, this is done in os_unix.h:

#if defined(__CYGWIN__) || defined(__CYGWIN32__)
# define WIN32UNIX /* Compiling for Win32 using Unix files. */
# define BINARY_FILE_IO

# define CASE_INSENSITIVE_FILENAME
# define USE_FNAME_CASE /* Fix filename case differences. */
#endif

Like it or not, this is the proper thing to do on Cygwin, since any 
normal Windows file systems are case insensitive.
Arguably, this should be a file system property, not an operating system 
property – after all, you can mount a case-insensitive Windows file 
system under Linux. But I doubt that there is a good way to determine 
this on a file system by file system basis...

It would perhaps be an improvement if this was an option, instead of a 
compile-time decision. But there's an awful lot of #ifdef 
CASE_INSENSITIVE_FILENAME's in the code, so that's probably a rather 
non-trivial change...

– Michael





 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/


Re: Fw: Case-sensitive :e globbing under cygwin?

2007-03-16 Thread Michael Schaap

On 16-Mar-2007 23:13, John Wiersba wrote:

Thanks for your reply.  You're right -- disabling the CASE_INSENSITIVE_FILENAME 
compile-time option changes this behavior.  However, I disagree that case 
insensitivity is the correct behavior.  Cygwin is perfectly capable of 
supporting case-sensitive globbing behavior and unix tools, by default, do just 
that when run under cygwin.  For example, bash is, by default, case-sensitive 
under cygwin.  So, I submitted a bug report.
  

Well, one man's bug is another man's feature...
The case-preserving behaviour was changed for Cygwin in response to 
specific bug reports 
(http://marc.theaimsgroup.com/?l=vim-devm=113241809109203w=2), so 
it'd better not be changed back...


– Michael