On 10/15/07, Axel Liljencrantz <[EMAIL PROTECTED]> wrote:
> On 10/14/07, Chris Rebert <[EMAIL PROTECTED]> wrote:
> > Fish currently encounters an error when trying to call a process with too
> > long of a completion list.
> >  Example (I don't use the default fish prompt):
> >
> > chris ~ > cat ** #any folder with lots of files/subdirectories will do
> >  fish: Failed to execute process "/bin/cat"
> > execve: Argument list too long
> > fish: Backtrace:
> >  -fish [0x8073aed]
> >
> > chris ~ >
> >
> > I'd like to suggest that rather than erroring when this happens, fish should
> > do the following:
> >
> > chris ~ > cat **
> > fish: Number of arguments to command (XXX) exceeds system limit (YYY).
> > fish: Please try running the command again with fewer arguments.
> >
> >  Where XXX is the number of arguments the command was given and YYY is the
> > system limit on the maximum number of command arguments.
>
> When you say 'completions' above, you mean 'arguments', right? Sorry
> to be a nitpicker, but I might have misunderstood you.
>
> If my above assumption is correct, then I agree with you except that
> it's not entirely easy to get the maximum number of arguments
> possible. There is an ARG_MAX preprocessor macro, which if defined
> tells us the sum of the maximum arguments and the maximum number of
> environment variables. We could print something like:
>
> fish: Number of arguments to command (4567) and number of environment
> variables (63) exceeds the total system limit of 4096.
> fish: Please try running the command again with fewer arguments.
>
> Most (all) current unices also have a maximum size of the data in the
> argument vector, and as far as I can tell, there is no macro that
> defines this constant.
>
> fish: Size of arguments to command (73 kB) exceeds system limit.
> fish: Please try running the command again with shorter arguments.
>
> It should also be noted that the latest Linux kernel, which was
> released this month, supports arbitrarily long argument lists, so in
> the Linux world, this error message will soon be a thing of the past.

Seems I was mistaken. There is actually no hard limit on the number of
arguments to execve, only a limit to the combined size of the argv and
envp data, which is what the ARG_MAX macro contains. I should rely
less on my rather fuzzy memory and more on actually reading stuff and
finding things out. :-)

I've implemented an improved error message that looks like this:

[EMAIL PROTECTED] ~/fish> echo **
fish: Failed to execute process '/bin/echo'. Reason:
fish: The total size of the argument and environment lists (167kB) exceeds the
system limit of 128kB.
fish: Please try running the command again with fewer arguments.
[EMAIL PROTECTED] ~/fish>

>
> >
> >  - Chris Rebert
>
> Axel
>

Axel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to