NetBSD Problem Report #1384

From gnats  Sat Aug 19 15:07:39 1995
Received: from prunelle.laas.fr (matthieu@prunelle.laas.fr [140.93.160.68]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with SMTP id PAA09924 for <gnats-bugs@gnats.netbsd.org>; Sat, 19 Aug 1995 15:07:38 -0400
Message-Id: <9508191907.AA04303@prunelle.laas.fr>
Date: Sat, 19 Aug 1995 21:07:24 +0200
From: Matthieu Herrb <matthieu@laas.fr>
Reply-To: matthieu@laas.fr
To: gnats-bugs@gnats.netbsd.org
Subject: tip parity none fixes
X-Send-Pr-Version: 3.2

>Number:         1384
>Category:       bin
>Synopsis:       tip with none parity is not 8 bits clean (with patch)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 19 15:20:02 +0000 1995
>Closed-Date:    Sun Oct 29 00:51:21 +0000 1995
>Last-Modified:  Sun Oct 29 00:55:49 +0000 1995
>Originator:     Matthieu Herrb
>Release:        NetBSD-current 95/08/18
>Organization:
		LAAS/CNRS
>Environment:

System: NetBSD cougar 1.0A NetBSD 1.0A (COUGAR) #8: Tue Aug 15 21:08:23 MET DST 1995 matthieu@cougar:/usr/src/sys/arch/i386/compile/COUGAR i386


>Description:
	when parity is set to none in tip, the 8th bit is stripped in 
both input and output, which is incorrect.

>How-To-Repeat:
	try to transmit some chars with 8th bit set in both directions.

>Fix:
diff -c -r tip.orig/cmds.c tip/cmds.c
*** tip.orig/cmds.c	Sun Dec 25 12:30:28 1994
--- tip/cmds.c	Sat Aug 12 18:22:55 1995
***************
*** 144,150 ****
  	pwrite(FD, &r, 1);
  	do
  		read(FD, &c, 1); 
! 	while ((c&0177) != '\n');
  	ioctl(0, TIOCSETC, &defchars);

  	(void) setjmp(intbuf);
--- 144,150 ----
  	pwrite(FD, &r, 1);
  	do
  		read(FD, &c, 1); 
! 	while ((c&STRIP_PAR) != '\n');
  	ioctl(0, TIOCSETC, &defchars);

  	(void) setjmp(intbuf);
***************
*** 152,158 ****
  	start = time(0);
  	for (ct = 0; !quit;) {
  		eof = read(FD, &c, 1) <= 0;
! 		c &= 0177;
  		if (quit)
  			continue;
  		if (eof || any(c, eofchars))
--- 152,158 ----
  	start = time(0);
  	for (ct = 0; !quit;) {
  		eof = read(FD, &c, 1) <= 0;
! 		c &= STRIP_PAR;
  		if (quit)
  			continue;
  		if (eof || any(c, eofchars))
***************
*** 357,363 ****
  					alarm(0);
  					goto out;
  				}
! 			} while ((c&0177) != character(value(PROMPT)));
  			alarm(0);
  		}
  	}
--- 357,363 ----
  					alarm(0);
  					goto out;
  				}
! 			} while ((c&STRIP_PAR) != character(value(PROMPT)));
  			alarm(0);
  		}
  	}
