The date command from GNU coreutils finally supports the date format dd.mm.yyyy and its short form dd.mm. with the release of coreutils-9.11 on 20 April (or as you can now write: date -d 20.4.). From a quick glance at Wikipedia, it’s used in over 30 countries, especially in and around Europe.

Setting up a build environment with both repositories (coreutils and gnulib) was quite a challenge, due to git submodules and autotools. The necessary patches, on the other hand, looked quite straightforward: add the new formats in lib/parse-datetime.y and have bison generate the new parser.

But it didn’t work: I still got bad format errors. However, if I used anything other than a dot as a separator (such as a comma or a pipe), it did work. This led me to the logic that parses decimal/nanoseconds in the lexer, which is not intuitive. I didn’t want to touch too much unrelated code, so I added a flag to not mangle the new format. I might revisit this someday if I come up with a cleaner design.

Then I added some tests and the docs, which was mostly straightforward again. The tests are rather sparse, spread over the two repositories and often use Perl or Bash scripts, which I had to understand first. Despite my attempts, I also didn’t get the GNU formatting completely right. Thankfully, the maintainer handled that and the test failure on Windows (apparently “Year 0003 is not supported there”). Thanks, Pádraig Brady.

When can I use it?

On rolling-release and faster-updating distros like Fedora, right now. On Debian, probably with the next release on a yet to be announced date.

On Ubuntu, you’ll need to wait until they release a new version based on the next Debian and then install the GNU coreutils yourself. Ubuntu now uses uutils by default, the Rewrite in Rust︎™ of coreutils.

All in all, I got to explore a foundational piece of GNU/Linux distributions, and learned how to send git patches via mail. Let’s see if I get to improve the Rust version, too.

Webmentions

No webmentions were found.

Comments