Skip to content

[bug][P0] Function called in a pipeline receives caller "$@" as ONE space-joined argument (N=1 vs GNU N=3) — silently corrupts FFmpeg configure output (config.h loses 770 defines, rc still 0) #330

Closed

Description

@caomengxuan666

Found by ecosweep3 lane (FFmpeg n7.1.1 configure real-exec; carrier release build of 6106961).

Minimal reproducer (target/probe-out/p31.sh)

m(){ echo "N=$#"; for v; do echo "[$v]"; done; }
set -- a b c
m "$@" | cat      # pipeline member
m "$@"            # control: not piped
  • GNU bash 5.3.0: both calls print N=3 / [a][b][c]
  • rubash: piped call prints N=1 / [a b c] ("$@" collapsed into ONE space-joined argument); non-piped call correct (N=3)

Only "$@" is affected (a literal "a b c" argument behaves identically in both positions; the bug is the $@ expansion's word structure being lost when the function call is a pipeline element).

Real-world impact (FFmpeg n7.1.1, verified)

configure:866 map 'eval echo "$v \${$v:-no}"' "$@" | awk ... inside print_config, called as print_config ARCH_ "$config_files" $ARCH_LIST (configure:8230):

  • print_config itself receives 21/401/346 args correctly (instrumented PCDBG argc line in the artifacts)
  • the nested map ... "$@" | awk pipeline call receives N=1 (whole list space-joined) -> ${<whole list>:-no} -> bad substitution x5 -> zero output lines -> config.h generated with the header block only (15 lines) instead of GNU's 783 defines (ARCH_/HAVE_/CONFIG_* all missing), ffbuild/config.mak equally gutted - while configure still exits rc=0, i.e. silently broken build files.

Artifacts: target/issue-suites/results/ecosweep3/cfg/{ffmpeg.rub.out,ffmpeg.rub.err,ffdbg2.err,mapdbg.gnu.log,mapdbg.rub.log}; config.h diff = 787 lines.

GNU anchor

Pipeline elements are forked copies running the same expansion path: execute_cmd.c:624 execute_command_internal() -> execute_simple_command -> subst.c:13219 expand_word_list_internal(); the "$@" split-into-per-parameter words (each remaining quoted) happens in expand_word_internal's $@ handling (subst.c:9900s, list semantics) and is INDEPENDENT of whether the command is a pipeline member. Re-verify the exact $@ branch with grep in subst.c before fixing.

Related

Same family as #298 (unquoted positional not word-split in array assignment) - different context (quoted "$@" in a pipeline function call), both positional-parameter word-structure bugs.

Activity

  1. added
    bug
    gnu-baseline
    on Sep 29, 2026
  2. added 2 commits that reference this issue on Sep 29, 2026
  3. caomengxuan666 commented on Sep 29, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by wt14/pbbfix (568bd37, master): execute_function_pipeline_stage expanded arguments with scalar expand_word (space-joined), destroying field structure. GNU runs pipeline members through the SAME word-list expansion as everything else (execute_cmd.c:624 -> subst.c:13219; :10691 case @). Now expand_stage_tail_words (the shared argv builder). Matrix byte-identical ("$@"/$/"$"/mixed/"${arr[@]}"/glob/empties); FFmpeg n7.1.1 configure REAL RUN re-verified on the final binary: rc=0, zero bad substitutions, config.h 784 lines/781 defines = the GNU baseline (was 16/13), config.mak 3162 lines identical both sides; remaining diffs are platform-class only.

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

    buggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions