public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Command line length in Ash or Dash Shells
@ 2015-10-26 13:54 Dr Rainer Woitok
  2015-10-26 17:45 ` Eric Blake
  0 siblings, 1 reply; 6+ messages in thread
From: Dr Rainer Woitok @ 2015-10-26 13:54 UTC (permalink / raw)
  To: cygwin

Fellow Cygwinners,

recently I needed to remove quite a few Cygwin packages from my install-
ation, and due to  all these interdependencies  I wanted to do this in a
single call:

   setup-x86*.exe -x ...,...,...

Calling this  command as  a Windows  "*.bat" file  failed with  an error
message suggesting that the command line simply was too long.  Searching
the web I  found disagreeing figures for the maximum command line length
for "*bat" files  under Windows Vista of  2000+ and 8000+,  but since my
command line had a length of  12000+ anyway,  I tried issuing this comm-
and from an Ash Shell script instead, which succeeded.

No I'm  playing with the idea  of using such an  Ash Shell script  (with
"setup-x86*.exe -P", of course)  to carry my current Cygwin implementat-
ion over to my  not yet decided upon next hardware.   But nevertheless I
feel a bit uneasy  about any potential  command line length  restriction
which could ultimately raise  its ugly head and interfere with my glori-
ous plans.

Does anybody definitely know about a  maximum command line length in the
Ash or Dash Shells?

Or alternatively:  is there a way to cause  "setup-x86*.exe" to read the
package list from a file or from standard input, even though "setup-x86*
--help" does not seem to indicate there is?

Any pointers appreciated.

Sincerely,
  Rainer

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Command line length in Ash or Dash Shells
  2015-10-26 13:54 Command line length in Ash or Dash Shells Dr Rainer Woitok
@ 2015-10-26 17:45 ` Eric Blake
  2015-10-27 18:12   ` Dr Rainer Woitok
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2015-10-26 17:45 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]

On 10/26/2015 05:16 AM, Dr Rainer Woitok wrote:
> Does anybody definitely know about a  maximum command line length in the
> Ash or Dash Shells?

/bin/ash _is_ the same as /bin/dash, so there is no difference in their
behavior.

A windows process spawning a cygwin one, or a cygwin process spawning a
windows process, are both subject to Window's limits.  I'm not sure
off-hand what the actual limit is, but seem to recall the figure of 64k
as the combined limit for both argv and environ (that is, your command
line length limit IS affected by how much is also in your environment
variables at the time).  And since you quoted even lower numbers for
batch files, that is entirely possible that the Windows command line
limit is not the only limit you will hit (I avoid batch files when
possible, so I can't confirm the numbers you quoted).

One cygwin process spawning another has no inherent command line limit,
because cygwin processes use a back door in shared memory, rather than
the normal Windows command line storage, to pass their command line
arguments (in part because the windows limits are so pathetic).  So once
you start a dash shell, that dash shell can start any number of other
dash shells with no command line length limit other than the memory
available to your machine.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Command line length in Ash or Dash Shells
  2015-10-26 17:45 ` Eric Blake
@ 2015-10-27 18:12   ` Dr Rainer Woitok
  2015-10-27 19:06     ` Corinna Vinschen
  2015-10-28  0:30     ` Eric Blake
  0 siblings, 2 replies; 6+ messages in thread
From: Dr Rainer Woitok @ 2015-10-27 18:12 UTC (permalink / raw)
  To: Eric Blake; +Cc: cygwin

Eric,

On Monday, 2015-10-26 10:14:06 -0600, you wrote:

> ...
>                                                                  So once
> you start a dash shell, that dash shell can start any number of other
> dash shells with no command line length limit other than the memory
> available to your machine.

Assume I terminate  Cygserver and any  other Cygwin  services running, I
then start "ash.exe" by double clicking it in a Windows Explorer window,
from the  command line  in the  "ash.exe"  window  I start my  Ash Shell
script which in turn starts  "setup-x86*.exe"  with a  very long command
line.

Am I interpreting you correctly in assuming that under these circumstan-
ces the maximum length of this command line  is 2 * 10**9 ASCII charact-
ers on my box?

This would be just enough I think.

Sincerely,
  Rainer

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Command line length in Ash or Dash Shells
  2015-10-27 18:12   ` Dr Rainer Woitok
