Cap command size passed to subshell

Pavel Tsekov ptsekov at gmx.net
Thu Nov 25 10:51:14 UTC 2004


Hello,

On Sun, 21 Nov 2004, Leonard den Ottolander wrote:

> Hi,
>
> A small fix for the size of the command passed to the subshell pty. 4096
> bytes should be enough, right? I believe the compiler should optimize
> the double call to strlen(command) away. If not we could introduce an
> extra variable here and set it first.

Why is this patch necessary ? Besides the comment in the source code do
you have any proof (testcase) that long commands cause breakage ? Is
it the strlen () call or the pseudo-terminal device or the underlying
shell that fails ? I think if we opt to fix that part of the code, we
have to find out which part of the chain fails and find a proper
workaround i.e. for example passing the big string in smaller chunks. Just
removing a part of the command is obviously not what the user wants -
its better to warn her that she is passing a command which is too
long and just discard the whole command.

Any thoughts ?




More information about the mc-devel mailing list