🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #28

TIOCSETN without fsync in 0.83

#28
From: "Marco Franzen"
Date: Sat, 17 Jun 1989 23:57
68 lines
2338 bytes
I don't know whether this is an error in bash or my OS.

When I do an ioctl (tty, TIOCSETN, &parms) before the output queue has
drained (on a serial line), I get garbled output. A fsync (tty) cures
this. To be sure I have added this before TIOCSETD, too.

Perhaps it should be conditional (#ifdef BSD).

*** readline.c~	Thu Dec  1 21:28:32 1988
--- readline.c	Thu Jun 15 22:41:15 1989
***************
*** 963,968
    }
    the_ttybuff.sg_flags &= ~ECHO;
    the_ttybuff.sg_flags |= (CBREAK | CRMOD);
    ioctl (tty, TIOCSETN, &the_ttybuff);
  }


--- 963,969 -----
    }
    the_ttybuff.sg_flags &= ~ECHO;
    the_ttybuff.sg_flags |= (CBREAK | CRMOD);
+   fsync (tty);
    ioctl (tty, TIOCSETN, &the_ttybuff);
  }

***************
*** 972,977
    int tty = fileno (rl_instream);

    the_ttybuff.sg_flags = original_tty_flags;
    ioctl (tty, TIOCSETN, &the_ttybuff);
  }
  #endif

--- 973,979 -----
    int tty = fileno (rl_instream);

    the_ttybuff.sg_flags = original_tty_flags;
+   fsync (tty);
    ioctl (tty, TIOCSETN, &the_ttybuff);
  }
  #endif

*** jobs.c~	Mon Nov 21 06:19:42 1988
--- jobs.c	Thu Jun 15 22:41:14 1989
***************
*** 857,862
      if (ldisc != NTTYDISC) {
        ldisc = NTTYDISC;
        err_string = "set";
        if (ioctl (shell_tty, TIOCSETD, &ldisc) < 0) {
  bad_ioctl:
  	fprintf (stderr, "initialize_jobs: %s line disc", err_string);

--- 857,863 -----
      if (ldisc != NTTYDISC) {
        ldisc = NTTYDISC;
        err_string = "set";
+       fsync (shell_tty);
        if (ioctl (shell_tty, TIOCSETD, &ldisc) < 0) {
  bad_ioctl:
  	fprintf (stderr, "initialize_jobs: %s line disc", err_string);

Marco Franzen	                           franzen@tubsibr.UUCP
Tech. U Brunswick, Germany    franzen%tubsibr.UUCP@uni-dortmund.DE
                               	           franzen@dbsinf6.BITNET
Technical Details
Message-ID: <8906172357.AA24151@kronos.ibr.tubs.de>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!UUNET.UU.NET!unido!infbs!tubsibr!franzen

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!UUNET.UU.NET!unido!infbs!tubsibr!franzen
From: unido!infbs!tubsibr!franzen@UUNET.UU.NET ("Marco Franzen")
Newsgroups: gnu.bash.bug
Subject: TIOCSETN without fsync in 0.83
Message-ID: <8906172357.AA24151@kronos.ibr.tubs.de>
Date: 17 Jun 89 23:57:07 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 68