[DRE-maint] Bug#1003953: libruby2.7: Readline prompt fails to correctly process ANSI color escape codes

Cool Fire coolfire at insomnia247.nl
Tue Jan 18 14:59:57 GMT 2022


Package: libruby2.7
Version: 2.7.4-1
Severity: minor

Dear Maintainer,

The readline.so that ships with libruby2.7 does not appear to correctly
process ansi color codes. I have narrowed it down to this specific .so
file by transplanting the readline.so file from a ruby:2.7.4 docker
image. (Which is built on debian stable, but brings its own ruby &
friends.)

Minimal ruby code to reproduce the issue;
require 'readline'
prompt = "\e[01;32mText prompt\e[00m > "
Readline.readline(prompt, true)

Reproducing the issue in a debian:stable container, starting with the
original readline.so:

root at 1222ca40c3f1:/usr/lib/x86_64-linux-gnu/ruby/2.7.0# ls -lAsh readline.so
0 lrwxrwxrwx 1 root root   20 Jan 18 13:49 readline.so -> readline.original.so
root at 1222ca40c3f1:/usr/lib/x86_64-linux-gnu/ruby/2.7.0# ruby
/test/readlinetest.rb 
[01;32mText prompt[00m > 

With the original .so the colors are not applied and the codes are
partially printed out to the terminal.

Swapping in the readline.so transplanted from ruby:2.7.4 container:

root at 1222ca40c3f1:/usr/lib/x86_64-linux-gnu/ruby/2.7.0# rm readline.so
root at 1222ca40c3f1:/usr/lib/x86_64-linux-gnu/ruby/2.7.0# ln -s readline.terrible_idea.so readline.so
root at 1222ca40c3f1:/usr/lib/x86_64-linux-gnu/ruby/2.7.0# ruby /test/readlinetest.rb 
Text prompt > 

With the transplanted readline.so the prompt works as expected with the
colors applied.

I have compared the readline.c from the debian src package and the
upstream ruby 2.7.4 sources but have not found any changes that I would
expect to cause any such behaviour, so at this point I'm not entirely
sure where the different behaviour stems from.

The issue is also present on the testing and unstable packages.
The issue is not yet present in the oldstable libruby2.5 package.



-- System Information:
Debian Release: 11.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-8-amd64 (SMP w/24 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libruby2.7 depends on:
ii  libc6            2.31-13+deb11u2
ii  libcrypt1        1:4.4.18-4
ii  libedit2         3.1-20191231-2+b1
ii  libffi7          3.3-6
ii  libgdbm-compat4  1.19-2
ii  libgdbm6         1.19-2
ii  libgmp10         2:6.2.1+dfsg-1+deb11u1
ii  libssl1.1        1.1.1k-1+deb11u1
ii  libyaml-0-2      0.2.2-1
ii  rake             13.0.3-1
ii  ruby-minitest    5.13.0-1
ii  ruby-net-telnet  0.1.1-2
ii  ruby-test-unit   3.3.9-1
ii  ruby-xmlrpc      0.3.0-2
ii  zlib1g           1:1.2.11.dfsg-2

libruby2.7 recommends no packages.

libruby2.7 suggests no packages.

-- no debconf information



More information about the Pkg-ruby-extras-maintainers mailing list