From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Dec 11 16:50:16 2003 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0F6F116A4CE for ; Thu, 11 Dec 2003 16:50:16 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 37FF143D3F for ; Thu, 11 Dec 2003 16:50:13 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) hBC0oDFR098307 for ; Thu, 11 Dec 2003 16:50:13 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBC0oD1V098306; Thu, 11 Dec 2003 16:50:13 -0800 (PST) (envelope-from gnats) Resent-Date: Thu, 11 Dec 2003 16:50:13 -0800 (PST) Resent-Message-Id: <200312120050.hBC0oD1V098306@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Alex Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CE8F16A4CE for ; Thu, 11 Dec 2003 16:49:16 -0800 (PST) Received: from 82-41-35-57.cable.ubr05.edin.blueyonder.co.uk (82-41-35-57.cable.ubr05.edin.blueyonder.co.uk [82.41.35.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4D6743D2D for ; Thu, 11 Dec 2003 16:49:14 -0800 (PST) (envelope-from alex@82-41-35-57.cable.ubr05.edin.blueyonder.co.uk) Received: (from alex@localhost)hBC0e3wX093553; Fri, 12 Dec 2003 00:40:03 GMT (envelope-from alex) Message-Id: <200312120040.hBC0e3wX093553@82-41-35-57.cable.ubr05.edin.blueyonder.co.uk> Date: Fri, 12 Dec 2003 00:40:03 GMT From: Alex To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: xfb52@dial.pipex.com Subject: ports/60170: x11-clocks/xalarm (3.06) can fail in December X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Alex List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2003 00:50:16 -0000 >Number: 60170 >Category: ports >Synopsis: x11-clocks/xalarm (3.06) can fail in December >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Dec 11 16:50:12 PST 2003 >Closed-Date: >Last-Modified: >Originator: Alex >Release: FreeBSD 4.8-RELEASE-p14 i386 >Organization: >Environment: System: FreeBSD cartman 4.8-RELEASE-p14 FreeBSD 4.8-RELEASE-p14 #1: Sat Dec 6 10:11:32 GMT 2003 alex@cartman:/usr/src/sys/compile/CARTMAN i386 >Description: 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. >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. >Fix: Apply supplied patch or avoid dates which do not specify a month. --- patch-dates begins here --- --- dates.c Wed Jul 12 16:24:26 1995 +++ /home/alex/scratch/xalarm/dates.c Thu Dec 4 00:36:27 2003 @@ -296,11 +296,16 @@ if (month >= 0) date->tm_mon = month; if (year >= 0) date->tm_year = year; while ((year < 0) and (date->tm_year < (2500-1900)) and - (DaysBetween (&today, date) < 0)) - if (month < 0) - date->tm_mon = (date->tm_mon + 1) % 12; - else + (DaysBetween (&today, date) < 0)) { + if (month < 0) { + date->tm_mon++; + if (date->tm_mon > 11) { + date->tm_mon = 0; + date->tm_year++; + } + } else date->tm_year++; + } } else /* * We assume Buck Rodgers will have something better than xalarm... --- patch-dates ends here --- >Release-Note: >Audit-Trail: >Unformatted: