Skip to content

[bug] $BASHPID inside async ( ) subshell is off-by-one #1095

Closed

Description

@caomengxuan666

[bug] $BASHPID inside async ( ) subshell is off-by-one → self-signals misfire (HIGH)

(sleep 0.2; echo "child-self=$BASHPID") & echo "parent-dollar-bang=$!"
wait
# GNU bash 5.3:  child-self == parent-$! (e.g. both 30593)
# niu:           child-self = $!+1 (e.g. 30685 vs 30684)

Consequence over 6+ runs each: (sleep 0.3; kill -TERM $BASHPID) & wait $! → bash 6/6 rc=143; niu ~50% kill: (PID) - No such process / Permission denied / SURVIVED, and with two concurrent subshells the TERM lands on the sibling (w1=0, w2=143 instead of w1=143, w2=9). Parent-sent signals + wait -n attribution are fine — purely the reported $BASHPID value.

Env: niubash 1.4.4 / rubash engine (master ~2026-10), GNU bash 5.3.20 aarch64-linux-android as oracle.

Activity

  1. added
    bug
    gnu-baseline
    area:jobs
    P1-high
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-higharea:jobsbuggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions