Skip to content

date: Fix format optional argument to capture all following parameters#10914

Open
cerdelen wants to merge 1 commit intouutils:mainfrom
cerdelen:date_format_flag
Open

date: Fix format optional argument to capture all following parameters#10914
cerdelen wants to merge 1 commit intouutils:mainfrom
cerdelen:date_format_flag

Conversation

@cerdelen
Copy link
Contributor

Fixed the format argument to capture all following parameters. Also added a regression test.

Fix: #10910

@ChrisDryden
Copy link
Collaborator

ChrisDryden commented Feb 13, 2026

Was doing an investigation into why this was added in the first place: in #9661 Turns out I added it

It appears that finding unknown arguments would trigger exit() directly so I added that as an attempt to fix that, but then I ended up making the whole thing return a result. LGTM, just waiting on the CI

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/cut/bounded-memory. tests/cut/bounded-memory is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/factor/t10. tests/factor/t10 is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/unexpand/bounded-memory is now passing!
Note: The gnu test tests/env/env-signal-handler was skipped on 'main' but is now failing.

@cerdelen
Copy link
Contributor Author

This also doesn't fix all problems with arguments parsing, but it fixes this false negative at least.

If i just try for example

❯ gdate --date "@$(date +%s)" q
gdate: the argument ‘q’ lacks a leading '+';
when using an option to specify date(s), any non-option
argument must be a format string beginning with '+'
Try 'gdate --help' for more information.
❯ ./target/debug/date --date "@$(date +%s)" q
date: invalid date 'q'

But this is for another pr i'd argue as this PR already fixes a valid way of using date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

date is too strict about argument ordering

2 participants