Bug 60170 - x11-clocks/xalarm (3.06) can fail in December
Summary: x11-clocks/xalarm (3.06) can fail in December
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-12 00:50 UTC by xfb52
Modified: 2004-04-02 18:09 UTC (History)
1 user (show)

See Also:


Attachments
patch-dates (679 bytes, text/plain)
2003-12-12 00:50 UTC, xfb52
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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 2004-04-02 18:09:04 UTC
State Changed
From-To: open->closed

Committed, thanks!