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: B20: Command line args truncated


In article <19981120165427.44249.cygnus.gnu-win32@tc.fluke.com>,
Warren Jones <wjones@TC.FLUKE.COM> 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
-- 
cgf@cygnus.com
http://www.cygnus.com/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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