Skip to content

basename, dirname, readlink, realpath, du: names are not quoted on a terminal #16647

Open

Description

@sylvestre

On a terminal, basename, dirname, readlink, realpath and du print names unquoted. GNU 9.12 quotes them like ls does.

$ touch 'my file' && ln -s 'my file' 'my link'
$ script -qec "basename 'my link'" /dev/null

uutils: my link
GNU 9.12: 'my link'

Same for dirname 'my link/.', readlink 'my link', realpath --relative-to=. 'my link' and du 'my file'. QUOTING_STYLE=literal should turn it off.

The GNU test is currently skipped: it fakes a terminal by expecting a single TCGETS ioctl, and uutils does three at startup (including one on stderr).

GNU test: bash util/build-gnu.sh && bash util/run-gnu-test.sh tests/misc/tty-quoting.sh

Part of #14705

Activity

  1. Sahil-Gulihar commented on Nov 17, 2026

    @Sahil-Gulihar

    Hi, I'd like to work on this. I'll make basename, dirname, readlink, realpath and du quote names on a terminal the same way ls already does, respect QUOTING_STYLE=literal, and add tests. Could I be assigned?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions