Skip to content

parser: shopt -s expand_aliases breaks function NAME<TAB># comment heads (body executes inline) — breaks GNU example dirstack #388

Closed

Description

@caomengxuan666

Found during wt33 triage of #373 while classifying cli_tests::examples::gnu_dirstack. Real semantic gap.

Repro (script file, both shells)

target/issue-suites/results/wt33-373/cases/B19_shopt_alias_fn.sh:

shopt -s expand_aliases
function d	# display the directory stack
{
	echo ran-d
}
echo after

WSL GNU Bash 5.3.0:

after
rc 0, empty stderr

rubash:

ran-d
after
stderr: <script>: line 2: function: command not found
rc 0

The function head is not recognized once expand_aliases is on, so the body executes inline.

Impact

third_party/bash/examples/functions/dirstack fails wholesale under rubash (function: command not found at line 140, local: can only be used in a function, the display loop runs, ((: i+1: expression recursion level exceeded). GNU runs the same file silently (rc 0, no output) when line endings are LF; the vendored working-tree copy is CRLF, which GNU rejects entirely (noise) but rubash is designed to tolerate.

Notes

  • Without the shopt -s expand_aliases line the same head parses fine (probe B16, byte-identical); plain CRLF functions also parse fine (B17).
  • Raw artifacts: target/issue-suites/results/wt33-373/run/B19_shopt_alias_fn.*, bisect log in the lane notes.
  • cli_tests::examples::gnu_dirstack is left #[ignore] referencing this issue.

Activity

  1. added
    bug
    on Oct 2, 2026
  2. added a commit that references this issue on Oct 2, 2026
  3. caomengxuan666 commented on Oct 2, 2026

    @caomengxuan666
    MemberAuthor

    Landed on master (wt37/gapfix1 batch, CI green on bbccb1c): see the issue-suite tests/issue388_*_regressions.rs and the lane's two-shell matrices on the ticket trail. Master carries the fix; suites green.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions