Skip to content

Interactive invocation does not enable expand_aliases by default (-i / -ic and shared API) #642

Closed

Description

@caomengxuan666

Interactive invocation leaves expand_aliases disabled

Reproduced on native Windows at ce471a2 with an isolated HOME and no startup rc. Related host release blocker: unixwin/niubash#367.

Minimal reproduction

Run rubash --noprofile --norc -i and enter these on separate lines:

shopt -p expand_aliases
alias ll='printf ALIAS_OK'
alias ll
ll

Actual: shopt -u expand_aliases; the alias lists correctly, but ll reports command not found (command status 127). The -i -c and -ic forms also start with alias expansion disabled.

Expected, verified with GNU Bash 5.3.0(1)-release using script-file fixtures: shopt -s expand_aliases, and ll prints ALIAS_OK.

Initialization and override contract

GNU shell.c:1830 init_interactive enables aliases; main selects it at lines 540-549 before replaying CLI shopt options at lines 574-576 and before startup files. Rubash lacks this default in both standalone invocation and shared ShellInvocation::apply_to_executor_before_startup.

GNU probes confirm: interactive default on; explicit +O expand_aliases off and -O expand_aliases on regardless of position relative to -i; the last explicit shopt override wins; startup rc sees that CLI-resolved state and can disable it with shopt -u expand_aliases, without a subsequent reset. Noninteractive default stays off.

Local uncommitted fix covers the shared API and standalone reader, stdin, command-string and script-file paths. Focused regressions: 27 passed, 0 failed; 14 GNU comparison cases match stdout with exit 0. The separate host per-input reader/line-stamp issue remains tracked in unixwin/niubash#367; this issue covers the missing engine invocation default only.

Activity

  1. added
    bug
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions