Skip to content

ls: Unexpected space before stdout in TTY output #6386

@RenjiSann

Description

@RenjiSann

I was fixing TODOs in the testsuite to check TTY outputs.

And I realized that there is a seemingly unexpected character (presumably a space) that gets printed.

❯ /bin/ls "$(echo -e 'a\nb')" --hide-control-chars  
'a'$'\n''b'

❯ target/debug/ls "$(echo -e 'a\nb')" --hide-control-chars
 'a'$'\n''b'
^
Unexpected space

The default escaping strategy when outputing to a TTY is shell-escape. Strangely, the bug does not appear when output is not a TTY but with --quoting-style=shell-escape set, as already checked by the testsuite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions