Debian Bug report logs - #35288
ispell: use termios instead of termio

version graph

Package: ispell; Maintainer for ispell is Robert Luberda <robert@debian.org>; Source for ispell is src:ispell.

Reported by: Nikita Schmidt <cetus@snowball.ucd.ie>

Date: Tue, 30 Mar 1999 20:18:02 UTC

Severity: fixed

Found in version 3.1.20-0.6

Done: David Coe <david.coe@someotherplace.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian QA Group <debian-qa@lists.debian.org>:
Bug#35288; Package ispell. Full text and rfc822 format available.

Acknowledgement sent to Nikita Schmidt <cetus@snowball.ucd.ie>:
New bug report received and forwarded. Copy sent to Debian QA Group <debian-qa@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Nikita Schmidt <cetus@snowball.ucd.ie>
To: submit@bugs.debian.org
Subject: ispell: use termios instead of termio
Date: Tue, 30 Mar 1999 21:05:09 +0100
Package: ispell
Version: 3.1.20-0.6

Ispell uses either the termio or the sgtty interface to operate terminal
modes.  The GNU libc encourages use of termios in favour of termio.

Because of backwards compatibility, there are problems associated with the
obsolete termio interface.  For example, on Linux/Alpha termios is implemented
in glibc style with separate VMIN and VEOF constants, while termio is made
compatible with Digital UNIX where VMIN == VEOF.  Since both termio and
termios use the same names for these constants, glibc defines them as for the
termios interface, leaving termio unsupported.  Thus, when termio is used,
terminal parameters get set incorrectly.

On Linux/Alpha this leads to VMIN parameter being set to 4 (old VEOF value,
Ctrl-D) during terminal initialisation, and after that ispell only accepts
keystrokes in packets of four.

The patch below works around this problem by detecting glibc and choosing
termios instead of termio.  It may not be an optimal solution, but at least it
fixes the problem on Linux/Alpha and is believed not to break things on other
platforms.

Thanks

Nikita


--- ispell-3.1.20/term.c.orig	Wed Nov  2 18:44:28 1994
+++ ispell-3.1.20/term.c	Tue Mar 30 19:42:59 1999
@@ -64,12 +64,22 @@
 #include "ispell.h"
 #include "proto.h"
 #include "msgs.h"
+#include <signal.h>
+
+#ifdef __GLIBC__
+/* Use termios under at least glibc */
+#include <termios.h>
+#define USE_TERMIOS
+#ifndef USG
+#define USG
+#endif
+#else
 #ifdef USG
 #include <termio.h>
 #else
 #include <sgtty.h>
 #endif
-#include <signal.h>
+#endif
 
 void		erase P ((void));
 void		move P ((int row, int col));
@@ -135,6 +145,10 @@
     return putchar (c);
     }
 
+#ifdef USE_TERMIOS
+static struct termios	sbuf;
+static struct termios	osbuf;
+#else
 #ifdef USG
 static struct termio	sbuf;
 static struct termio	osbuf;
@@ -146,6 +160,7 @@
 static struct ltchars	oltc;
 #endif
 #endif
+#endif
 static int		termchanged = 0;
 static SIGNAL_TYPE	(*oldint) ();
 static SIGNAL_TYPE	(*oldterm) ();
@@ -247,7 +262,11 @@
 	(void) fprintf (stderr, TERM_C_NO_BATCH);
 	exit (1);
 	}
+#ifdef USE_TERMIOS
+    (void) tcgetattr (0, &osbuf);
+#else
     (void) ioctl (0, TCGETA, (char *) &osbuf);
+#endif
     termchanged = 1;
 
     sbuf = osbuf;
@@ -256,7 +275,11 @@
     sbuf.c_iflag &= ~(INLCR | IGNCR | ICRNL);
     sbuf.c_cc[VMIN] = 1;
     sbuf.c_cc[VTIME] = 1;
+#ifdef USE_TERMIOS
+    (void) tcsetattr (0, TCSANOW, &sbuf);
+#else
     (void) ioctl (0, TCSETAW, (char *) &sbuf);
+#endif
 
     uerasechar = osbuf.c_cc[VERASE];
     ukillchar = osbuf.c_cc[VKILL];
@@ -343,6 +366,9 @@
 	{
 	if (te)
 	    tputs (te, 1, putch);
+#ifdef USE_TERMIOS
+	(void) tcsetattr (0, TCSADRAIN, &osbuf);
+#else
 #ifdef USG
 	(void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
@@ -351,6 +377,7 @@
 	(void) ioctl (0, TIOCSLTC, (char *) &oltc);
 #endif
 #endif
+#endif
 	}
     exit (0);
     }
