Subject: Re: B20: Command line args truncated
From: [email-masked] (Christopher G. Faylor)

23 Nov 1998 00:00:43 GMT
Message-ID: <[email-masked]>
References: <[email-masked]>
X-Newsreader: trn 4.0-test63 (15 March 1998)

In article <[email-masked]>,
Warren Jones <[email-masked]> wrote:
>In B20, command line arguments are truncated to 259 characters when:
>
>    1. A Cygwin program is called from a non-Cygwin program.
>    2. A command line argument is enclosed in double quotes.
>
>I'm including a simple batch file that demonstrates the problem,
>although I first observed it when the Cygwin shell (ash) was
>spawned by a non-Cygwin port of gmake, and the quoted command
>line was truncated (sh -c "...").
>
>It's pretty clear that the args are getting truncated when they're
>passed through the glob() function.  Several working arrays in glob()
>are defined using MAXPATHLEN, which just happens to equal 259.
>I'm not so clear on the best solution.  A simple-minded approach
>would be to replace MAXPATHLEN with some larger number, or maybe
>dynamically size the arrays based on the length of the incoming
>pattern.
>
>Perhaps someone who's more familiar with this code will have a
>better idea.  It might also help to know what has changed since
>B19 (which doesn't have this problem).  According to the ChangeLog,
>it looks like the changes were probably in dcrt0.cc, where glob()
>is called.

Thank you for the excellent bug report and analysis.  I'm the
culprit who "broke" command line arguments.

I changed dcrt0.cc to allow more UNIX style quoting when it is run
from a non-cygwin shell, i.e.

foo"bar*"

'foo'*

foo{bar,baz}

etc.

The way I chose to do that was to pass everything to glob.  However,
glob is truncating arguments, as you noticed.  I'll set up the size of
the buffers in glob to something huge for B20.2.  That is the only
thing, barring a complete rewrite of glob, that I'll be able to do in
the short term.

-chris
-- 
[email-masked]
http://www.cygnus.com/