{"thread":{"id":"27038","subject":"[PATCH] t3306,t5304: avoid clock skew issues","startedAt":"2011-04-08T17:58:53Z","lastAt":"2011-04-14T17:38:13Z","messageCount":4,"participants":["Michael J Gruber","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"165432","messageId":"b384c3adae96498eafb2a1faddeaabe85a0f7225.1302285490.git.git@drmicha.warpmail.net","threadId":"27038","inReplyTo":null,"subject":"[PATCH] t3306,t5304: avoid clock skew issues","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-08T17:58:53Z","receivedAt":"2011-04-08T17:58:53Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"On systems where the local time and file modification time may be out of\nsync (e.g. test directory on NFS) t3306 and t5305 can fail because prune\ncompares times such as \"now\" (client time) with file modification times\n(server times for remote file systems). I.e., these are spurious test\nfailures.\n\nAvoid this by setting the relevant modification times to the local time.\n\nNoticed on a system with as little as 2s time skew.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nI don't think we can safeguard prune itself properly. A filesystem may be out\nof time sync sporadically (and produce incorrect time stamps) but then be in\nsync when \"git prune\" is run so that we can't detect it.\n\n t/t3306-notes-prune.sh |    4 ++++\n t/t5304-prune.sh       |    3 ++-\n 2 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh\nindex c428217..3114972 100755\n--- a/t/t3306-notes-prune.sh\n+++ b/t/t3306-notes-prune.sh\n@@ -20,6 +20,10 @@ test_expect_success 'setup: create a few commits with notes' '\n \tgit add file3 &&\n \ttest_tick &&\n \tgit commit -m 3rd &&\n+\tCOMMIT=$(git rev-parse HEAD) &&\n+\tCOMMIT_FILE=.git/objects/$(echo $COMMIT | sed \"s/^../&\\//\") &&\n+\ttest -f $COMMIT_FILE &&\n+\ttest-chmtime =+0 $COMMIT_FILE &&\n \tgit notes add -m \"Note #3\"\n '\n \ndiff --git a/t/t5304-prune.sh b/t/t5304-prune.sh\nindex e2ed13d..d645328 100755\n--- a/t/t5304-prune.sh\n+++ b/t/t5304-prune.sh\n@@ -14,7 +14,8 @@ add_blob() {\n \tBLOB=$(echo aleph_0 | git hash-object -w --stdin) &&\n \tBLOB_FILE=.git/objects/$(echo $BLOB | sed \"s/^../&\\//\") &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n-\ttest -f $BLOB_FILE\n+\ttest -f $BLOB_FILE &&\n+\ttest-chmtime =+0 $BLOB_FILE\n }\n \n test_expect_success setup '\n-- \n1.7.5.rc0.365.g23929a\n"},{"id":"165451","messageId":"7vipuo336t.fsf@alter.siamese.dyndns.org","threadId":"27038","inReplyTo":"b384c3adae96498eafb2a1faddeaabe85a0f7225.1302285490.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] t3306,t5304: avoid clock skew issues","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-04-08T20:20:42Z","receivedAt":"2011-04-08T20:20:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> On systems where the local time and file modification time may be out of\n> sync (e.g. test directory on NFS) t3306 and t5305 can fail because prune\n> compares times such as \"now\" (client time) with file modification times\n> (server times for remote file systems). I.e., these are spurious test\n> failures.\n>\n> Avoid this by setting the relevant modification times to the local time.\n>\n> Noticed on a system with as little as 2s time skew.\n>\n> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n> ---\n> I don't think we can safeguard prune itself properly. A filesystem may be out\n> of time sync sporadically (and produce incorrect time stamps) but then be in\n> sync when \"git prune\" is run so that we can't detect it.\n>\n>  t/t3306-notes-prune.sh |    4 ++++\n>  t/t5304-prune.sh       |    3 ++-\n>  2 files changed, 6 insertions(+), 1 deletions(-)\n>\n> diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh\n> index c428217..3114972 100755\n> --- a/t/t3306-notes-prune.sh\n> +++ b/t/t3306-notes-prune.sh\n> @@ -20,6 +20,10 @@ test_expect_success 'setup: create a few commits with notes' '\n>  \tgit add file3 &&\n>  \ttest_tick &&\n>  \tgit commit -m 3rd &&\n> +\tCOMMIT=$(git rev-parse HEAD) &&\n> +\tCOMMIT_FILE=.git/objects/$(echo $COMMIT | sed \"s/^../&\\//\") &&\n\nHmm, the remainder of the test script seems to know this commit is 5ee1c35\nall over the place.  Do the above two lines worth it?\n"},{"id":"165455","messageId":"4D9F706E.2090309@drmicha.warpmail.net","threadId":"27038","inReplyTo":"7vipuo336t.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] t3306,t5304: avoid clock skew issues","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-08T20:30:38Z","receivedAt":"2011-04-08T20:30:38Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 08.04.2011 22:20:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> On systems where the local time and file modification time may be out of\n>> sync (e.g. test directory on NFS) t3306 and t5305 can fail because prune\n>> compares times such as \"now\" (client time) with file modification times\n>> (server times for remote file systems). I.e., these are spurious test\n>> failures.\n>>\n>> Avoid this by setting the relevant modification times to the local time.\n>>\n>> Noticed on a system with as little as 2s time skew.\n>>\n>> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n>> ---\n>> I don't think we can safeguard prune itself properly. A filesystem may be out\n>> of time sync sporadically (and produce incorrect time stamps) but then be in\n>> sync when \"git prune\" is run so that we can't detect it.\n>>\n>>  t/t3306-notes-prune.sh |    4 ++++\n>>  t/t5304-prune.sh       |    3 ++-\n>>  2 files changed, 6 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh\n>> index c428217..3114972 100755\n>> --- a/t/t3306-notes-prune.sh\n>> +++ b/t/t3306-notes-prune.sh\n>> @@ -20,6 +20,10 @@ test_expect_success 'setup: create a few commits with notes' '\n>>  \tgit add file3 &&\n>>  \ttest_tick &&\n>>  \tgit commit -m 3rd &&\n>> +\tCOMMIT=$(git rev-parse HEAD) &&\n>> +\tCOMMIT_FILE=.git/objects/$(echo $COMMIT | sed \"s/^../&\\//\") &&\n> \n> Hmm, the remainder of the test script seems to know this commit is 5ee1c35\n> all over the place.  Do the above two lines worth it?\n\nI found that use of concrete sha1s a bit strange (I didn't run blame...)\nbut have no objection against keeping the new bit in line with the\nexisting test, i.e.\n\n+\tCOMMIT_FILE=.git/object/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&\n\ninstead of the 2 lines above.\n\nMichael\n"},{"id":"165819","messageId":"7ba5c34afb2e21355c2ec4b8251738c99895f693.1302802425.git.git@drmicha.warpmail.net","threadId":"27038","inReplyTo":"4D9F706E.2090309@drmicha.warpmail.net","subject":"[PATCHv2] t3306,t5304: avoid clock skew issues","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-04-14T17:38:13Z","receivedAt":"2011-04-14T17:38:13Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"On systems where the local time and file modification time may be out of\nsync (e.g. test directory on NFS) t3306 and t5305 can fail because prune\ncompares times such as \"now\" (client time) with file modification times\n(server times for remote file systems). I.e., these are spurious test\nfailures.\n\nAvoid this by setting the relevant modification times to the local time.\n\nNoticed on a system with as little as 2s time skew.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nI don't think we can safeguard prune itself properly. A filesystem may be out\nof time sync sporadically (and produce incorrect time stamps) but then be in\nsync when \"git prune\" is run so that we can't detect it.\n\nv2 uses the known sha1 directly in t3306, just like the rest of the test.\n---\n t/t3306-notes-prune.sh |    3 +++\n t/t5304-prune.sh       |    3 ++-\n 2 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t3306-notes-prune.sh b/t/t3306-notes-prune.sh\nindex c428217..86bf909 100755\n--- a/t/t3306-notes-prune.sh\n+++ b/t/t3306-notes-prune.sh\n@@ -20,6 +20,9 @@ test_expect_success 'setup: create a few commits with notes' '\n \tgit add file3 &&\n \ttest_tick &&\n \tgit commit -m 3rd &&\n+\tCOMMIT_FILE=.git/objects/5e/e1c35e83ea47cd3cc4f8cbee0568915fbbbd29 &&\n+\ttest -f $COMMIT_FILE &&\n+\ttest-chmtime =+0 $COMMIT_FILE &&\n \tgit notes add -m \"Note #3\"\n '\n \ndiff --git a/t/t5304-prune.sh b/t/t5304-prune.sh\nindex e2ed13d..d645328 100755\n--- a/t/t5304-prune.sh\n+++ b/t/t5304-prune.sh\n@@ -14,7 +14,8 @@ add_blob() {\n \tBLOB=$(echo aleph_0 | git hash-object -w --stdin) &&\n \tBLOB_FILE=.git/objects/$(echo $BLOB | sed \"s/^../&\\//\") &&\n \ttest $((1 + $before)) = $(git count-objects | sed \"s/ .*//\") &&\n-\ttest -f $BLOB_FILE\n+\ttest -f $BLOB_FILE &&\n+\ttest-chmtime =+0 $BLOB_FILE\n }\n \n test_expect_success setup '\n-- \n1.7.5.rc1.312.g1936c\n"}]}