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

[Bug] Commands in script changes PPID when run from ksh shell on RHEL 9.

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Normal Normal
    • None
    • rhel-9.3.0
    • ksh
    • None
    • Normal
    • sst_cs_plumbers
    • ssg_core_services
    • 5
    • False
    • Hide

      None

      Show
      None
    • Red Hat Enterprise Linux
    • x86_64

      What were you trying to do that didn't work?

      When running commands in a script, last command of script returns the PPID of ksh shell's PID instead of script's PID.

      Please provide the package NVR for which bug is seen:

      ksh-1.0.0~beta.1-3.el9

      How reproducible:

      Always

      Steps to reproduce

      1.  Create a sample script to echo test messages and take ps output redirected :  
        # cat script.sh 
        echo "test1"
        ps -ef > out1.log
        echo "test2"
        ps -ef > out2.log
        echo "test3"
        ps -ef > out3.log
        
        # chmod +x script.sh
        
      2. Run the script via normal user and grep process information from output files. 
        $ ./script.sh
        test1
        test2
        test3
        
        $ egrep 'ksh|ps -ef|./sc' out1.log 
        UID PID PPID C STIME TTY TIME CMD
        pj 1510 1509 0 10:12 pts/0 00:00:00 -ks
        pj 1541 1510 0 10:14 pts/0 00:00:00 ./sc          <--- Scripts PID 
        pj 1542 1541 0 10:14 pts/0 00:00:00 ps -ef        <--- Matches PPID of ps with script PID
        
        $ egrep 'ksh|ps -ef|./sc' out2.log 
        pj 1510 1509 0 10:12 pts/0 00:00:00 -ks
        pj 1541 1510 0 10:14 pts/0 00:00:00 ./sc          <--- Scripts PID 
        pj 1542 1541 0 10:14 pts/0 00:00:00 ps -ef        <--- Matches PPID of ps with script PID
        
        $ egrep 'ksh|ps -ef|./sc' out3.log
        pj 1510 1509 0 10:12 pts/0 00:00:00 -ksh          <--- In last attempt, script process cant be seen and PID of ksh
        pj 1541 1510 0 10:14 pts/0 00:00:00 ps -ef        <--- Matches PPID of ps with ksh shell PID
        
      3. The last command is run via ksh shell instead of script itself and script process seems to be completed by then as last ps could not capture it.

      Expected results

      The commands run in script should show their Parent Process ID of script.

      Actual results

      The commands run in script shows Parent Process ID of ksh shell.

            vmihalko Vincent Mihalkovic
            rhn-support-ppaddhar Paras Paddhariya
            Vincent Mihalkovic Vincent Mihalkovic
            Karel Volný Karel Volný
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: