Skip to content

coreutils date -ud '-2 weeks' produces error: unexpected argument '-2' found #7515

@julian-klode

Description

@julian-klode

From the apt test suite:

jak@jak-t14-g3 ~/P/D/apt (solver3) [1]> ~/.cargo/bin/coreutils date -ud '-2 weeks'
error: unexpected argument '-2' found

  tip: to pass '-2' as a value, use '-- -2'

Usage: /home/jak/.cargo/bin/coreutils date [OPTION]... [+FORMAT]...
       /home/jak/.cargo/bin/coreutils date [OPTION]... [MMDDhhmm[[CC]YY][.ss]]

For more information, try '--help'.
jak@jak-t14-g3 ~/P/D/apt (solver3) [1]> date.coreutils -ud '-2 weeks'
Do 6. Mär 20:31:42 UTC 2025

This is similar to uutils/parse_datetime#127 but at a different level, seems command-line parser is confused that the option value starts with a dash?

These seem to be the only blockers for the apt test suite; there may be more lurking in date and touch, but I had to replace the two due to these 2 bugs, so I haven't found out.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions