Bug#1121061: libreoffice: undocumented limit of 249 arguments
>> Package: libreoffice
>> Version: 4:25.8.2-3
>> Severity: normal
>>
>> When libreoffice is called from the command line for batch processing with --convert-to it apparently forces a limit on the number of arguments without telling.
>>
>> In my case, when giving the names of 371 files on the command line, it starts working and printing two lines for each processed file until 249 files are processed, then it hangs.
>>
>> If I give it 249 file arguments, it works without problems. The command line is:
>>
>> /usr/lib/libreoffice/program/oosplash --convert-to csv:Text - txt - csv (StarCalc):44,,,,,,,,,,,3 --outdir ./tmp.GYzB1YV6z1 [ 42-char file names]
>
>http://google.com/search?q=libreoffice+argument+limit+convert-to:
>
>"
>There is no specific argument limit for the libreoffice --convert-to command itself
...
>(AI, but..)
I investigated a bit, and that's what I found.
Bash does not have a limit on line length or number of arguments. The operating system has a line length limit, and on my Linux box it is
$ getconf ARG_MAX
2505728
In the case I reported, the line length was about 43*371+123=16076. Just for double check, ls on my entire directory takes 718 arguments without a problem:
$ ls -1 * | wc -l
719
which is what one expects from the Gnu core utils.
However /usr/lib/libreoffice/program/soffice has a limit of of 254 arguments (including the process file name), and the reason is that it is a shell script starting with !/bin/sh, which on my system means that dash is called. Experiments show that the limit on numer of arguments is imposed by Dash. In fact, if one calls /usr/lib/libreoffice/program/oosplash rather than /usr/lib/libreoffice/program/soffice then the limit disappears.
I suggest that the shell scripts under /usr/lib/libreoffice/program use Bash rather than Dash, and that the libreoffice-common package is made to depend on the bash package.
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.
--
Francesco Potortì (ricercatore) Mobile: +39.348.8283.107
ISTI - Area della ricerca CNR Teams: wnlabisti
via G. Moruzzi 1, I-56124 Pisa Web: http://fly.isti.cnr.it
(gate 20, 1st floor, room C71) ISPIN: https://ieee-jispin.org/
Reply to: