File rcs-rlog-zLT.patch of Package rcs

Source: http://lists.gnu.org/archive/html/bug-rcs/2011-11/msg00000.html

rlog -zLT sometimes displays wrong date
From: 	  Oliver Billmann
Subject:  rlog -zLT sometimes displays wrong date
Date: 	  Thu, 10 Nov 2011 14:39:43 +0100

Hi,

I stumbled over a strange behaviour with rlog from the current 5.8 version.

Calling "rlog -zLT '-d>2011-05-04' RCS/user.sql,v" with user.sql,v
containing

    1.13
    date    2011.09.30.15.39.03;    author oliver;  state Exp;
    branches;
    next    1.12;


displays the following:

on a Gentoo Linux i686 machine:

    revision 1.13
    date: 2011-09-30 17:39:03+02;  author: oliver;  state: Exp;  lines: +4 -4
    Neue Spalte SessionFlag belegen...


on a Gentoo Linux x86_64 machine:

    revision 1.13
    date: 2011-01-01 16:39:03+01;  author: oliver;  state: Exp;  lines: +4 -4
    Neue Spalte SessionFlag belegen...


Note the incorrect date.

After some debugging it looks like a variable not being initialized
correctly: t.tm_yday in rcstime.c:date2str is not set but will be used
in tm2time if TM_LOCAL_ZONE is requested. On the i686 machine it was
"initialized" with some large negative number which will than lead to
tm_yday being initialized in tm2time. But on the x86_64 machine it
contained the valid value 0 which than always leads to YYYY-01-01 ...

The following patch should fix it:

--- src/rcstime.c.orig	2012-12-17 14:05:27.000000000 +0100
+++ src/rcstime.c	2012-12-17 14:05:19.000000000 +0100
@@ -131,6 +131,7 @@ date2str (char const date[datesize], cha
       MORE (tm_min);
       MORE (tm_sec);
       t.tm_wday = -1;
+      t.tm_yday = -1;
 #undef MORE
 
       zone = BE (zone_offset.seconds);
openSUSE Build Service is sponsored by