tag 1121061 - moreinfo
tag 112106 - unreproducible
severity 112106 minor
thanks
Hi,
Am 22.11.25 um 02:06 schrieb Francesco Potortì:
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
Yeah, that was my initial idea, but 10500 as for 49 files is much lower than
that, indeed.
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
I see.
which is what one expects from the Gnu core utils.
I actually would be surprised if the GNU core utils (e.g. rm) worked with
rm'ing 59660 files. And inded it doesn't, but gets surprsingly (to me) close:
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 0000000000000000000000000000000000000010000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
10000
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 0000000000000000000000000000000000000020000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
20000
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 000000000000000000000000000000000000000000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
ls: cannot access '0*': No such file or directory
0
rm: cannot remove '*': No such file or directory
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 000000000000000000000000000000000000000000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
ls: cannot access '0*': No such file or directory
0
rm: cannot remove '*': No such file or directory
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 0000000000000000000000000000000000000030000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
30000
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 0000000000000000000000000000000000000040000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
40000
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 0000000000000000000000000000000000000050000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
bash: /usr/bin/ls: Argument list too long
0
bash: /usr/bin/rm: Argument list too long
So there is also another limit here, somewhere between 40000 and 41000?:
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 0000000000000000000000000000000000000040000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
40000
rene@frodo:~/test$ echo -n "000000000000000000000000000000000000000001" | wc -c && for i
in `seq -w 0000000000000000000000000000000000000000001 0000000000000000000000000000000000000041000`; do echo
$i > $i; done && ls -1 0* | wc -l; rm *
42
bash: /usr/bin/ls: Argument list too long
0
bash: /usr/bin/rm: Argument list too long
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,
But then we just exchange a limit to another one.. Which is much bigger,
admittedly, though :)
and that the libreoffice-common package is made to depend on the bash package.
bash actually is still pseudo-essential I think
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?
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.
Regards,
Rene