diff -c -r tip.orig/tip.c tip/tip.c
*** tip.orig/tip.c	Fri Aug 11 09:04:08 1995
--- tip/tip.c	Sat Aug 12 18:25:27 1995
***************
*** 363,369 ****
  	}

  	while (1) {
! 		gch = getchar()&0177;
  		if ((gch == character(value(ESCAPE))) && bol) {
  			if (!(gch = escape()))
  				continue;
--- 363,369 ----
  	}

  	while (1) {
! 		gch = getchar()&STRIP_PAR;
  		if ((gch == character(value(ESCAPE))) && bol) {
  			if (!(gch = escape()))
  				continue;
***************
*** 377,383 ****
  				printf("\r\n");
  			continue;
  		} else if (!cumode && gch == character(value(FORCE)))
! 			gch = getchar()&0177;
  		bol = any(gch, value(EOL));
  		if (boolean(value(RAISE)) && islower(gch))
  			gch = toupper(gch);
--- 377,383 ----
  				printf("\r\n");
  			continue;
  		} else if (!cumode && gch == character(value(FORCE)))
! 			gch = getchar()&STRIP_PAR;
  		bol = any(gch, value(EOL));
  		if (boolean(value(RAISE)) && islower(gch))
  			gch = toupper(gch);
***************
*** 399,405 ****
  	register esctable_t *p;
  	char c = character(value(ESCAPE));

! 	gch = (getchar()&0177);
  	for (p = etable; p->e_char; p++)
  		if (p->e_char == gch) {
  			if ((p->e_flags&PRIV) && uid)
--- 399,405 ----
  	register esctable_t *p;
  	char c = character(value(ESCAPE));

! 	gch = (getchar()&STRIP_PAR);
  	for (p = etable; p->e_char; p++)
  		if (p->e_char == gch) {
  			if ((p->e_flags&PRIV) && uid)
***************
*** 538,544 ****
  }

  static char partab[0200];
! static int bits8;

  /*
   * Do a write to the remote machine with the correct parity.
--- 538,544 ----
  }

  static char partab[0200];
! int bits8;

  /*
   * Do a write to the remote machine with the correct parity.
diff -c -r tip.orig/tip.h tip/tip.h
*** tip.orig/tip.h	Thu Dec  8 12:23:56 1994
--- tip/tip.h	Sat Aug 12 18:24:11 1995
***************
*** 241,246 ****
--- 241,249 ----
  #define NOFILE	((FILE *)NULL)
  #define NOPWD	((struct passwd *)0)

+ extern int bits8;
+ #define STRIP_PAR (bits8 ? 0377 : 0177)
+ 
  struct sgttyb	arg;		/* current mode of local terminal */
  struct sgttyb	defarg;		/* initial mode of local terminal */
  struct tchars	tchars;		/* current state of terminal */
diff -c -r tip.orig/tipout.c tip/tipout.c
*** tip.orig/tipout.c	Thu Dec  8 12:23:58 1994
--- tip/tipout.c	Sat Aug 12 18:34:58 1995
***************
*** 147,153 ****
  #define	ALLSIGS	sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  		omask = sigblock(ALLSIGS);
  		for (cp = buf; cp < buf + cnt; cp++)
! 			*cp &= 0177;
  		write(1, buf, cnt);
  		if (boolean(value(SCRIPT)) && fscript != NULL) {
  			if (!boolean(value(BEAUTIFY))) {
--- 147,153 ----
  #define	ALLSIGS	sigmask(SIGEMT)|sigmask(SIGTERM)|sigmask(SIGIOT)|sigmask(SIGSYS)
  		omask = sigblock(ALLSIGS);
  		for (cp = buf; cp < buf + cnt; cp++)
! 			*cp &= STRIP_PAR;
  		write(1, buf, cnt);
  		if (boolean(value(SCRIPT)) && fscript != NULL) {
  			if (!boolean(value(BEAUTIFY))) {

>Release-Note:
>Audit-Trail:

State-Changed-From-To: open->analyzed
State-Changed-By: jtc
State-Changed-When: Tue Sep 26 02:09:13 1995
State-Changed-Why:
Hmmm.  Shouldn't the tty line discipline be handling the striping of 
parity bits?

State-Changed-From-To: analyzed->closed 
State-Changed-By: pk 
State-Changed-When: Sat Oct 28 20:51:21 EDT 1995 
State-Changed-Why:  
Line discipline would strip parity bits if parity is on. 
If parity is set to "none", characers with the high bit set should not 
be mistaken for the corresponding "stripped" characters. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.