all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* call-process having problems with a big total length of arguments under Windows
@ 2013-03-10 13:02 Mathias Dahl
  2013-03-10 13:19 ` Mathias Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Dahl @ 2013-03-10 13:02 UTC (permalink / raw)
  To: emacs-devel

Under GNU/Linux I can do this (calling ping with an 10000 long argument list):

(apply 'call-process
       (append (list
                "ping"
                nil t nil)
               (make-list 10000 "0123456789")))

(of course, ping complains about the syntax, but that is another
matter, ping is just an example of a command that exists on both
platforms where I test)

On Windows (Windows 7, 64 bit) this works in a quite recent Emacs
(24.1.50.1 from last summer):

(apply 'call-process
       (append (list
                "ping"
                nil t nil)
               (make-list 2000 "0123456789")))

But this does not (2000 is changed to 3000):

(apply 'call-process
       (append (list
                "ping"
                nil t nil)
               (make-list 3000 "0123456789")))

I get (file-error "Spawning child process" "exec format error") when I
reach a certain amount of arguments. I can make it fail at fewer
arguments if I make the length of each argument longer.

What sets the limit here? Is there a bug in Emacs on Windows or is it
a limitation of the OS? Is there is a known limitation in the total
length of all parameters?

Thanks!

/Mathias



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

* Re: call-process having problems with a big total length of arguments under Windows
  2013-03-10 13:02 call-process having problems with a big total length of arguments under Windows Mathias Dahl
@ 2013-03-10 13:19 ` Mathias Dahl
  2013-03-10 16:21   ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Dahl @ 2013-03-10 13:19 UTC (permalink / raw)
  To: emacs-devel

PS. I found a limit on the number of arguments I can use if the
argument is one character:

(apply 'call-process
       (append (list
                "ping"
                nil t nil)
               (make-list 16369 "1")))

Now, if I double the length of each argument I can get higher than
16369 characters in total:

(apply 'call-process
       (append (list
                "ping"
                nil t nil)
               (make-list 10912 "12")))

So, it's not simply the total amount, but a combination of the number
of arguments on the length of those arguments.

Any ideas?

On Sun, Mar 10, 2013 at 2:02 PM, Mathias Dahl <mathias.dahl@gmail.com> wrote:
> Under GNU/Linux I can do this (calling ping with an 10000 long argument list):
>
> (apply 'call-process
>        (append (list
>                 "ping"
>                 nil t nil)
>                (make-list 10000 "0123456789")))
>
> (of course, ping complains about the syntax, but that is another
> matter, ping is just an example of a command that exists on both
> platforms where I test)
>
> On Windows (Windows 7, 64 bit) this works in a quite recent Emacs
> (24.1.50.1 from last summer):
>
> (apply 'call-process
>        (append (list
>                 "ping"
>                 nil t nil)
>                (make-list 2000 "0123456789")))
>
> But this does not (2000 is changed to 3000):
>
> (apply 'call-process
>        (append (list
>                 "ping"
>                 nil t nil)
>                (make-list 3000 "0123456789")))
>
> I get (file-error "Spawning child process" "exec format error") when I
> reach a certain amount of arguments. I can make it fail at fewer
> arguments if I make the length of each argument longer.
>
> What sets the limit here? Is there a bug in Emacs on Windows or is it
> a limitation of the OS? Is there is a known limitation in the total
> length of all parameters?
>
> Thanks!
>
> /Mathias



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

* Re: call-process having problems with a big total length of arguments under Windows
  2013-03-10 13:19 ` Mathias Dahl
@ 2013-03-10 16:21   ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2013-03-10 16:21 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: emacs-devel

> From: Mathias Dahl <mathias.dahl@gmail.com>
> Date: Sun, 10 Mar 2013 14:19:54 +0100
> 
> PS. I found a limit on the number of arguments I can use if the
> argument is one character:
> 
> (apply 'call-process
>        (append (list
>                 "ping"
>                 nil t nil)
>                (make-list 16369 "1")))
> 
> Now, if I double the length of each argument I can get higher than
> 16369 characters in total:
> 
> (apply 'call-process
>        (append (list
>                 "ping"
>                 nil t nil)
>                (make-list 10912 "12")))
> 
> So, it's not simply the total amount, but a combination of the number
> of arguments on the length of those arguments.
> 
> Any ideas?

The API used to invoke subprocesses on MS-Windows imposes a hard limit
of 32KB on the length of the command line passed to the subprocess.
This length includes all the arguments your Lisp program conses, plus
the blank characters that delimit each argument from the next.  Does
this explain what you see?



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

end of thread, other threads:[~2013-03-10 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-10 13:02 call-process having problems with a big total length of arguments under Windows Mathias Dahl
2013-03-10 13:19 ` Mathias Dahl
2013-03-10 16:21   ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.