bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash passes changed termios to backgrounded process(es) groups?


From: Steffen Nurpmeso
Subject: bash passes changed termios to backgrounded process(es) groups?
Date: Wed, 28 Aug 2024 01:46:59 +0200
User-agent: s-nail v14.9.25-599-g5c75a327b2

Hello.

I got a bug report for my mailer which stated

   $ ( echo blah | Mail root ) &
  [1] 2754649
   $ ^M^M^M^M^C^C

  [1]+  Stopped                 ( echo blah | Mail root )
   $ fg
  ( echo blah | Mail root )
   $

I turns out i answered him now

  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 MUA.
  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);

..and it seems that if bash starts a normal process then ICRNL is
set, but if it starts a (process)& or only process&, then not!
(I was about to send this to bug-readline first.)

--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

[Prev in Thread] Current Thread [Next in Thread]