@ 2015-10-27 19:06     ` Corinna Vinschen
  2015-10-27 23:30       ` Dr Rainer Woitok
  2015-10-28  0:30     ` Eric Blake
  1 sibling, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2015-10-27 19:06 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]

On Oct 27 16:10, Dr Rainer Woitok wrote:
> Eric,
> 
> On Monday, 2015-10-26 10:14:06 -0600, you wrote:
> 
> > ...
> >                                                                  So once
> > you start a dash shell, that dash shell can start any number of other
> > dash shells with no command line length limit other than the memory
> > available to your machine.
> 
> Assume I terminate  Cygserver and any  other Cygwin  services running, I
> then start "ash.exe" by double clicking it in a Windows Explorer window,
> from the  command line  in the  "ash.exe"  window  I start my  Ash Shell
> script which in turn starts  "setup-x86*.exe"  with a  very long command
> line.
> 
> Am I interpreting you correctly in assuming that under these circumstan-
> ces the maximum length of this command line  is 2 * 10**9 ASCII charact-
> ers on my box?

That won't work.  setup.exe is a non-Cygwin application so it's restricted
to the maximum line length of the CreateProcess call, which, per
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx
is 32768 characters.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Command line length in Ash or Dash Shells
  2015-10-27 19:06     ` Corinna Vinschen
@ 2015-10-27 23:30       ` Dr Rainer Woitok
  0 siblings, 0 replies; 6+ messages in thread
From: Dr Rainer Woitok @ 2015-10-27 23:30 UTC (permalink / raw)
  To: cygwin

Corinna,

On Tuesday, 2015-10-27 16:17:56 +0100, you wrote:

> ...
> That won't work.  setup.exe is a non-Cygwin application so it's restricted
> to the maximum line length of the CreateProcess call, which, per
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx
> is 32768 characters.

Thanks for clarifying :-)

Sincerely,
  Rainer

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Command line length in Ash or Dash Shells
  2015-10-27 18:12   ` Dr Rainer Woitok
  2015-10-27 19:06     ` Corinna Vinschen
@ 2015-10-28  0:30     ` Eric Blake
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Blake @ 2015-10-28  0:30 UTC (permalink / raw)
  To: Dr Rainer Woitok; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

On 10/27/2015 09:10 AM, Dr Rainer Woitok wrote:
> Eric,
> 
> On Monday, 2015-10-26 10:14:06 -0600, you wrote:
> 
>> ...
>>                                                                  So once
>> you start a dash shell, that dash shell can start any number of other
>> dash shells with no command line length limit other than the memory
>> available to your machine.
> 
> Assume I terminate  Cygserver and any  other Cygwin  services running, I
> then start "ash.exe" by double clicking it in a Windows Explorer window,
> from the  command line  in the  "ash.exe"  window  I start my  Ash Shell
> script which in turn starts  "setup-x86*.exe"  with a  very long command
> line.

Sadly, setup-x86*.exe is a native Windows process, not a cygwin process
(and MUST be, since you can run setup prior to having cygwin installed).
 So it is unfortunately stuck at the Windows limitations on max
command-line+environment sizing.

Of course, patches are welcome, if someone would like to propose a way
to make setup-x86.exe read its package list from a file name given on
the command line, rather than having to pass every package name on the
command line.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-27 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-26 13:54 Command line length in Ash or Dash Shells Dr Rainer Woitok
2015-10-26 17:45 ` Eric Blake
2015-10-27 18:12   ` Dr Rainer Woitok
2015-10-27 19:06     ` Corinna Vinschen
2015-10-27 23:30       ` Dr Rainer Woitok
2015-10-28  0:30     ` Eric Blake

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).