This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug Report: File globbing in CMD shell


--- cygwin@sourceware.cygnus.com wrote:
> On Thu, Jun 10, 1999 at 02:43:02PM -0400, Henry Gessau wrote:
> >Hmmm. That doesn't quite make sense either. I tried the same thing on
> >Solaris:
> >
> >$ ls tmpdir/*
> >tmpdir/tmp.txt
> >$ ls tmpdir\*
> >tmpdir*: No such file or directory
> >$ ls tmpdir\\*
> >ls: No match.
> >$ ls tmpdir\tmp.txt
> >tmpdirtmp.txt: No such file or directory
> 
> As I stated in another mail, the arguments to a cygwin program are not
> globbed unless an unquoted wildcard character is seen.  Cygwin does
> collapse a quoted backslash to a backslash, however.  It also leaves
> single backslashes, that do not quote anything "special", alone.
> 
> I don't see this as being too inconsistent.  We can't emulate UNIX
> behavior 100% because backslashes do mean something to Windows.
> 

I'd like to add that you need to understand the code for ls also.  It doesn't
do any globbing on it's own unless it has no arguments.  ls just prints the
list of arguments that it gets checking the status using the stat/lstat
functions.  Having said that then a stat of tmpdir/* or tmpdir\* by ls is
always going to return an error because the file tmpdir/* doesn't exist.

Also, when using the CMD.EXE/COMMAND.COM shells you also have to live with the
rules of quoting behavior it has which is by no means anything that is
friendly.  I found the description once at the MSDN sight but haven't the
reference to give.  I suggest for the DOS shell that you use the ^ character
for quoting as the \ has a different rule than what you'd expect it to have and
the ^ character has the same rule as you would expect for \.

Note the stated problem only exists for wildcard globbing.  In both bash and
dos ls tmpdir\\tmp.txt will display the file as expected while as stated
tmpdir\\* doesn't work in either.  This is a problem with the resolution of \\*
in the reglobbing routines that happen before the child is started.

I have a version of ls that I built with mingw32.  The globbing routine from
the Win32 api that is in the mingw32 crt1 handles both ..\tmpdir\* and
../tmpdir/* correctly and ls displays the slash in the direction I keyed it.
===
YAWIA,
Earnie Boyd <mailto:earnie_boyd@yahoo.com>

Newbies, please visit
<http://www.freeyellow.com/members5/gw32/index.html>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]