Skip to content

[bug] Prompt escapes: \l empty, \D{%N} keeps %, \D{} empty #1099

Closed

Description

@caomengxuan666

[bug] \l yields empty instead of tty basename; \D{}/\D{%N} diverge (prompt escapes)

PS1='\l'; echo "${PS1@P}" < /dev/null
# GNU bash 5.3:  tty (or `1` under pty /dev/pts/1) / niu: empty
PS1='\D{%N}'; echo "${PS1@P}"
# GNU: N (glibc strftime drops unknown %) / niu: %N (kept literal)
PS1='\D{}'; echo "${PS1@P}"
# GNU: current time (%T shape) / niu: empty

Filed as one: all three are \-escape edge handling in @P. Related-but-distinct: #326 (same literal-passthrough philosophy for printf %(fmt)T, not \D).

Env: niubash 1.4.4 / rubash engine (master ~2026-10), GNU bash 5.3.20 aarch64-linux-android as oracle.

Activity

  1. added
    bug
    gnu-baseline
    area:interactive
    P3-low
    on Oct 22, 2026
  2. caomengxuan666 commented on Oct 23, 2026

    @caomengxuan666
    MemberAuthor

    Retest on niu 1.4.4 / rubash 1b14a3d vs GNU bash 5.3.20: \l and \D{} now match (fixed by #1111). Residual: \D{%N} — bash prints N, niu prints %N.

    PS1="\\D{%N}X"; p="${PS1@P}"; echo "got=[$p]"
    bash: got=[NX]
    niu : got=[%NX]
    

    Note: #1189 deliberately keeps % for unknown strftime specs, which directly conflicts with GNU here (glibc strftime drops the % for %N). Leaving closed — please triage as wontfix/by-design or align with GNU.

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

    P3-lowarea:interactivebuggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions