Bug#576814: libjline-java: left-arrow, up-arrow adds null to retrieved history line

Ben Armstrong synrg at sanctuary.nslug.ns.ca
Wed Apr 7 12:46:25 UTC 2010


Package: libjline-java
Version: 0.9.94-5
Severity: normal

In xterm, gnome-terminal, lxterminal, and presumably other X terminals as well,
and even linux console, some sequences of left-arrow and up-arrow key-presses
corrupt lines from the history by adding nulls and dropping characters
earlier in the line.  This hampers effective use of the command-line history
in every language interpreter I have tried that uses jline, and is a source of
frustration in using these programs to experiment with the languages.

I have reproduced the problem in bsh, jirb and clojure repl, the latter invoked as:

$ java -cp /usr/share/java/clojure.jar:/usr/share/java/jline.jar jline.ConsoleRunner clojure.main


Using clojure repl, the following steps are sufficient to reproduce the problem
and demonstrate that the corruption is accompanied by the addition of a null
character.

1.Enter these lines:

(println "hello world")
(println "hello")

2. press up-arrow, left-arrow, up-arrow, and the line now looks like this:

user=> (println "hell world")

3. press enter on this line, resulting in the following:

hell world
nil
java.lang.Exception: Unable to resolve symbol:  in this context (NO_SOURCE_FILE:0)

4. ^D to exit and hexdump -C ~/.jline-clojure.main.history produces:

00000000  28 70 72 69 6e 74 6c 6e  20 22 68 65 6c 6c 6f 20  |(println "hello |
00000010  77 6f 72 6c 64 22 29 0a  28 70 72 69 6e 74 6c 6e  |world").(println|
00000020  20 22 68 65 6c 6c 6f 22  29 0a 28 70 72 69 6e 74  | "hello").(print|
00000030  6c 6e 20 22 68 65 6c 6c  20 77 6f 72 6c 64 22 29  |ln "hell world")|
00000040  00 0a                                             |..|
00000042

Notice the single null at the end of the third line before the newline
character.  This accounts both for the "Unable to resolve symbol:  in this
context" error message (the null is the symbol you can't see in this message)
and for the fact that a single character is dropped in "hell world" (though why
it is the 'o' and not some other character is mysterious). 


In bsh and jirb the corruption is exactly the same.


bsh version:

bsh % print("hello world");
hello world
bsh % print("hello");      
hello
bsh % print("hell world");
hell world


jirb version:

>> puts "hello world"
hello world
=> nil
>> puts "hello"
hello
=> nil
>> puts "hell world"
hell world
=> nil


I have experimented with different language settings, (LANG=C, =en_US.UTF-8,) different
terminal emulators, (as indicated in my summary above,) and different values of
TERM, ("screen", "xterm", "dumb".)  Nothing helps.

Thanks,
Ben


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-trunk-686 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages libjline-java depends on:
ii  default-jre-headless [java2-r 1.6-34     Standard Java or Java compatible R
ii  openjdk-6-jre-headless [java2 6b17-1.7-1 OpenJDK Java runtime, using Hotspo

libjline-java recommends no packages.

Versions of packages libjline-java suggests:
pn  libjline-java-doc             <none>     (no description available)

-- no debconf information





More information about the pkg-java-maintainers mailing list