Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-70844

The read command suspends on SIGTTOU because vipw does not restore terminal pgid.

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • rhel-9.5
    • shadow-utils
    • No
    • Moderate
    • Customer Facing
    • rhel-sst-idm-sssd
    • ssg_idm
    • None
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • x86_64
    • None

      What were you trying to do that didn't work?
       
      When a shell script containing the commands vipw and read is executed, it stops in the middle.
       
        [root@rhel9-minimal ~]# ./test.sh 
        vipw: /etc/passwd is unchanged
        Enter any key
        
        [2]+  Stopped                 ./test.sh
       
      It stops by SIGTTOU before executing the read command.
       
        [root@rhel9-minimal ~]# jobs -l
        [1]+ 61799 Stopped (tty output)    ./test.sh
       
      The cause is this commit.
      Fix vipw not resuming correctly when suspended

       

      I assume the following lines that sets the process group is affected.

      L342-L343

          /* Run child in a new pgrp and make it the foreground pgrp. */
          if (orig_pgrp != -1) {
              setpgid(pid, pid);
              tcsetpgrp(STDIN_FILENO, pid); 
      • My customer is asking for improvements.
         
        Please provide the package NVR for which the bug is seen:
         
      • shadow-utils-4.9-9.el9.x86_64
         
        How reproducible is this bug?:
         
      • Always
         
        Steps to reproduce
         
        1. Create the following script file:
         
        -- test.sh --
        #!/bin/bash
        /usr/sbin/vipw
        echo Enter any key
        read -s
        echo END  

         
        2. Run the script
         
          # chmod +x test.sh
          # ./test.sh
         
        Expected results
         

      • The script outputs “END” and completes. It works on RHEL8.
         
          [root@rhel8 ~]# ./test.sh
          vipw: /etc/passwd is unchanged
          Input enter to continue
          END
         
        Actual results
         
      • The script stops by SIGTTOU.
         
          [root@rhel9-minimal ~]# ./test.sh 
          vipw: /etc/passwd is unchanged
          Enter any key
          
          [1]+  Stopped                 ./test.sh
          [root@rhel9-minimal ~]# jobs -l
          [1]+ 61799 Stopped (tty output)    ./test.sh
         

              ipedrosa@redhat.com Iker Pedrosa
              rhn-support-kyoneyam Kazushige Yoneyama
              Iker Pedrosa Iker Pedrosa
              Anuj Borah Anuj Borah
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: