{"thread":{"id":"24582","subject":"t4111 fails under valgrind","startedAt":"2010-07-30T10:18:52Z","lastAt":"2010-08-04T10:06:11Z","messageCount":4,"participants":["Thomas Rast","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"146772","messageId":"201007301218.52437.trast@student.ethz.ch","threadId":"24582","inReplyTo":null,"subject":"t4111 fails under valgrind","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-30T10:18:52Z","receivedAt":"2010-07-30T10:18:52Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Hi Jonathan\n\nt4111 never worked under valgrind on my machine, building 9f41a91 and\nthen running it with --valgrind results in:\n\n  expecting success: \n          cp postimage expected &&\n          reset_subdir preimage other &&\n          (\n                  cd sub/dir &&\n                  test_must_fail git apply --index \"$patch\"\n          ) &&\n          reset_subdir other preimage &&\n          (\n                  cd sub/dir &&\n                  test_must_fail git apply --index \"$patch\"\n          ) &&\n          reset_subdir preimage preimage &&\n          (\n                  cd sub/dir &&\n                  git apply --index \"$patch\"\n          ) &&\n          git show :sub/dir/file >actual &&\n          test_cmp expected actual &&\n          test_cmp expected sub/dir/file\n\n  error: sub/dir/file: does not match index\n  error: sub/dir/file: does not match index\n  error: sub/dir/file: does not match index\n  not ok - 5 apply --index from subdir of toplevel\n  #\n  #               cp postimage expected &&\n  #               reset_subdir preimage other &&\n  #               (\n  #                       cd sub/dir &&\n  #                       test_must_fail git apply --index \"$patch\"\n  #               ) &&\n  #               reset_subdir other preimage &&\n  #               (\n  #                       cd sub/dir &&\n  #                       test_must_fail git apply --index \"$patch\"\n  #               ) &&\n  #               reset_subdir preimage preimage &&\n  #               (\n  #                       cd sub/dir &&\n  #                       git apply --index \"$patch\"\n  #               ) &&\n  #               git show :sub/dir/file >actual &&\n  #               test_cmp expected actual &&\n  #               test_cmp expected sub/dir/file\n  #\n\nAny ideas what might be going wrong?\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"146791","messageId":"20100730183122.GA7578@dert.cs.uchicago.edu","threadId":"24582","inReplyTo":"201007301218.52437.trast@student.ethz.ch","subject":"Re: t4111 fails under valgrind","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-30T18:31:22Z","receivedAt":"2010-07-30T18:31:22Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Thomas Rast wrote:\n\n>   error: sub/dir/file: does not match index\n>   error: sub/dir/file: does not match index\n>   error: sub/dir/file: does not match index\n>   not ok - 5 apply --index from subdir of toplevel\n\nThanks for reporting.  Does this patch work for you?\n\n-- 8< --\nSubject: t4111 (apply): refresh index before applying patches to it\n\n\"git apply\", like most plumbing, does not automatically refresh the\nindex file even if it is only stat-dirty.  So unless the two \"cp\"\ncommands in reset_preimage() for a given file happen to have the same\ntime stamp, there will be a spurious\n\n\terror: sub/dir/file: does not match index\n\nRefresh the index to eliminate this timing dependency.  Noticed by\nrunning the test with --valgrind (which slows things down a lot).\n\nReported-by: Thomas Rast <trast@student.ethz.ch>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\ndiff --git a/t/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh\nindex 57cae50..a52d94a 100755\n--- a/t/t4111-apply-subdir.sh\n+++ b/t/t4111-apply-subdir.sh\n@@ -36,7 +36,8 @@ test_expect_success 'setup: subdir' '\n \t\tcp \"$2\" file &&\n \t\tcp \"$2\" sub/dir/file &&\n \t\tcp \"$2\" sub/dir/b/file &&\n-\t\tcp \"$2\" objects/file\n+\t\tcp \"$2\" objects/file &&\n+\t\ttest_might_fail git update-index --refresh -q\n \t}\n '\n \n-- \n"},{"id":"146793","messageId":"201007302039.05491.trast@student.ethz.ch","threadId":"24582","inReplyTo":"20100730183122.GA7578@dert.cs.uchicago.edu","subject":"Re: t4111 fails under valgrind","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-07-30T18:39:05Z","receivedAt":"2010-07-30T18:39:05Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Jonathan Nieder wrote:\n> Thanks for reporting.  Does this patch work for you?\n[...]\n> -\t\tcp \"$2\" objects/file\n> +\t\tcp \"$2\" objects/file &&\n> +\t\ttest_might_fail git update-index --refresh -q\n\nYes, that solves it.  Thanks!\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"147103","messageId":"201008041206.11367.trast@student.ethz.ch","threadId":"24582","inReplyTo":"20100730183122.GA7578@dert.cs.uchicago.edu","subject":"Re: t4111 fails under valgrind","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2010-08-04T10:06:11Z","receivedAt":"2010-08-04T10:06:11Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Jonathan Nieder wrote:\n> -- 8< --\n> Subject: t4111 (apply): refresh index before applying patches to it\n> \n> \"git apply\", like most plumbing, does not automatically refresh the\n> index file even if it is only stat-dirty.  So unless the two \"cp\"\n> commands in reset_preimage() for a given file happen to have the same\n> time stamp, there will be a spurious\n> \n> \terror: sub/dir/file: does not match index\n> \n> Refresh the index to eliminate this timing dependency.  Noticed by\n> running the test with --valgrind (which slows things down a lot).\n> \n> Reported-by: Thomas Rast <trast@student.ethz.ch>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> diff --git a/t/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh\n> index 57cae50..a52d94a 100755\n> --- a/t/t4111-apply-subdir.sh\n> +++ b/t/t4111-apply-subdir.sh\n> @@ -36,7 +36,8 @@ test_expect_success 'setup: subdir' '\n>  \t\tcp \"$2\" file &&\n>  \t\tcp \"$2\" sub/dir/file &&\n>  \t\tcp \"$2\" sub/dir/b/file &&\n> -\t\tcp \"$2\" objects/file\n> +\t\tcp \"$2\" objects/file &&\n> +\t\ttest_might_fail git update-index --refresh -q\n>  \t}\n>  '\n\nJunio, can you pick this up?  t4111 consistently fails for me without\nit.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}