ksh: backslash-escaped octal codes (\nnn) don't work properly in the prompt

2015-07-30 Thread Vadim Ushakov
Hi, According to the manpage, the escape sequence \nnn is expanded to the octal character nnn in the PS1 prompt. In fact, it is expanded to a garbage. It seems that dopprompt() (in src/bin/ksh/lex.c) has the wrong calculation: n = cp[0] * 8 * 8 + cp[1] * 8 + cp[2]; snprintf(strbuf, sizeof

Re: ksh: backslash-escaped octal codes (\nnn) don't work properly in the prompt

2015-07-30 Thread Vadim Zhukov
2015-07-30 17:18 GMT+03:00 Vadim Ushakov igeekl...@gmail.com: Hi, According to the manpage, the escape sequence \nnn is expanded to the octal character nnn in the PS1 prompt. In fact, it is expanded to a garbage. It seems that dopprompt() (in src/bin/ksh/lex.c) has the wrong calculation:

Re: ksh: backslash-escaped octal codes (\nnn) don't work properly in the prompt

2015-07-30 Thread Vadim Zhukov
2015-07-30 17:18 GMT+03:00 Vadim Ushakov igeekl...@gmail.com: Hi, According to the manpage, the escape sequence \nnn is expanded to the octal character nnn in the PS1 prompt. In fact, it is expanded to a garbage. It seems that dopprompt() (in src/bin/ksh/lex.c) has the wrong calculation:

Re: ksh: backslash-escaped octal codes (\nnn) don't work properly in the prompt

2015-07-30 Thread Todd C. Miller
On Thu, 30 Jul 2015 17:50:29 +0300, Vadim Zhukov wrote: Too bad that I don't know how to make a test for this issue in regress/usr.bin/ksh, though. It could tests stdin, stdout, stderr and files, but I dunno how to test the shell prompt. Any ideas? How about this? - todd Index: regress.t