Skip to content

[cli] invocation-name-aware help is forked: bash --help / sh --help print the niu product help instead of the GNU usage contract #585

Closed

Description

@caomengxuan666

Evidence

WSL GNU bash 5.3.0 oracle:

$ bash --help
GNU bash, version 5.3.0(1)-release-(x86_64-pc-linux-gnu)
Usage:	bash [GNU long option] [option] ...
	bash [GNU long option] [option] script-file ...
GNU long options:
	--debug
	...
$ sh -c 'echo $?'; echo rc=$?
rc=0

Current (niu hosting the bash invocation name):

$ bash --help
Niubash 1.4.0 — a bash-compatible shell that feels at home on Windows.
Usage:  niu [option]
        niu -c <cmd> ...
  --install-wt-profile ...
  plugin add <id|owner/repo|url|path>
  ...

The fork

#504/#262 forward the sh/bash invocation name for the execution contract, but the help surface never forked: under a bash/sh argv[0] the product help (setup/font/doctor/plugin/self-update — none of which are bash options) is printed, and every GNU shell option (-l -i -r -s -D -O --debug --noprofile --norc --posix --restricted ...) is absent.

Expected

  • bash --help / sh --help under the respective invocation name print the GNU usage shape (version line + short/long option table), rc 0, to stdout.
  • niu --help keeps the product help.
  • The GNU option table should list what the engine actually honors today (login/-i/--posix/--rcfile...), not aspirational entries — mark anything unimplemented explicitly or omit it, per the GNU oracle byte shape where implemented.

Found during the 1.4.0 pre-release install audit (owner-reported on the packaged build).

Activity

  1. caomengxuan666 commented on Oct 13, 2026

    @caomengxuan666
    MemberAuthor

    Owner follow-up on the packaged build: sh --help and bash --help are byte-identical to the niu product help (diff-verified on the installed 1.4.0) — the fork is total, not partial. Constraints from the owner: niu --help KEEPS the full product help (including the Windows-only verbs — install-wt-profile/plugin/self-update); the GNU-usage fork applies only under the bash/sh invocation names; and the fix must not leak Windows-only help assets into the unix cross-compile lanes (keep the product table and the GNU tables behind the same cfg discipline the code already uses).

  2. added
    bug
    area:cmdline
    on Oct 17, 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

    area:cmdlinebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions