Hide Forgot
Description of problem: Starting with Fedora 7, the xterm terminfo description added the "smm" attribute: infocmp xterm | grep smm smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m, man terminfo describes this as: meta_on smm mm turn on meta mode (8th-bit on) Apparently, the readline library emits this at initialization. This can cause problems with certain configure scripts that attempt to obtain version information from program via methods like: version=`echo "disp(OCTAVE_VERSION)" | octave -qf` as the escape sequence gets embedded. I'm not really sure if there is anything to fix in readline/ncurses to address this or just tell people to write better configure scripts, but it is certainly surprising behavior. Possibly readline should behave differently if stdin or stdout is a file or pipe? Test code: $ cat readline.c #include <stdio.h> #include <readline/readline.h> main() { char *ans = readline (">"); puts(ans); } $ gcc -o readline readline.c -l readline $ echo blah | ./readline > out $ od -a out 0000000 esc [ ? 1 0 3 4 h > b l a h nl 0000016
Readline (and ncurses) doesn't care much if stdout is not a tty. I think that's good as you can use readline with redirected output and input. octave should use fgets() or similar when it's not in interactive mode. octave --no-line-editing doesn't seem to help. `echo "disp(OCTAVE_VERSION)" | TERM=dumb octave -qf` gives the correct output.
Closing as NOTABUG. Please reopen if you think this should be fixed in readline.