[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #22710] cvs 1.11.22 ignoring symlink modification time - appears un
From: |
Nelson B Bolyard |
Subject: |
[bug #22710] cvs 1.11.22 ignoring symlink modification time - appears unintentional |
Date: |
Mon, 24 Mar 2008 00:37:48 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; rv:1.9b5pre) Gecko/2008031700 NOT Firefox/2.0 SeaMonkey/2.0a1pre |
URL:
<http://savannah.nongnu.org/bugs/?22710>
Summary: cvs 1.11.22 ignoring symlink modification time -
appears unintentional
Project: Concurrent Versions System
Submitted by: nelsonb
Submitted on: Monday 03/24/2008 at 00:37
Category: Bug Fix (patch attached)
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Release:
Fixed Release: None
Fixed Feature Release: None
_______________________________________________________
Details:
In the cvs 1.11.22 sources, file src/vers_ts.c, function time_stamp(), there
is a block comment that appears to document how the function is intended to
work. It says:
/* If it's a symlink, return whichever is the newest mtime of
the link and its target, for safety.
*/
And there is code that does both an lstat and a stat, and computes the lesser
of the two modification times, e.g.
struct stat sb;
time_t mtime = 0L;
if (!CVS_LSTAT (file, &sb))
{
mtime = sb.st_mtime;
}
if (!CVS_STAT (file, &sb))
{
if (mtime < sb.st_mtime)
mtime = sb.st_mtime;
}
But the value of this computed mtime is not used in the
subsequent computations. Instead, the value of sb.st_mtime
is subsequently used.
tm_p = gmtime (&sb.st_mtime);
cp = tm_p ? asctime (tm_p) : ctime (&sb.st_mtime);
This means that the comparison of the two mtimes is not used.
The actual behavior is to use the value left in the stat buf
after stat() returns. Most of the time, this will be the
value returned by stat. The only way that sb.st_mtime can be
the value from lstat is if lstat succeeds but stat fails.
This tiny patch makes the code work the way that the comment
says it was intended to work.
- tm_p = gmtime (&sb.st_mtime);
- cp = tm_p ? asctime (tm_p) : ctime (&sb.st_mtime);
+ tm_p = gmtime (&mtime);
+ cp = tm_p ? asctime (tm_p) : ctime (&mtime);
However, it's not entirely clear to me which is the more
desirable behavior: the way the code actually works now,
or the way that the comments say it was intended to work.
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?22710>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [bug #22710] cvs 1.11.22 ignoring symlink modification time - appears unintentional,
Nelson B Bolyard <=