Subject: Re: `find' command broken.
From: [email-masked] ("$Bill Luebkert")

12 Jul 1997 22:31:20 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <19970711092719531.AAA303@TENDLE> 				<[email-masked]> <19970711133409718.AAA335@TENDLE> <[email-masked]> <[email-masked]> <[email-masked]> <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (Win95; I)
Original-To: Fergus Henderson <[email-masked]>
Original-CC: [email-masked]
Original-Sender: [email-masked]

Fergus Henderson wrote:
> 
> The relevent source is winsup/dcrt0.cc,
> which contains the startup code for cygwin.dll:
> 
>           /* Expand *.c, etc.  */
>           if (! u->self->cygwin_parent_p)
>             globify (&argc, &argv);
> 
> So, the problem with `zsh' commands being doubly-globbed could
> presumably be fixed by recompiling zsh with gnu-win32.

And I suppose command.com etc. all need to be re-compiled 
against gnuwin32?

Another possibility would be to look at the code in globify:

for (i = 0; i < ac; i++)
  {
    if (strpbrk (av[i], "?*[") != NULL)
      {
        globs[i].gl_offs = 0;
        rc[i] = glob (av[i],
                      GLOB_NOCHECK | GLOB_NOESCAPE,
                      0,
                      &globs[i]);
        newac += rc[i] == 0 ? globs[i].gl_pathc : 1;
        donesomething = rc[i] == 0;
      }
    else
      {
        rc[i] = -1; /* glob not called */
        ++newac;
      }
  }

--------------------------------------------------------

This code doen't check for any escapes.  It just checks for 
globbing characters.  Couldn't this be made to ignore args 
with ' or " as the first char, by inserting this code.

    if (av[i][0] == '\'' || av[i][0] == '"')
      {
        /* strip quotes off arg here (front and back) and adjust arg ptr */
      }

/* rest of original glob code below */

Or something similar.  That would seem more reasonable for 
checking globs or anything embedded in quotes.

-- 
  ,-/-  __      _  _         $Bill Luebkert
 (_/   /  )    // //       DBE Collectibles
  / ) /--<  o // //      http://www.wgn.net/~dbe/
-/-' /___/_<_</_</_    Email: [email-masked]
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".