Skip to content

chage -E, usermod -e: dates other than YYYY-MM-DD are rejected #365

Open

Description

@jayhemnani9910

chage -E and usermod -e (and useradd -e) accept only YYYY-MM-DD or a day count. GNU 4.17.4 reads the date with its general date parser, so other common forms work:

# chage -E 01/02/2030 alice
GNU:  exit 0, expire = 21916 (2030-01-02)
here: invalid date '01/02/2030' (expected YYYY-MM-DD or days since epoch), exit 2

Same for 2030/01/02, 1/2/30, 2 Jan 2030, January 2, 2030 and tomorrow, which GNU all takes; usermod -e 01/02/2030 exits 3 here. Scripts written for GNU that pass a date in one of these forms stop working.

The parsing is in shadow-core/src/date.rs. uutils/parse_datetime already reads the GNU date -d forms; would using it there be welcome? I can send a PR.

Checked on main 7a84527 in ubuntu:26.04 (GNU passwd 1:4.17.4-2ubuntu3).

Activity

  1. pierre-warnier commented on Oct 28, 2026

    @pierre-warnier
    Collaborator

    Confirmed against Debian's shadow 4.17.4: all the forms you list are accepted there. parse_datetime is fine as a dependency (MIT, and jiff/winnow pass our licence policy). Keep YYYY-MM-DD, a plain day count and -1 behaving exactly as today, and add tests for each form you list. A PR is welcome once the clean-room confirmation I asked for on #370 is in, and within the three-open-PRs limit.

  2. pierre-warnier commented on Nov 3, 2026

    @pierre-warnier
    Collaborator

    @jayhemnani9910 are you still planning a PR for this one? The clean-room confirmation is in, so it's open to you. If you'd rather not, say so and we'll pick it up.

  3. jayhemnani9910 commented on Nov 3, 2026

    @jayhemnani9910
    ContributorAuthor

    No, I won't get to this one. Please go ahead, and thanks for checking.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions