From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>,
Junio C Hamano <gitster@pobox.com>,
Jason Sewall <jasonsewall@gmail.com>,
git@vger.kernel.org, raa.lkml@gmail.com
Subject: Re: [PATCH] Add a 1-second sleep to git-cvsexportcommit test
Date: Wed, 25 Jul 2007 00:56:20 +0200 [thread overview]
Message-ID: <200707250056.20880.robin.rosenberg.lists@dewire.com> (raw)
In-Reply-To: <alpine.LFD.0.999.0707241144490.3607@woody.linux-foundation.org>
tisdag 24 juli 2007 skrev Linus Torvalds:
>
> On Tue, 24 Jul 2007, Robin Rosenberg wrote:
> >
> > 27778 time(NULL) = 1185268822
> > 27778 gettimeofday({1185268822, 953340}, NULL) = 0
> >
> > Here CVS sleeps. The amount varies between invocations since it
> > only sleeps enough for the seconds to wrap.
> >
> > 27778 nanosleep({0, 46660000}, NULL) = 0
> > 27778 time(NULL) = 1185268823
>
> Btw, this is *really* dangerous and buggy.
>
> The reason? The CPU real-time clock is very different from whatever clock
> the filesystems may use.
>
> Filesystems generally do not use the same clock as the CPU does. That's
> obviously true for things like networked filesystems, but it's actually
> true even for local filesystems (even on UP) because the CPU "realtime"
> clock rather expensive and much too exact for them. It does all the fancy
> NTP date correction etc, and it has all the complex code to actually make
> sure you don't get any time jumps etc.
Having our mind enlightened, I propose this or nothing as a workaround. Since
cvsexportcommit is really a CVS workaround we might work around some bugs
in CVS itself while we're at it.
-- robin
From: Robin Rosenberg <robin.rosenberg@dewire.com>
Date: Wed, 25 Jul 2007 00:53:24 +0200
Subject: [PATCH] Sleep in git-cvsexportcommit
If git cvsexportcommit is executed fast enough in sequence, the CVS
timestamps could end up being the same. CVS tries to fix this
by sleeping until the CPU clock changes seconds. Unfortunately,
the CPU clock and the file system clock are not necessarily the same, so
the timestamps could be the same anyway. When that happens CVS may not
recognize changed files and cvs will forget to commit some files.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
git-cvsexportcommit.perl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index d6ae99b..f6366be 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -277,6 +277,11 @@ if ($opt_c) {
# clean up
unlink(".cvsexportcommit.diff");
+# CVS version 1.11.x and 1.12.x sleeps the wrong way to ensure the timestamp
+# used by CVS and the one set by subsequence file modifications are different.
+# If they are not different CVS will not detect changes.
+sleep(1);
+
sub usage {
print STDERR <<END;
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-m msgprefix] [ parent ] commit
--
1.5.2.3
next prev parent reply other threads:[~2007-07-24 22:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-22 19:41 Test #7 in t9200-git-cvsexportcommit fails Jason Sewall
2007-07-22 20:21 ` Alex Riesen
2007-07-22 20:49 ` Jason Sewall
2007-07-22 21:42 ` Alex Riesen
2007-07-22 22:19 ` Junio C Hamano
2007-07-23 3:59 ` [PATCH] Add a 1-second sleep to git-cvsexportcommit test Jason Sewall
2007-07-23 4:32 ` Junio C Hamano
2007-07-23 7:55 ` Simon 'corecode' Schubert
2007-07-24 0:23 ` Robin Rosenberg
2007-07-24 8:11 ` Simon 'corecode' Schubert
2007-07-24 8:33 ` Robin Rosenberg
2007-07-24 8:38 ` Simon 'corecode' Schubert
2007-07-24 9:34 ` Robin Rosenberg
2007-07-24 10:14 ` Junio C Hamano
2007-07-24 12:57 ` Robin Rosenberg
2007-07-24 15:31 ` Jason Sewall
2007-07-24 19:02 ` Linus Torvalds
2007-07-24 22:56 ` Robin Rosenberg [this message]
2007-07-24 23:19 ` Linus Torvalds
2007-07-25 7:35 ` Andy Parkins
2007-07-25 7:43 ` Marius Storm-Olsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200707250056.20880.robin.rosenberg.lists@dewire.com \
--to=robin.rosenberg.lists@dewire.com \
--cc=corecode@fs.ei.tum.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jasonsewall@gmail.com \
--cc=raa.lkml@gmail.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).