date input: unrecognized trailing tokens rejected (e.g. `8j`, `8 j`)
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Start at the parse_datetime entry point and inspect how trailing word-tokens are handled, then review the proposed test in the uutils/coreutils integration suite. Run the date cases for "8j" and "8 j" in the reproduction; done means both inputs succeed and produce 08:00:00 while existing parsing tests continue to pass.
Written by the indexing model from the issue text.
Description
Summary
GNU date silently ignores unrecognized trailing word-tokens and parses the preceding number as an hour. parse_datetime errors out instead.
Found by a fuzz_date run on uutils/coreutils.
Reproduction
$ TZ=UTC /usr/bin/date -u -d '8j' '+%H:%M:%S'
08:00:00
$ echo $?
0
$ TZ=UTC target/debug/coreutils date -u -d '8j' '+%H:%M:%S'
date: invalid date '8j'
$ echo $?
1
$ TZ=UTC /usr/bin/date -u -d '8 j' '+%H:%M:%S'
08:00:00
$ TZ=UTC target/debug/coreutils date -u -d '8 j' '+%H:%M:%S'
date: invalid date '8 j'
Test (in uutils/coreutils integration suite)
#[test]
fn test_date_ignores_unrecognized_trailing_tokens() {
for input in ["8j", "8 j"] {
new_ucmd!()
.env("TZ", "UTC")
.arg("-u")
.arg("-d")
.arg(input)
.arg("+%H:%M:%S")
.succeeds()
.stdout_only("08:00:00\n");
}
}
- Dominant language
- Rust
- Stars
- 37
- Forks
- 39
- Avg merge
- 17h 48m
- Merged PRs (30d)
- 8
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/parse_datetime
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
uutils/parse_datetime#317 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
uutils/parse_datetime#240 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
uutils/parse_datetime#160 · 10 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
uutils/parse_datetime#82 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
uutils/parse_datetime#36 · 4 comments · 1 reaction ·
All issues in uutils/parse_datetime
Similar issues
-
risk:low runtime status:in-progress type:test
Difficulty 1/5 Under an hour Newbie friendliness 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·