Skip to content

docs: record what the HarmonyOS bash actually is - #227

Merged
caomengxuan666 merged 1 commit into
masterfrom
docs/harmonyos-bash-identity
Oct 9, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
docs/harmonyos-bash-identity

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Follow-up to #226.

#226 established that HarmonyOS PC ships bash, not mksh. This pins down what that bash is, because "it has bash" could have meant a reimplementation.

It is stock GNU bash

  • bash --version on a HarmonyOS PC prints GNU bash, version 5.1.16(1)-release — the GPL banner is GNU's own.
  • The public HNP build recipe (Termony, build-hnp/bash/Makefile):
    SOURCE_URL = $(GNU_MIRROR)/gnu/bash/bash-5.3.tar.gz
    --host aarch64-unknown-linux-musl --without-bash-malloc --disable-nls
    
    It pulls upstream GNU source and cross-compiles it. --without-bash-malloc drops bash's bundled allocator so musl's is used.
  • The build emits libsh.a, libhistory.a and the loadables (recho, printf, basename, …) — artifacts unique to the GNU bash source tree.

No Huawei-specific shell patches. It is an ordinary musl-linked GNU bash. That matters for us: it confirms HarmonyOS's userland is a musl + Linux-ABI stack, not a bespoke one — which is why niubash's target_os = "linux" cfgs all hit and the port was two lines.

Versions are recorded with provenance, not as "the" version: the measured machine ran 5.1.16, the build recipe fetches 5.3.

Two caveats from existing ports

1. Termony still bundled its own toolset. Its 42-package list is aria2 bash binutils *busybox* … gcc gdb gettext git … — bash yes, coreutils no, busybox instead. So even with 454 commands present system-wide, an independent porter concluded the stock surface was insufficient and vendored busybox. Not proof the 93% number is wrong — it is direct evidence that "the tools exist" and "the tools are dependable" are different claims, which is the distinction this page already draws.

2. Prefix mismatch in the built-in Terminal. Termony's README:

you can use these utilities in the builtin Terminal app under /data/service/hnp: Although some paths might get wrong due to prefix set to /data/app/base.org/base_1.0 … You can override them like: LD_LIBRARY_PATH=/data/service/hnp/base.org/base_1.0/lib TERMINFO=/data/service/hnp/base.org/base_1.0/share/terminfo fish

This does not contradict #226's PATH finding — PATH resolution and runtime prefix resolution are separate mechanisms — but it means the first device run should check prefix resolution too, not just PATH. On HarmonyOS 6.0+ the README adds that sudo is available and system environment variables are editable, which is how the overrides persist.

Diff

docs/src/platform-support.md — 331 → 391 lines. Docs only, no code.

Follow-up to #226. That change established that HarmonyOS PC ships bash
rather than mksh; this pins down what that bash is, and folds in two
caveats from existing ports.

Identity of the shell

It is stock GNU bash, not a reimplementation:

- bash --version prints "GNU bash, version 5.1.16(1)-release".
- The public HNP build recipe (Termony, build-hnp/bash/Makefile) fetches
  $(GNU_MIRROR)/gnu/bash/bash-5.3.tar.gz and configures with
  --host aarch64-unknown-linux-musl --without-bash-malloc --disable-nls.
- The build produces libsh.a, libhistory.a and the loadables (recho,
  printf, basename), which are specific to the GNU bash source tree.

No Huawei-specific shell patches. It is an ordinary musl-linked GNU bash,
which is why niubash's target_os = "linux" cfgs all hit.

Versions are recorded with their provenance rather than as "the" version:
the measured machine ran 5.1.16, the build recipe fetches 5.3.

Two caveats from existing ports

- Termony bundles 42 packages and its list has bash but not coreutils;
  it vendors busybox instead. So even with 454 commands present system-
  wide, an independent porter still found the stock surface insufficient.
  That is direct evidence for the distinction this page already draws:
  "the tools exist" and "the tools are dependable" are different claims.
- Prefix mismatch: inside the built-in Terminal, /data/service/hnp paths
  can resolve wrong because the prefix is /data/app/base.org/base_1.0;
  Termony's README documents LD_LIBRARY_PATH / TERMINFO overrides. This
  does not contradict the PATH finding -- PATH resolution and runtime
  prefix resolution are separate -- but it means the first device run
  should check prefix resolution too, not just PATH. HarmonyOS 6.0+ has
  sudo and editable system environment variables, per the same README.

Docs only; no code change.
@caomengxuan666
caomengxuan666 merged commit a3c566f into master Oct 9, 2026
9 checks passed
@caomengxuan666
caomengxuan666 deleted the docs/harmonyos-bash-identity branch October 10, 2026 01:25
caomengxuan666 added a commit that referenced this pull request Oct 13, 2026
…1.4.0 section (#326)

- The [Unreleased] entries (#284/#287, #293-#304, #313) move into
  [1.4.0]; [Unreleased] is empty again.
- Newly recorded (today's wave): Git Bash compatible factory default
  prompt (#292, headline), WT-form shortcuts (#290/#211), the paste
  burst trailing-Enter fix (#308/#291), self-update SHA256 + release
  pinning (#311/#312), managed-block convergence (#324), completion
  tables/NIU_COMPDEFS/NIU_ENV probe (#305-#307), -s on-demand stdin
  (rubash#586 host half), bash/rbash invocation faces (#321/#322).
- Older gaps recorded: closed-stdout pipe contract (#245/#286), history
  session-end write-back (#265), sh POSIX contract (#262), PWD persona
  alignment (#283), one-shot fast path (#270), --cwd-state (#272),
  --encoded-command (#271), REPL-command highlighting (#281), docs
  passes (#255/#225/#226/#227), MSRV (#267), easter-egg prune (#264).

CHANGELOG-only change; no version claims.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant