Gentoo Archives: gentoo-dev

From: Ciaran McCreesh <ciaran.mccreesh@××××××××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] mtime preservation
Date: Thu, 26 Nov 2009 15:28:11
Message-Id: 20091126152753.607cffa7@snowcone
In Reply to: Re: [gentoo-dev] mtime preservation by Ulrich Mueller
1 On Thu, 26 Nov 2009 08:59:44 +0100
2 Ulrich Mueller <ulm@g.o> wrote:
3 > >> Not non-preservation. Partial and inconsistent corruption.
4 >
5 > > Wouldn't "loss of precision" be a more accurate description?
6 >
7 > Yes. Or even "rounding".
8
9 No, corruption, including of the seconds part, is the right way to
10 describe it.
11
12 > > Of the known packages which require timestamp preservation, do any
13 > > of them use sub-second precision in their timestamp comparisons?
14 >
15 > I can speak for Emacs only, where the comparison code (in fileio.c) is
16 > as follows:
17 >
18 > if (stat (SDATA (absname1), &st) < 0)
19 > return Qnil;
20 >
21 > mtime1 = st.st_mtime;
22 >
23 > if (stat (SDATA (absname2), &st) < 0)
24 > return Qt;
25 >
26 > return (mtime1 > st.st_mtime) ? Qt : Qnil;
27 >
28 > It uses stat(2), therefore nanoseconds are ignored.
29
30 Uh, two things.
31
32 First, Portage sometimes corrupts the second part too.
33
34 Second, [1]:
35
36 > For compatibility with earlier versions of this standard, the st_atime
37 > macro shall be defined with the value st_atim.tv_sec. Similarly,
38 > st_ctime and st_mtime shall be defined as macros with the values
39 > st_ctim.tv_sec and st_mtim.tv_sec, respectively.
40
41 Note that POSIX considers st_mtime to be legacy, and thinks you should
42 be using st_mtim instead.
43
44 Do you want this to break when Emacs starts following the newer
45 standard, or do you want to get this right now so we won't have to have
46 the discussion again a year later?
47
48 [1]: http://www.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
49
50 --
51 Ciaran McCreesh

Attachments

File name MIME type
signature.asc application/pgp-signature