Terminal refuses more than 1030 chars

REPRODUCIBILITY: 100% (always)
OSVERSION: 4.4.0.68
HARDWARE: Sony Xperia 10 II - Dual SIM - xqau52 - xqau52 - 0.0.2.119 - aarch64
UI LANGUAGE: Français (user: fr_FR, os: fr_FR.utf8)
REGRESSION: no

DESCRIPTION:

It’s impossible to insert more than 1030 chars inside the terminal. If you open a file with vi, then it gets possible.

PRECONDITIONS:

Developer mode enabled

STEPS TO REPRODUCE:

  1. Copy > 1030 chars
  2. Open default terminal (busybox) ;
  3. Insert it with ctrl+v

EXPECTED RESULTS:

All chars are printed

ACTUAL RESULTS:

It gets truncated after 1030 chars

MODIFICATIONS:

  • Patchmanager: yes
  • OpenRepos: yes
  • Chum: yes
  • Other:

ADDITIONAL INFORMATION:


the initial version of this bug report was created using Bugger v0.9.6

2 Likes

Could you please be more precise what you mean by ‘inserting’? Do you mean that when open a terminal and start typing a single command you are limited to 1030 characters (per command)?

Please add some ‘how to reproduce’ steps to your report.

The missing steps are a bug in the Bugger! tool. It’s fixed in the current version.

But: are you using GNU bash or busybox as shell?

1 Like

This appears to be a limitation of busybox.

Simple test:

 busybox bash
 wc<enter>
 <paste a long string>
 <Ctrl-D>

On my system that shows ~1370 chars.
GNU bash allows for longer lines.

It’s thus not related to the Terminal (fingertern) app, other terminals show the same.

There is a kernel limit to max length of argv, shown with getconf ARG_MAX but it’s much larger than ~1400 chars.

It may be related to this option but I haven’t researched its meaning:

I think ToeTerm is affected too. I’ll poke around and see what pops up. I’ll also test how fish reacts.

Yup, same there (with Terminal and ToeTerm) - it’s BusyBox indeed. I can pass echo a string of 1024 characters, quotes included, any more characters simply isn’t allowed to be entered.

Using fish I was able to pass echo a string of 2808 characters no problem, quotes included, so that confirms it further.

It’s quite rare to hit this limit, but Whisperfish registration workaround constantly hits this issue (but it shouldn’t be needed anymore for vast majority).

1 Like

This seems like a violation of POSIX ARG_MAX, which is at least 4096 characters, as well as a mismatch with the value returned by getconf ARG_MAX, which for me returns 524288.

Sounds like two bugs to me?

  1. Applications should be able to blindly use commandline of upto 4k characters, and
  2. Correctly implemented applications should be able to use commandline of upto 500k characters.

Ah, but process(kernel) ARG_MAX != shell input line length != terminal input line length.

No violation of POSIX (the kernel and SailfishOS are fine), terminal emulation is also fine - this is just a compile-time setting of the busybox shell.

Other shells have higher but similar limits.

2 Likes

You’re right, good point. I forgot the part where a program doesn’t need to be launched from the shell :sweat_smile:

Thanks for highlighting this @pherjung. From the discussion, it looks like it could be quite a straightforward thing to change. I’ve logged it internally and tagged it here as “tracked”.