uutils / uutils/coreutils

bug: stat panics with --printf

Open
#12,594 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - stat
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

Hi, uutils mainteners stat have some problems like printf, with the --printf, that is my tries of all previous isses and some work against stat --printf

relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --printf="%111111.1d" f

thread 'main' (90490) panicked at src/uu/stat/src/stat.rs:113:36:
Formatting argument out of range
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --printf="%111111c" f
?relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --printf="%.100000d" f

thread 'main' (90794) panicked at src/uu/stat/src/stat.rs:669:33:
Formatting argument out of range
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --printf="%.100000f" f

thread 'main' (90938) panicked at src/uu/stat/src/stat.rs:719:33:
Formatting argument out of range
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --printf="%.100000d\n" f

thread 'main' (90961) panicked at src/uu/stat/src/stat.rs:669:33:
Formatting argument out of range
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --printf="%.111111s" f

thread 'main' (91409) panicked at src/uu/stat/src/stat.rs:587:33:
Formatting argument out of range
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
relunsec@relunsec:~/software/coreutils/target/debug$ ./stat --printf="%.111111a" f

thread 'main' (92238) panicked at src/uu/stat/src/stat.rs:694:33:
Formatting argument out of range
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
relunsec@relunsec:~/software/coreutils/target/debug$ 

only one is not panicked the rest yes

Contributor guide

Open the contributing guide

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.

Research direction

Start in src/uu/stat/src/stat.rs at the reported locations around lines 113, 587, 669, 694, and 719. Reproduce the failures with the listed stat --printf formats, then trace how large widths and precisions are handled. Done means these inputs no longer panic and retain appropriate stat --printf behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.