Skip to content

[bug] POSIX-mode source diagnostic prints . instead of source #2947

Closed

Description

@caomengxuan666

Summary

In POSIX mode, when source cannot find the file, GNU names the invoked builtin in the diagnostic (source: mylib.sh: file not found). rubash names the canonical builtin instead (. : mylib.sh: file not found). The behavior itself agrees (no cwd fallback in POSIX mode; the failed special builtin is fatal); only the diagnostic word differs.

Repro

printf "echo lib-from-cwd\n" > mylib.sh
PATH=/usr/bin:/bin; set -o posix; source mylib.sh
GNU bash 5.3.20 rubash master 500769e
stderr bash: line 1: source: mylib.sh: file not found rubash: line 1: .: mylib.sh: file not found
rc 1 1

Scope (morph, GNU vs rubash, two passes, identical)

  • DIFF: only the POSIX-mode source form (mE3).
  • SAME (controls): default-mode source of a missing file (mE1, diagnostic has no builtin name on either shell); POSIX-mode . form (mE4, both print . — correct there); command source / builtin source of a missing file (mE5/mE6); absolute missing path (mE7); default-mode source with cwd fallback succeeds on both (mE8). So the defect is narrowly the diagnostic name used by the POSIX-mode source path.

Regression seed:

printf "echo lib-from-cwd\n" > mylib.sh
( PATH=/usr/bin:/bin; set -o posix; source mylib.sh ) 2>err.txt
grep -q "source: mylib.sh" err.txt && echo "PASS" || echo "FAIL"

(The subshell is needed because the failed special builtin is fatal in POSIX mode, so the outer script would not continue otherwise.) Expected (GNU): PASS. Actual (rubash master 500769e): FAIL.

Source

Differential hunt r79 (set/shopt option semantics, second round), oracle GNU bash 5.3.20, verified on fresh master build 500769e (two passes, stable).

Activity

  1. added
    bug
    gnu-baseline
    area:builtins
    on Nov 7, 2026
  2. added a commit that references this issue on Nov 12, 2026
    9fbeedd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area:builtinsbuggnu-baseline

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions