uutils / uutils/coreutils

date: width prefix in %N format specifier ignored if it is a negative number.

Open
#12,034 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

uu coreutils' date's width prefix in %N format specifier is ignored if its a negative number. What GNU coreutils does is that when the width prefix in %N is a negative number, it returns an output identical to what the abstract value of the width prefix is.
Maybe we can change width to be an isize and effective_width to be equal to width's abstract value if width < 0?

How to reproduce
$ cargo run date +%-2N
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/coreutils date '+%-2N'`
807837678
GNU coreutils' output
$ date +%-2N
36

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 with the date command and reproduce the issue using cargo run date +%-2N, then compare its output with GNU date +%-2N. Trace the %N width handling and verify that negative widths produce the same output as their absolute value; done means the reproduction matches GNU 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
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.