dircolors: directory operand exits 2 with a custom message, GNU prints 'read error: Is a directory' and exits 1

Open Beginner friendly
#16,470 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@emirmrkaljevic is already working on this.

Since Nov 14, 2026.

  • #16471 by @emirmrkaljevic — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

The bug is in how the uutils dircolors binary handles a directory passed as the database operand: it prints expected file, got directory 'dd' and exits 2. Find where that message and exit code are produced, and change it to match GNU's read error: Is a directory with exit status 1. Done when dircolors -b <dir> prints the GNU-style message and echo $? gives 1.

Written by the indexing model from the issue text.

Description

U - dircolors

When the database operand is a directory, uutils dircolors uses its own message and exits with 2. GNU dircolors 9.12 prints a read error and exits with 1.

$ mkdir dd
$ dircolors -b dd      # GNU 9.12
dircolors: dd: read error: Is a directory
$ echo $?
1
$ coreutils dircolors -b dd    # uutils main
dircolors: expected file, got directory 'dd'
$ echo $?
2

Scripts that check for exit status 1 on a bad database file see a different code. Found with behave, a black-box differential testing tool I'm building, while running a dircolors spec recorded from GNU 9.12.

Dominant language
Rust
Stars
24.4k
Forks
2.2k
Avg merge
3d 6h
Merged PRs (30d)
434

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/coreutils

All issues in uutils/coreutils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.