Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Heroku + jirb => readline crashes on backspace #151

Closed
carlhoerberg opened this Issue · 3 comments

2 participants

@carlhoerberg

If you use the Heroku buildpack (https://github.com/jruby/heroku-buildpack-jruby) and start a irb session and press backspace it crashes:

$ heroku run jirb
Running jirb attached to terminal... up, run.1
irb(main):001:0> aConsoleReader.java:1414:in `backspace': java.lang.ArithmeticException: / by zero
    from ConsoleReader.java:1436:in `backspace'
    from ConsoleReader.java:628:in `readLine'
    from ConsoleReader.java:457:in `readLine'
    from Readline.java:237:in `s_readline'
    from Readline$s$s_readline.gen:65535:in `call'
    from CachingCallSite.java:332:in `cacheAndCall'
    from CachingCallSite.java:203:in `call'
    from FCallTwoArgNode.java:38:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from IfNode.java:111:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:147:in `call'
    from DefaultMethod.java:183:in `call'
    from CachingCallSite.java:292:in `cacheAndCall'
    from CachingCallSite.java:135:in `call'
    from CallNoArgNode.java:63:in `interpret'
    from DAsgnNode.java:110:in `interpret'
    from IfNode.java:111:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:111:in `INTERPRET_BLOCK'
    from Interpreted19Block.java:212:in `evalBlockBody'
    from Interpreted19Block.java:163:in `yield'
    from Interpreted19Block.java:136:in `yieldSpecific'
    from Block.java:99:in `yieldSpecific'
    from ZYieldNode.java:25:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from EnsureNode.java:96:in `interpret'
    from BeginNode.java:83:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:212:in `call'
    from DefaultMethod.java:207:in `call'
    from CachingCallSite.java:322:in `cacheAndCall'
    from CachingCallSite.java:178:in `callBlock'
    from CachingCallSite.java:187:in `callIter'
    from FCallOneArgBlockNode.java:34:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from ASTInterpreter.java:111:in `INTERPRET_BLOCK'
    from Interpreted19Block.java:212:in `evalBlockBody'
    from Interpreted19Block.java:200:in `yield'
    from Interpreted19Block.java:131:in `call'
    from Block.java:89:in `call'
    from RubyProc.java:270:in `call'
    from RubyProc.java:258:in `call19'
    from RubyProc$i$0$0$call19.gen:65535:in `call'
    from DynamicMethod.java:203:in `call'
    from DynamicMethod.java:199:in `call'
    from CachingCallSite.java:292:in `cacheAndCall'
    from CachingCallSite.java:135:in `call'
    from CallNoArgNode.java:63:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:147:in `call'
    from DefaultMethod.java:183:in `call'
    from CachingCallSite.java:292:in `cacheAndCall'
    from CachingCallSite.java:135:in `call'
    from VCallNode.java:86:in `interpret'
    from IfNode.java:111:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from WhileNode.java:131:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:147:in `call'
    from DefaultMethod.java:183:in `call'
    from CachingCallSite.java:292:in `cacheAndCall'
    from CachingCallSite.java:135:in `call'
    from CallNoArgNode.java:63:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from IfNode.java:117:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:190:in `call'
    from DefaultMethod.java:199:in `call'
    from CachingCallSite.java:312:in `cacheAndCall'
    from CachingCallSite.java:169:in `call'
    from CallOneArgNode.java:57:in `interpret'
    from ReturnNode.java:92:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from CaseNode.java:138:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:190:in `call'
    from DefaultMethod.java:199:in `call'
    from CachingCallSite.java:312:in `cacheAndCall'
    from CachingCallSite.java:169:in `call'
    from CallOneArgNode.java:57:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from RescueNode.java:216:in `executeBody'
    from RescueNode.java:120:in `interpretWithJavaExceptions'
    from RescueNode.java:110:in `interpret'
    from BeginNode.java:83:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from WhileNode.java:131:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:147:in `call'
    from DefaultMethod.java:183:in `call'
    from CachingCallSite.java:292:in `cacheAndCall'
    from CachingCallSite.java:135:in `call'
    from VCallNode.java:86:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from CallOneArgNode.java:57:in `interpret'
    from OrNode.java:95:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from AndNode.java:91:in `interpret'
    from OrNode.java:95:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from UntilNode.java:116:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:147:in `call'
    from DefaultMethod.java:183:in `call'
    from CachingCallSite.java:292:in `cacheAndCall'
    from CachingCallSite.java:135:in `call'
    from VCallNode.java:86:in `interpret'
    from DAsgnNode.java:110:in `interpret'
    from IfNode.java:111:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from RescueNode.java:216:in `executeBody'
    from RescueNode.java:120:in `interpretWithJavaExceptions'
    from RescueNode.java:110:in `interpret'
    from BeginNode.java:83:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from ASTInterpreter.java:111:in `INTERPRET_BLOCK'
    from Interpreted19Block.java:212:in `evalBlockBody'
    from Interpreted19Block.java:163:in `yield'
    from Interpreted19Block.java:136:in `yieldSpecific'
    from Block.java:99:in `yieldSpecific'
    from RubyKernel.java:1410:in `loop'
    from RubyKernel$s$0$0$loop.gen:65535:in `call'
    from CachingCallSite.java:302:in `cacheAndCall'
    from CachingCallSite.java:144:in `callBlock'
    from CachingCallSite.java:153:in `callIter'
    from FCallNoArgBlockNode.java:32:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from ASTInterpreter.java:111:in `INTERPRET_BLOCK'
    from Interpreted19Block.java:212:in `evalBlockBody'
    from Interpreted19Block.java:163:in `yield'
    from Block.java:130:in `yield'
    from RubyContinuation.java:106:in `enter'
    from RubyKernel.java:1204:in `rbCatch19Common'
    from RubyKernel.java:1197:in `rbCatch19'
    from RubyKernel$s$rbCatch19.gen:65535:in `call'
    from CachingCallSite.java:322:in `cacheAndCall'
    from CachingCallSite.java:178:in `callBlock'
    from CachingCallSite.java:187:in `callIter'
    from FCallOneArgBlockNode.java:34:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:169:in `call'
    from DefaultMethod.java:191:in `call'
    from CachingCallSite.java:302:in `cacheAndCall'
    from CachingCallSite.java:144:in `callBlock'
    from CachingCallSite.java:153:in `callIter'
    from CallNoArgBlockNode.java:64:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:147:in `call'
    from DefaultMethod.java:183:in `call'
    from CachingCallSite.java:292:in `cacheAndCall'
    from CachingCallSite.java:135:in `call'
    from CallNoArgNode.java:63:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from ASTInterpreter.java:111:in `INTERPRET_BLOCK'
    from Interpreted19Block.java:212:in `evalBlockBody'
    from Interpreted19Block.java:163:in `yield'
    from Block.java:130:in `yield'
    from RubyContinuation.java:106:in `enter'
    from RubyKernel.java:1204:in `rbCatch19Common'
    from RubyKernel.java:1197:in `rbCatch19'
    from RubyKernel$s$rbCatch19.gen:65535:in `call'
    from CachingCallSite.java:322:in `cacheAndCall'
    from CachingCallSite.java:178:in `callBlock'
    from CachingCallSite.java:187:in `callIter'
    from FCallOneArgBlockNode.java:34:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from EnsureNode.java:96:in `interpret'
    from BeginNode.java:83:in `interpret'
    from NewlineNode.java:104:in `interpret'
    from BlockNode.java:71:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:190:in `call'
    from DefaultMethod.java:199:in `call'
    from CachingCallSite.java:312:in `cacheAndCall'
    from CachingCallSite.java:169:in `call'
    from jruby/bin/jirb:13:in `__file__'
    from jruby/bin/jirb:-1:in `load'
    from Ruby.java:697:in `runScript'
    from Ruby.java:690:in `runScript'
    from Ruby.java:597:in `runNormally'
    from Ruby.java:446:in `runFromMain'
    from Main.java:369:in `doRunFromMain'
    from Main.java:258:in `internalRun'
    from Main.java:224:in `run'
    from Main.java:208:in `run'
    from Main.java:188:in `main'

jline thinks that the console is 0 chars wide..

https://github.com/jline/jline/blob/master/src/main/java/jline/ConsoleReader.java#L1414

@carlhoerberg

probably a jline issue, don't know how to reproduce it in a pure java environment =/

@carlhoerberg

the problem seems to lay with Heroku. stty -a returns zero columns and row which confuses jline (https://github.com/jline/jline/blob/master/src/main/java/jline/UnixTerminal.java#L218)

$ heroku run "stty -a < /dev/tty"
Running stty -a < /dev/tty attached to terminal... up, run.1
speed 38400 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke
@BanzaiMan
Owner

Looks like your patch is incorporated to a jline release (and subsequently JRuby).

@BanzaiMan BanzaiMan closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.