[gnu.bash.bug] bash bug: readline incorrectly reset local tty mode flag

shige@foretune.co.jp (Shigeya Suzuki) (12/20/89)

Index:	readline/readline.c bash1.04

Description:
	On the terminal which needs both parity flags off,
	(Ex. Japanese Kanji terminal using Kanji character set with 8th bit on)
	bash incorrectly resets localmode *always*.
	With SONY NEWS, by dropping LPASS8 flag, tty driver will not
	allow to use Shift-JIS Kanji chatacter.

Repeat-By:
	Use bash on the terminal which (sg_flags & (EVENP|ODDP)) == 0
	tty will forget all local mode flags.

Fix:
	Get and store local tty mode flag always. apply following patch.


*** readline.c.ORIG	Wed Dec 20 02:43:14 1989
--- readline.c	Wed Dec 20 03:33:48 1989
***************
*** 1994,1999 ****
--- 1994,2003 ----
    /* If this terminal doesn't care how the 8th bit is used,
       then we can use it for the meta-key.
       We check by seeing if BOTH odd and even parity are allowed. */
+ #if defined (TIOCLGET) && defined (LPASS8)
+   ioctl (tty, TIOCLGET, &local_mode_flags);
+ #endif
+ 
    if ((the_ttybuff.sg_flags & (ODDP | EVENP)) == (ODDP | EVENP))
      {
  #ifdef PASS8
***************
*** 2002,2011 ****
  
  #if defined (TIOCLGET) && defined (LPASS8)
        {
! 	int flags;
! 	ioctl (tty, TIOCLGET, &flags);
! 	local_mode_flags = flags;
! 	flags |= LPASS8;
  	ioctl (tty, TIOCLSET, &flags);
        }
  #endif
--- 2006,2012 ----
  
  #if defined (TIOCLGET) && defined (LPASS8)
        {
! 	int flags = local_mode_flags | LPASS8;
  	ioctl (tty, TIOCLSET, &flags);
        }
  #endif



---
					Shigeya Suzuki
					shige%foretune.co.jp@uunet.uu.net
					..!uunet!kddlabs!lkbreth!shige

shige@foretune.co.jp (Shigeya Suzuki) (12/20/89)

Index:	readline/readline.c bash1.04

Description:
	On the terminal which needs both parity flags off,
	(Ex. Japanese Kanji terminal using Kanji character set with 8th bit on)
	bash incorrectly resets localmode *always*.
	With SONY NEWS, by dropping LPASS8 flag, tty driver will not
	allow to use Shift-JIS Kanji chatacter.

Repeat-By:
	Use bash on the terminal which (sg_flags & (EVENP|ODDP)) == 0
	tty will forget all local mode flags.

Fix:
	Get and store local tty mode flag always. apply following patch.


*** readline.c.ORIG	Wed Dec 20 02:43:14 1989
--- readline.c	Wed Dec 20 03:33:48 1989
***************
*** 1994,1999 ****
--- 1994,2003 ----
    /* If this terminal doesn't care how the 8th bit is used,
       then we can use it for the meta-key.
       We check by seeing if BOTH odd and even parity are allowed. */
+ #if defined (TIOCLGET) && defined (LPASS8)
+   ioctl (tty, TIOCLGET, &local_mode_flags);
+ #endif
+ 
    if ((the_ttybuff.sg_flags & (ODDP | EVENP)) == (ODDP | EVENP))
      {
  #ifdef PASS8
***************
*** 2002,2011 ****
  
  #if defined (TIOCLGET) && defined (LPASS8)
        {
! 	int flags;
! 	ioctl (tty, TIOCLGET, &flags);
! 	local_mode_flags = flags;
! 	flags |= LPASS8;
  	ioctl (tty, TIOCLSET, &flags);
        }
  #endif
--- 2006,2012 ----
  
  #if defined (TIOCLGET) && defined (LPASS8)
        {
! 	int flags = local_mode_flags | LPASS8;
  	ioctl (tty, TIOCLSET, &flags);
        }
  #endif



---
					Shigeya Suzuki

					shige%foretune.co.jp@uunet.uu.net
					..!uunet!kddlabs!lkbreth!shige