Skip to content

[bug] HOSTNAME is hardcoded to localhost instead of the machine's real host name #1139

Closed

Description

@caomengxuan666

[bug] HOSTNAME is hardcoded to localhost instead of the machine's real host name

echo $HOSTNAME
# on this machine (hostname / /etc/hostname: htch-runtime)
# GNU bash 5.3.20: htch-runtime
# rubash / niu:     localhost   (always, regardless of the actual host name)

Expected (GNU bash 5.3.20): HOSTNAME is the real host name at startup.
Actual (rubash): a constant localhost.

Scripts that branch on $HOSTNAME (per-host configuration, logging, prompt info) silently behave as if every machine were the same host.

Env: rubash master 493ebb2 / niubash 1.4.4 (niu, master 953f513, embeds rubash 493ebb2), Linux x86_64, GNU bash 5.3.20 x86_64-pc-linux-gnu as oracle. Also reproduces in niu (same engine).

Activity

  1. caomengxuan666 commented on Oct 23, 2026

    @caomengxuan666
    MemberAuthor

    FIXED-BY-#1181 — verified on master (263ce53f). Commit 1b8ada5.

    echo $HOSTNAME → DESKTOP-FDUJ7TN (real host name, via COMPUTERNAME fallback on Windows; uname on unix). Matches GNU.

    Residual edge: under a fully empty environment (env -i, no COMPUTERNAME/HOSTNAME) Windows still falls back to localhost — the gethostname call is #[cfg(unix)]-gated. Tracking that startup-gap tail under #1129.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions