>I actually would be surprised if the GNU core utils (e.g. rm) worked with 
>rm'ing 59660 files.

>bash: /usr/bin/ls: Argument list too long
>bash: /usr/bin/rm: Argument list too long

These limits are not on the core utils (rm  or ls) but on the exec system call 
line length.  ls and rm have no limits on their own: since they were born, the 
Gnu utils have been free of arbitrary limits.

>> I suggest that the shell scripts under /usr/lib/libreoffice/program use Bash 
>> rather than Dash,

>But then we just exchange a limit to another one.. Which is much bigger, 
>admittedly, though :)

Sure, but the second one is the limit imposed by the kernel, that is, the same 
line length limit that all processes have when calling exec(2).  Not an 
unexpected unexplicable much lower limit.

More important yet, when the length of the command line exceeds ARG_MAX, rm and 
ls emit a warning and exit with error, while when the number of arguments in 
libreoffice exceeds 251 no warning is given.
 
>> and that the libreoffice-common package is made to depend on the bash 
>> package.
>bash actually is still pseudo-essential I think

Hm, do not know.

>> This is not a significant lack of efficiency, as the overhead of launching 
>> bash is negligible with respect to launching soffice from any point of view: 
>> cpu time, memory size, disk space occupied.
>
>Yes, but why not feed 249 (or 251) files each run if one knew (as you do now) 
>about the limit?

That's what I am doing in my script now.

But once you find a bug and a way to get around it, that is still a bug, and 
can hit other people.  That's the very reason to signal and correct bugs that 
can be worked around.  It took me some hours to understand why my script did 
not work.

>And LibreOffice is not special here, there's a s*load of !#/bin/sh scripts in 
>Debian. You ae not seriously suggesting to change all of them to bash for this 
>reason if they handled files?

>There is a reason Debian choose dash for /bin/sh, which *was* efficiency for 
>#!/bin/sh scripts.

The move from bash to dash is relatively recent in Debian.  Most of those 
scripts were written at a time when this problem did not exist.  And the reason 
of switching to dash was for efficiency of system scripts, as far as I know.  
Efficiency is not relevant for user-level interactive scripts so yes, this is 
probably a wider problem: using !# /bin/sh makes sense for system-level 
scripts, but not otherwise, especially when that introduces an artificial limit 
on the number of arguments.

Anyway, I suggest to investigate dash's behaviour and ensure that my diagnosis 
is correct, because the existence of such a limit looks strange to me. If it is 
confirmed, file a bug with dash and change /bin/sh into /bin/bash in 
libreoffice's scripts.

Reply via email to