AIX Open Source

 View Only
  • 1.  Issue with bash v5 and named pipes/FIFOs

    Posted Thu June 23, 2022 07:30 AM
    Hi all,

    lately I found that a bash script which uses a named pipe/FIFO for process substitution sometimes leaves /tmp/sh-np.<nnnnnn> files behind. This does not happen upon each invocation of the script, so it seems to be a race condition. It does only occur on systems that have the bash v5 RPM installed (5.1.4-2, to be more exact). On systems with the same AIX level (7200-05-04-2220) and bash v4 (4.3.30-1), the script runs without such remnants.

    Here's a short example script to reproduce the problem:

    #!/bin/bash
    read min maj < <(uname -rv)
    exec echo $maj $min

    The exec command is what also matters here. Without that, there's also no such /tmp/sh-np.<nnnnnn> file afterwards. Sure enough in the real script this is used differently than in the example above, i.e. it invokes another command (perl in this case) that inherits some arguments and replaces the shell. Obviously when that happens, the named pipe/FIFO is not cleaned up correctly.

    On a Linux system with bash v5 I don't see this behavior. So it appears to be specific to AIX and the bash v5 RPM for AIX.

    BTW, there's another thread where this has already been discussed about a year ago, but there were no suggestions other than deleting these files afterwards. I'd rather see them not being left over, especially when the respective script is run frequently (via cron).

    Any thoughts, comments or chances that this could be fixed? Thanks.

    Regards,
    Markus


  • 2.  RE: Issue with bash v5 and named pipes/FIFOs

    IBM Champion
    Posted Fri June 24, 2022 07:26 AM

    This looks like " Bash-5.1 patch 8: clean up FIFOs created by redirections in child processes" (see https://git.savannah.gnu.org/cgit/bash.git/log/)


    @SANKET RATHI - If you're going to update the bash package, you may want to include all patches up to 16.



    ------------------------------
    José Pina Coelho
    IT Specialist at Kyndryl
    ------------------------------



  • 3.  RE: Issue with bash v5 and named pipes/FIFOs

    Posted Fri June 24, 2022 07:45 AM
    Right. We will update bash to the latest patch level (16).

    ------------------------------
    Ayappan P
    ------------------------------



  • 4.  RE: Issue with bash v5 and named pipes/FIFOs

    Posted Fri June 24, 2022 07:46 AM
    This sounds in fact very much like it. Thank you for the pointer, José!


  • 5.  RE: Issue with bash v5 and named pipes/FIFOs

    Posted Fri June 24, 2022 01:17 PM
    Thank you Jose. We will update bash to include all these patches.

    ------------------------------
    SANKET RATHI
    ------------------------------



  • 6.  RE: Issue with bash v5 and named pipes/FIFOs

    Posted Wed September 14, 2022 06:15 AM
    Any outlook when an updated bash RPM will be made available? Thanks.


  • 7.  RE: Issue with bash v5 and named pipes/FIFOs

    Posted Fri September 16, 2022 06:38 AM
    We are targeting end of this month.

    ------------------------------
    SANKET RATHI
    ------------------------------



  • 8.  RE: Issue with bash v5 and named pipes/FIFOs

    Posted Fri September 16, 2022 06:51 AM
    Ok, great! Thank you, Sanket!