@@ -359,6 +386,9 @@
 static SIGNAL_TYPE onstop (signo)
     int		signo;
     {
+#ifdef USE_TERMIOS
+    (void) tcsetattr (0, TCSANOW, &osbuf);
+#else
 #ifdef USG
     (void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
@@ -367,6 +397,7 @@
     (void) ioctl (0, TIOCSLTC, (char *) &oltc);
 #endif
 #endif
+#endif
     (void) signal (signo, SIG_DFL);
 #ifndef USG
     (void) sigsetmask (sigblock (0) & ~(1 << (signo - 1)));
@@ -374,6 +405,9 @@
     (void) kill (0, signo);
     /* stop here until continued */
     (void) signal (signo, onstop);
+#ifdef USE_TERMIOS
+    (void) tcsetattr (0, TCSANOW, &sbuf);
+#else
 #ifdef USG
     (void) ioctl (0, TCSETAW, (char *) &sbuf);
 #else
@@ -382,6 +416,7 @@
     (void) ioctl (0, TIOCSLTC, (char *) &ltc);
 #endif
 #endif
+#endif
     }
 #endif
 
@@ -434,6 +469,9 @@
 	}
     argv[i] = NULL;
 
+#ifdef USE_TERMIOS
+    (void) tcsetattr (0, TCSANOW, &osbuf);
+#else
 #ifdef USG
     (void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
@@ -442,6 +480,7 @@
     (void) ioctl (0, TIOCSLTC, (char *) &oltc);
 #endif /* TIOCSLTC */
 #endif
+#endif
     (void) signal (SIGINT, oldint);
     (void) signal (SIGTERM, oldterm);
 #ifdef SIGTSTP
@@ -480,6 +519,9 @@
 	(void) signal (SIGTSTP, onstop);
 #endif
 
+#ifdef USE_TERMIOS
+    (void) tcsetattr (0, TCSANOW, &sbuf);
+#else
 #ifdef USG
     (void) ioctl (0, TCSETAW, (char *) &sbuf);
 #else
@@ -488,6 +530,7 @@
     (void) ioctl (0, TIOCSLTC, (char *) &ltc);
 #endif /* TIOCSLTC */
 #endif
+#endif
     if (termstat)
 	{
 	(void) printf (TERM_C_TYPE_SPACE);
@@ -513,6 +556,9 @@
     int		ch;
 #endif
 
+#ifdef USE_TERMIOS
+    (void) tcsetattr (0, TCSANOW, &osbuf);
+#else
 #ifdef USG
     (void) ioctl (0, TCSETAW, (char *) &osbuf);
 #else
@@ -521,6 +567,7 @@
     (void) ioctl (0, TIOCSLTC, (char *) &oltc);
 #endif
 #endif
+#endif
     (void) signal (SIGINT, oldint);
     (void) signal (SIGTERM, oldterm);
 #ifdef SIGTSTP
@@ -545,12 +592,16 @@
 	(void) signal (SIGTSTP, onstop);
 #endif
 
+#ifdef USE_TERMIOS
+    (void) tcsetattr (0, TCSANOW, &sbuf);
+#else
 #ifdef USG
     (void) ioctl (0, TCSETAW, (char *) &sbuf);
 #else
     (void) ioctl (0, TIOCSETP, (char *) &sbuf);
 #ifdef TIOCSLTC
     (void) ioctl (0, TIOCSLTC, (char *) &ltc);
+#endif
 #endif
 #endif
     (void) printf (TERM_C_TYPE_SPACE);


Information forwarded to debian-bugs-dist@lists.debian.org, Debian QA Group <debian-qa@lists.debian.org>:
Bug#35288; Package ispell. Full text and rfc822 format available.

Acknowledgement sent to Torsten Landschoff <t.landschoff@gmx.net>:
Extra info received and forwarded to list. Copy sent to Debian QA Group <debian-qa@lists.debian.org>. Full text and rfc822 format available.

Message #10 received at 35288@bugs.debian.org (full text, mbox):

From: Torsten Landschoff <t.landschoff@gmx.net>
To: debian-qa@lists.debian.org
Cc: 35288@bugs.debian.org
Subject: Re: Bug#35288: ispell: use termios instead of termio
Date: Wed, 31 Mar 1999 11:31:36 +0200
On Tue, Mar 30, 1999 at 09:05:09PM +0100, Nikita Schmidt wrote:
> Package: ispell
> Version: 3.1.20-0.6
> [...]
> The patch below works around this problem by detecting glibc and choosing
> termios instead of termio.  It may not be an optimal solution, but at least it
> fixes the problem on Linux/Alpha and is believed not to break things on other
> platforms.
> [...]
>
> [patch removed]
 
I do not like such a stack of #ifdef's. The mail said termio is obsolete. If
this is correct - why not simply remove the ioctl-calls und use termios
instead? This might break ispell on older platforms but hey - that's life ;)

cu
    Torsten


Information forwarded to Debian QA Group <debian-qa@lists.debian.org>:
Bug#35288; Package ispell. Full text and rfc822 format available.

Acknowledgement sent to David Coe <david.coe@someotherplace.org>:
Extra info received and forwarded to maintainer. Copy sent to Debian QA Group <debian-qa@lists.debian.org>. Full text and rfc822 format available.

Message #15 received at 35288-maintonly@bugs.debian.org (full text, mbox):

From: David Coe <david.coe@someotherplace.org>
To: 35288-maintonly@bugs.debian.org, 35288-submitter@bugs.debian.org, Torsten Landschoff <t.landschoff@gmx.net>
Subject: ispell bug 35288
Date: Thu, 22 Jul 1999 02:28:14 +0000
I received the following comment from the upstream author.  I haven't
decided yet what to do about this, but will do so soon.  If you have 
further comments, please send them to 35288@bugs.debian.org.  Thanks.

> Torsten's suggestion of screwing backwards compatibility is not
> acceptable.  The real bug is in glibc, not in ispell.  Glibc has
> failed to properly support backwards compatibility with termio.  Until
> glibc is fixed, the suggested patch is the preferred solution.


Message sent on to Nikita Schmidt <cetus@snowball.ucd.ie>:
Bug#35288. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian QA Group <debian-qa@lists.debian.org>:
Bug#35288; Package ispell. Full text and rfc822 format available.

Acknowledgement sent to Nikita Schmidt <cetus@snowball.ucd.ie>:
Extra info received and forwarded to list. Copy sent to Debian QA Group <debian-qa@lists.debian.org>. Full text and rfc822 format available.

Message #23 received at 35288@bugs.debian.org (full text, mbox):

From: Nikita Schmidt <cetus@snowball.ucd.ie>
To: 35288@bugs.debian.org
Subject: Re: Bug#35288: ispell bug 35288
Date: Thu, 22 Jul 1999 21:19:41 +0100
I basically accept the upstream developer's position.  Here are my
comments to his response.

> > Torsten's suggestion of screwing backwards compatibility is not
> > acceptable.

OK.  I haven't seen any systems which support SysV termio yet don't
support the POSIX.1 termios, but I accept that there may be.  On a side
note, future systems are more likely to stick to POSIX and eventually
throw away legacy rubbish, so it may be worthwhile to make termios the
primary terminal interface API and revert to others on systems that
don't speak POSIX.

> > The real bug is in glibc, not in ispell.

Yes, assuming glibc _claims_ to support termio.

It is in fact quite easy to fix by redefining the appropriate constants
in <termio.h> after #include <termios.h>.  This is how it is done in
Digital UNIX, for instance.  Shall we file a bug report against glibc?

> > Glibc has
> > failed to properly support backwards compatibility with termio.  Until
> > glibc is fixed, the suggested patch is the preferred solution.

That's fine with me.  After all, support for all existing UNIX terminal
interfaces just can't be achieved without heavy #ifdefing (or resorting
to some wrapper library).

Thanks,

Nikita


Information forwarded to debian-bugs-dist@lists.debian.org, Debian QA Group <debian-qa@lists.debian.org>:
Bug#35288; Package ispell. Full text and rfc822 format available.

Acknowledgement sent to Torsten Landschoff <t.landschoff@gmx.net>:
Extra info received and forwarded to list. Copy sent to Debian QA Group <debian-qa@lists.debian.org>. Full text and rfc822 format available.

Message #28 received at 35288@bugs.debian.org (full text, mbox):

From: Torsten Landschoff <t.landschoff@gmx.net>
To: 35288@bugs.debian.org
Subject: Re: ispell bug 35288
Date: Fri, 23 Jul 1999 12:20:18 +0200
Hi David, 

Thanks for working on ispell - according to the qa list you are doing a great
job.

On Thu, Jul 22, 1999 at 02:28:14AM +0000, David Coe wrote:
> I received the following comment from the upstream author.  I haven't
> decided yet what to do about this, but will do so soon.  If you have 
> further comments, please send them to 35288@bugs.debian.org.  Thanks.
> 
> > Torsten's suggestion of screwing backwards compatibility is not
> > acceptable.  The real bug is in glibc, not in ispell.  Glibc has
> > failed to properly support backwards compatibility with termio.  Until
> > glibc is fixed, the suggested patch is the preferred solution.

I don't agree that glibc has a bug - it only has the problem to try supporting
both termios and termio. Anyway - if the upstream author wants to preserve
compatibility this is the way to go. After all we are only packagers and not
the "owners" of the software.

Thanks
    Torsten


Severity set to `fixed'. Request was from tmancill@debian.org to control@bugs.debian.org. Full text and rfc822 format available.

Bug closed, ack sent to submitter - they'd better know why ! Request was from David Coe <david.coe@someotherplace.org> to control@bugs.debian.org. Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Apr 21 03:01:10 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.