[gnu.bash.bug] TIOCSETN without fsync in 0.83

franzen@UUNET.UU.NET ("Marco Franzen") (06/18/89)

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