Hello Robin.

Just a quick question.

Steffen Nurpmeso wrote in
 <20240827000044.pV6uGLj0@steffen%sdaoden.eu>:
 |Robin Humble wrote in
 | <[email protected]>:
...
   |Robin Humble wrote in
   | <[email protected]>:
   ||on current RHEL9 and Fedora40, and also on s-nail git master, I ran
   ||into an issue that halts a backgrounded script connected to a tty.
   ||
   ||as an example on RHEL9 ->
   ||
   || $ ( echo blah | Mail root ) &
   ||[1] 2754649
   || $ ^M^M^M^M^C^C
   ||
   ||[1]+  Stopped                 ( echo blah | Mail root )
   || $ fg
   ||( echo blah | Mail root )
   || $ 
   ||
   ||the mail is sent, but the calling script (just a subshell in this case)
   ||is Stopped. the calling tty is confused and shows control characters.
   ||^C is needed to get back to the shell.

Could it be you are using bash (or another shell which uses the
readline library)?

The thing is that if i apply the patch (this to [master])

  diff --git a/src/mx/termios.c b/src/mx/termios.c
  index 733974ebce..08dd045226 100644
  --- a/src/mx/termios.c
  +++ b/src/mx/termios.c
  @@ -152,6 +152,8 @@ a_termios_norm_query(void){
            &a_termios_g.tiosg_normal->tiose_state) == 0);
      /* XXX always set ECHO and ICANON in our "normal" canonical state */
      a_termios_g.tiosg_normal->tiose_state.c_lflag |= ECHO | ICANON;
  +   a_termios_g.tiosg_normal->tiose_state.c_iflag |= ICRNL;
  +
      /*NYD2_OU;*/
      return rv;
   }

then everything is working as should in an otherwise unchanged
s-nail.
It seems readline does this:

  ./lib/sh/shtty.c:  ttp->c_iflag |= ICRNL;       /* make sure we get CR->NL on 
input */
  ./lib/readline/rltty.c:  tiop->c_iflag &= ~(ICRNL | INLCR);

I will post to bug-bash, but it would be nice to know.

Ciao Robin!

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to