date: support MMDDhhmm[[CC]YY][.ss] positional argument for setting date - #11534
date: support MMDDhhmm[[CC]YY][.ss] positional argument for setting date#11534aguimaraes wants to merge 19 commits into
Conversation
|
GNU testsuite comparison: |
01e8f66 to
edbe04d
Compare
|
GNU testsuite comparison: |
Merging this PR will not alter performance
Comparing Footnotes
|
edbe04d to
5e0e12b
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
hey guys, is there anything else I can change to make this good enough to merge? |
…-format # Conflicts: # tests/by-util/test_date.rs
|
@cakebaker would you mind taking a look, please? I merged main, conflicts resolved, all tests passing. |
…-format # Conflicts: # src/uu/date/src/date.rs
rustix's geteuid() returns a Uid rather than an integer, so comparing it to 0 no longer compiles. Match the other call sites in this file.
034f9bd to
2168232
Compare
|
@sylvestre hey, I've solved the latest conflicts and fixed a small existing compatibility gap. |
Fixes #6398
The
datecommand accepts a bare positional argument to set the system clock:Previously, any positional argument without a
+prefix was rejected with "invalid date". This was already documented in the usage string but never implemented.The parser lives in
date.rsrather than theparse_datetimecrate because this format is specific to thedatecommand positional argument. It follows the existing pattern in this codebase wheretouchhas its ownparse_timestamp()for the similar[[CC]YY]MMDDhhmm[.ss]format.The implementation rearranges the input into
CCYYMMDDhhmm[.ss]and delegates tojiff::fmt::strtime::parsefor validation, same approach astouch::parse_timestamp(). Two-digit years use the same century rule astouch: 00-68 -> 20xx, 69-99 -> 19xx.