public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Bash silently truncates the Command Line when called programatically via CreateProcess as MAXPATHLEN was reduced to 8192 from 16384
Date: Mon, 26 May 2014 20:38:00 -0000	[thread overview]
Message-ID: <20140526200857.GA3903@ednor.casa.cgf.cx> (raw)
In-Reply-To: <CANMjiJqz6uJ7pp=iS5FK_ZnS9nxCT1fY+EndcgzPan7sv2pXJA@mail.gmail.com>

On Mon, May 26, 2014 at 08:59:56PM +0530, Abhijit Bhattacharjee wrote:
>On a typical configuration, we use gmake on windows as the build
>system. GMAKE calls the Cygwin bash in order to invoke the MSVS
>compiler in-order to satisfy the dependency if a rule to call the
>compiler is present.

If you're using Cygwin's make it will not truncate paths if it is
running cygwin programs.  Not sure what MSVS is.

>Now, for certain modules, the command line was seemingly getting
>truncated. On investigating further it revealed the reason for the
>truncation was because in the glob.cc, MAXPATHLEN was now defined as
>8192 so, when bash was compiled with the changed crt code, the problem
>started to emerge.
>
>Now, it also seems that there was a discussion
>(https://cygwin.com/ml/cygwin-patches/2012-q1/msg00037.html) where
>Corinna mentioned about decreasing the size to 4096 and later
>increasing it to 8192. Unfortunately, for our case, 8192 is low a
>limit and ideally the previous limit of 16384 was working perfectly.
>
>The Argument that Corinna placed was because the default stack size is
>2 Megs  and sizeof(Char)==8, a local array of 8* 16384  would be too
>strenuous for the stack.
>
>It was still not clear to me as to why?
>
>1. The Temporary buffer was not allocated on heap?

The source code comes from FreeBSD.   Managing this on the heap would
mean a rewrite and would have its own problems.  Since this isn't really
an issue when Cygwin calls Cygwin programs it likely isn't really high
on anyone's priority list.

>2. Why the entire argument (both quoted and non-quoted string) was
>passed to the glob module. If instead, the argument string could had
>been tokeinized  as interleaving quoted and non-quoted string, the
>restriction imposed on the argument length would be alleviated. What I
>am envisaging is, currently in the globify module, you are escaping
>all the quoted characters to demarcate from the non-quoted characters
>before calling glob once, so that the glob can only expand non-quoted
>sub-string. Instead, if we could call glob multiple times whenever we
>encounter a sub-string of non-quoted string, wouldn't it be cleaner?

I don't really know what you're talking about but patches are always
better than word descriptions.

It sounds like you're using a non-Cygwin make to call a Cygwin process.
If that is the case then it seems like the trivial fix is "Don't Do
That" (tm)

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2014-05-26 20:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 17:28 Abhijit Bhattacharjee
2014-05-26 20:38 ` Christopher Faylor [this message]
2014-05-27  3:18   ` René Berber
2014-05-27  6:54     ` Christopher Faylor
     [not found]       ` <CANMjiJpDU-aVxg1X8G_Lk8pKLEmXbs24+ieD=w3f8ZmQ2jdjTw@mail.gmail.com>
2014-05-27 22:11         ` Abhijit Bhattacharjee
2014-05-28  9:48           ` Christopher Faylor
2014-05-28 11:04           ` David Stacey
2014-05-28 19:48             ` Warren Young
2014-05-31 13:37               ` Abhijit Bhattacharjee
2014-05-31 17:55                 ` Cliff Hones
2014-05-31 19:22                 ` Christopher Faylor
2014-05-28 16:07 Houder
2014-05-28 17:59 ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140526200857.GA3903@ednor.casa.cgf.cx \
    --to=cgf-use-the-mailinglist-please@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).