Bug 60170

Summary: x11-clocks/xalarm (3.06) can fail in December
Product: Ports & Packages Reporter: xfb52 <xfb52>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: xfb52
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch-dates none

Description xfb52 2003-12-12 00:50:12 UTC
NB priority marked high because bug becomes problematic to trigger in
any month other than December!

There's a bug in xalarm-3.06.  In December only, alarms which are set
to trigger on a particular day of any month (e.g. the 1st) will send
xalarm into an infinite loop if that date in December has passed.
E.g. on the 2nd Dec any alarm set to trigger on the first of any month
will cause an infinite loop.

The bug happens because the code trying to find how long it is before
each alarm is due only ever increments the month (modulo 12) and
forgets to ever increment the year.  Hence in December, it tries Dec
of the current year then Jan of the current year then Feb of the
current year etc. when it should try Dec of the current year, Jan of
the next year ...

Attached is a patch which fixes the problem for me.

Fix: Apply supplied patch or avoid dates which do not specify a month.
How-To-Repeat: 
Create an xalarm file (~/.xalarms is the default) with

1 - Alarm

Run 
        xalarm -file today

xalarm goes into infinite loop if the current date is in December and after the 1st.
Comment 1 Greg Lewis freebsd_committer freebsd_triage 2004-04-02 18:09:04 UTC
State Changed
From-To: open->closed

Committed, thanks!