Bug 235781 - [patch] at(1) HH:MM fails to assume next day
Summary: [patch] at(1) HH:MM fails to assume next day
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-02-16 16:03 UTC by Christian Weisgerber
Modified: 2019-02-16 16:51 UTC (History)
0 users

See Also:


Attachments
Fix at(1) failure to assume next day (446 bytes, patch)
2019-02-16 16:03 UTC, Christian Weisgerber
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Weisgerber freebsd_committer freebsd_triage 2019-02-16 16:03:43 UTC
Created attachment 202068 [details]
Fix at(1) failure to assume next day

The at(1) man page says:

     The at utility allows some moderately complex time specifications.  It
     accepts times of the form HHMM or HH:MM to run a job at a specific time
     of day.  (If that time is already past, the next day is assumed.)

Due to an ancient bug, this only works if the hour is past.  It fails if we are still within the same hour but the minutes are past:

  $ date
  Sat Feb 16 16:56:28 CET 2019
  $ echo dummy | at 15:00
  Job 42 will be executed using /bin/sh
  $ echo dummy | at 16:00
  at: trying to travel back in time

Simple fix attached.  This is applicable to all versions of FreeBSD.