find: -fprint /dev/stdout truncates a redirected stdout

Open
#945 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@qodelicious is already working on this.

Since Nov 5, 2026.

  • #947 by @qodelicious — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Start by reading the handling of -fprint, -fprint0, -fprintf and -fls and how those actions open their output paths. Reproduce the reported case with redirected stdout, then check the corresponding stderr case. Done means /dev/stdout and /dev/stderr write to the redirected streams without truncating existing output.

Written by the indexing model from the issue text.

Description

GNU find treats /dev/stdout and /dev/stderr specially in -fprint, -fprint0, -fprintf and -fls. We open them as normal files, so when stdout is redirected the file gets truncated and the output overwrites itself.

$ echo keep > log
$ /usr/bin/find a.txt -fprint /dev/stdout >> log; cat log
keep
a.txt
$ find a.txt -fprint /dev/stdout >> log; cat log
a.txt

Same with -fprint /dev/stderr 2> err, where an error message overwrites the printed names.

Dominant language
Rust
Stars
653
Forks
115
Avg merge
1d 4h
Merged PRs (30d)
27

Getting set up

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/findutils

All issues in uutils/findutils

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.