Subject: bin/27593: ksh emacs editing mode has problems with 8-bit chars
To: None <>
From: None <>
List: netbsd-bugs
Date: 10/28/2004 08:32:11
>Number:         27593
>Category:       bin
>Synopsis:       ksh emacs editing mode has problems with 8-bit chars
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 28 05:33:00 UTC 2004
>Originator:     Arto Huusko
>Release:        NetBSD 2.0E
System: NetBSD 2.0E NetBSD 2.0E (MAAILMA) #4: Mon Jun 21 18:37:52 EEST 2004 root@lady:/local/netbsd/current/alpha/obj/sys/arch/alpha/compile/MAAILMA alpha
Architecture: alpha
Machine: alpha
	ksh emacs editing mode does not really like 8-bit characters, even
	if they are acceptable by current locale. ksh calls iscntrl()
	to check whether input chars are control characters, and then
	prepends them with a ^ when they are control characters. However,
	with signed chars int promotion makes this go wrong. (Note that,
	oddly, some chars with MSB set do still work)

	Note that this same problem may or may not affect vi editing mode,
	too, but I didn't check.
	Set CTYPE to something that allows 8-bit chars; try to type some
	in ksh prompt and see ksh turn them into control chars, e.g. "^".
	Here's the diff I'm using:

Index: emacs.c
RCS file: /cvsroot/netbsd/src/bin/ksh/emacs.c,v
retrieving revision 1.25
diff -r1.25 emacs.c
< 	if (iscntrl(c))		/* control char */
> 	if (iscntrl((unsigned char)c))		/* control char */
< 	} else if (iscntrl(c))  {
> 	} else if (iscntrl((unsigned char)c))  {
< 	if (iscntrl(c))  {
> 	if (iscntrl((unsigned char)c))  {