Bug 32411 - shutdown(8) absolute-time handling could be more useful
Summary: shutdown(8) absolute-time handling could be more useful
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 5.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-30 20:30 UTC by Garrett A. Wollman
Modified: 2018-01-02 09:03 UTC (History)
0 users

See Also:


Attachments
file.diff (2.09 KB, patch)
2001-11-30 20:30 UTC, Garrett A. Wollman
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Garrett A. Wollman 2001-11-30 20:30:01 UTC
	When an absolute time is specified to shutdown, the program's
	behavior depends on whether that time has passed during the
	current calendar day.  POLA would suggest that for shutdown,
	whose time argument is always supposed to be in the future,
	absolute times specified without a specific date should refer
	to the next occurrence of that time, rather than erroring out
	if that time has already passed during the current day.  (We
	have a mechanism that automatically updates the kernel and
	schedules a reboot for 4 AM, which usually fails because we
	don't normally change kernels between midnight and 3.

Fix: See the patch below for discussion.  There are other bugs
nearby in the code which this patch does not fix.  (There is also a
meta-bug, in that all the utilities which attempt to parse something
vaguely ISO 8601-like should probably use a common parser rather than
rolling their own.)
How-To-Repeat: 	shutdown -r 0400
Comment 1 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2002-04-07 14:35:57 UTC
State Changed
From-To: open->analyzed

This change makes sense to me.  If I would do something like that with 
absolute times I would mean the next occurence of that time. 

How about committing it Garrett?
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-01-01 22:34:41 UTC
A commit references this bug:

Author: eadler
Date: Mon Jan  1 22:33:58 UTC 2018
New revision: 327476
URL: https://svnweb.freebsd.org/changeset/base/327476

Log:
  shutdown: Assume absolute time is in the future

  The original bug describes it best:

  When an absolute time is specified to shutdown, the program's
  behavior depends on whether that time has passed during the
  current calendar day.  POLA would suggest that for shutdown,
  whose time argument is always supposed to be in the future,
  absolute times specified without a specific date should refer
  to the next occurrence of that time, rather than erroring out
  if that time has already passed during the current day.

  PR:		32411
  Submitted by:	wollman@khavrinen.lcs.mit.edu
  Submitted on:	2001-11-30 20:30:01 UTC
  Reviewed by:	asmodai (at time of bug submission)

Changes:
  head/sbin/shutdown/shutdown.8
  head/sbin/shutdown/shutdown.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-01-02 09:03:49 UTC
A commit references this bug:

Author: eadler
Date: Tue Jan  2 09:02:42 UTC 2018
New revision: 327488
URL: https://svnweb.freebsd.org/changeset/base/327488

Log:
  shutdown: Fix r327476 by adding init

  Initialize maybe_today. While here sort.

  PR:				32411
  Additionally reported by:	rgrimes, ian

Changes:
  head/sbin/shutdown/shutdown.c