{"thread":{"id":"52964","subject":"RE: [Test] t1901 - sparse checkout file when lock is taken fails (subtest 19)","startedAt":"2020-03-10T14:40:45Z","lastAt":"2020-03-12T15:08:47Z","messageCount":3,"participants":["Randall S. Becker","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"392997","messageId":"011401d5f6e9$de7eea50$9b7cbef0$@nexbridge.com","threadId":"52964","inReplyTo":null,"subject":"RE: [Test] t1901 - sparse checkout file when lock is taken fails (subtest 19)","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2020-03-10T14:40:34Z","receivedAt":"2020-03-10T14:40:45Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"> From: Randall S. Becker <rsbecker@nexbridge.com>\nOn March 5, 2020 10:45 AM, I wrote:\n> This one has me confused. It fails 100% of the time on NonStop. The test\n> looks reasonable, as do the messages. I am not certain that test_i18ngrep\n> works properly - it falls down to the return 1 statement which causes the\ntest\n> to fail. The error message generated is \"File already exists\" not \"File\nexists\"\n> as is required in the test. We should not be testing for specific text\ncontent\n> originating from strerror - I thought we had this decision in a different\n> thread. https://public-inbox.org/git/xmqq36intlpj.fsf@gitster-\n> ct.c.googlers.com/\n> \n> Thoughts?\n> \n> expecting success of 1091.19 'fail when lock is taken':\n>         test_when_finished rm -rf repo/.git/info/sparse-checkout.lock &&\n>         touch repo/.git/info/sparse-checkout.lock &&\n>         test_must_fail git -C repo sparse-checkout set deep 2>err &&\n>         test_i18ngrep \"File exists\" err\n> \n> error: 'grep File exists err' didn't find a match in:\n> fatal: Unable to create '/home/ituglib/randall/git/t/trash\ndirectory.t1091-\n> sparse-checkout-builtin/repo/.git/info/sparse-checkout.lock': File already\n> exists.   <----- this is the test issue\n> \n> Another git process seems to be running in this repository, e.g.\n> an editor opened by 'git commit'. Please make sure all processes are\n> terminated then try again. If it still fails, a git process may have\ncrashed in\n> this repository earlier:\n> remove the file manually to continue.\n> not ok 19 - fail when lock is taken\n> #\n> #               test_when_finished rm -rf\nrepo/.git/info/sparse-checkout.lock &&\n> #               touch repo/.git/info/sparse-checkout.lock &&\n> #               test_must_fail git -C repo sparse-checkout set deep 2>err\n&&\n> #               test_i18ngrep \"File exists\" err\n> #\n\nThis situation still occurs at 2.26.0-rc0. As above, this results from a\ntext compare to a platform-specific message that should not be used. To hack\naround it, a possible fix (which I don't like) could be as follows:\n\nindex b4c9c32a03..d1fd225dad 100755\n--- a/t/t1091-sparse-checkout-builtin.sh\n+++ b/t/t1091-sparse-checkout-builtin.sh\n@@ -305,7 +305,7 @@ test_expect_success 'fail when lock is taken' '\n        test_when_finished rm -rf repo/.git/info/sparse-checkout.lock &&\n        touch repo/.git/info/sparse-checkout.lock &&\n        test_must_fail git -C repo sparse-checkout set deep 2>err &&\n-       test_i18ngrep \"File exists\" err\n+       test_i18ngrep \"File \\(already \\)*exists\" err\n '\n\nThis does not remove the problem of platform error compares, but does allow\nthe test to temporarily pass.\n\nRandall\n\n"},{"id":"393098","messageId":"xmqqwo7qfswu.fsf@gitster.c.googlers.com","threadId":"52964","inReplyTo":"011401d5f6e9$de7eea50$9b7cbef0$@nexbridge.com","subject":"Re: [Test] t1901 - sparse checkout file when lock is taken fails (subtest 19)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-03-11T22:06:25Z","receivedAt":"2020-03-11T22:06:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Randall S. Becker\" <rsbecker@nexbridge.com> writes:\n\n> This situation still occurs at 2.26.0-rc0. As above, this results from a\n> text compare to a platform-specific message that should not be used. To hack\n> around it, a possible fix (which I don't like) could be as follows:\n\nMartin's fix 4605a730 (t1091: don't grep for `strerror()` string,\n2020-03-08) was merged to 'next' on the 9th and then down to\n'master' today, and will be in the final (unless there is some\nissues with it, which I do not think will be the case).\n\nThanks.\n\n-- >8 --\nFrom: Martin Ågren <martin.agren@gmail.com>\nSubject: [PATCH] t1091: don't grep for `strerror()` string\n\nWe grep for \"File exists\" in stderr of the failing `git sparse-checkout`\nto make sure that it failed for the right reason. We expect the string\nto show up there since we call `strerror(errno)` in\n`unable_to_lock_message()` in lockfile.c.\n\nOn the NonStop platform, this fails because the error string is \"File\nalready exists\", which doesn't match our grepping.\n\nSee 9042140097 (\"test-dir-iterator: do not assume errno values\",\n2019-07-30) for a somewhat similar fix. There, we patched a test helper,\nwhich meant we had access to `errno` and could investigate it better in\nthe test helper instead of just outputting the numerical value and\nevaluating it in the test script. The current situation is different,\nsince (short of modifying the lockfile machinery, e.g., to be more\nverbose) we don't have more than the output from `strerror()` available.\n\nExcept we do: We prefix `strerror(errno)` with `_(\"Unable to create\n'%s.lock': \")`. Let's grep for that part instead. It verifies that we\nwere indeed unable to create the lock file. (If that fails for some\nother reason than the file existing, we really really should expect\nother tests to fail as well.)\n\nAn alternative fix would be to loosen the expression a bit and grep for\n\"File.* exists\" instead. There would be no guarantee that some other\nimplementation couldn't come up with another error string, That is, that\ncould be the first move in an endless game of whack-a-mole. Of course,\nit could also take us from \"99\" to \"100\" percent of the platforms and\nwe'd never have this problem again. But since we have another way of\naddressing this, let's not even try the \"loosen it up a bit\" strategy.\n\nReported-by: Randall S. Becker <rsbecker@nexbridge.com>\nSigned-off-by: Martin Ågren <martin.agren@gmail.com>\nAcked-by: Derrick Stolee <dstolee@microsoft.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t1091-sparse-checkout-builtin.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh\nindex b4c9c32a03..44a91205d6 100755\n--- a/t/t1091-sparse-checkout-builtin.sh\n+++ b/t/t1091-sparse-checkout-builtin.sh\n@@ -305,7 +305,7 @@ test_expect_success 'fail when lock is taken' '\n \ttest_when_finished rm -rf repo/.git/info/sparse-checkout.lock &&\n \ttouch repo/.git/info/sparse-checkout.lock &&\n \ttest_must_fail git -C repo sparse-checkout set deep 2>err &&\n-\ttest_i18ngrep \"File exists\" err\n+\ttest_i18ngrep \"Unable to create .*\\.lock\" err\n '\n \n test_expect_success '.gitignore should not warn about cone mode' '\n-- \n2.26.0-rc1-6-ga56d361f66\n\n"},{"id":"393130","messageId":"020c01d5f880$1cf7c580$56e75080$@nexbridge.com","threadId":"52964","inReplyTo":"xmqqwo7qfswu.fsf@gitster.c.googlers.com","subject":"RE: [Test] t1901 - sparse checkout file when lock is taken fails (subtest 19)","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2020-03-12T15:08:34Z","receivedAt":"2020-03-12T15:08:47Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On March 11, 2020 6:06 PM, Junio C Hamano wrote:\n> \"Randall S. Becker\" <rsbecker@nexbridge.com> writes:\n> \n> > This situation still occurs at 2.26.0-rc0. As above, this results from\n> > a text compare to a platform-specific message that should not be used.\n> > To hack around it, a possible fix (which I don't like) could be as follows:\n> \n> Martin's fix 4605a730 (t1091: don't grep for `strerror()` string,\n> 2020-03-08) was merged to 'next' on the 9th and then down to 'master'\n> today, and will be in the final (unless there is some issues with it, which I do\n> not think will be the case).\n> \n> Thanks.\n> \n> -- >8 --\n> From: Martin Ågren <martin.agren@gmail.com>\n> Subject: [PATCH] t1091: don't grep for `strerror()` string\n> \n> We grep for \"File exists\" in stderr of the failing `git sparse-checkout` to make\n> sure that it failed for the right reason. We expect the string to show up there\n> since we call `strerror(errno)` in `unable_to_lock_message()` in lockfile.c.\n> \n> On the NonStop platform, this fails because the error string is \"File already\n> exists\", which doesn't match our grepping.\n> \n> See 9042140097 (\"test-dir-iterator: do not assume errno values\",\n> 2019-07-30) for a somewhat similar fix. There, we patched a test helper,\n> which meant we had access to `errno` and could investigate it better in the\n> test helper instead of just outputting the numerical value and evaluating it in\n> the test script. The current situation is different, since (short of modifying the\n> lockfile machinery, e.g., to be more\n> verbose) we don't have more than the output from `strerror()` available.\n> \n> Except we do: We prefix `strerror(errno)` with `_(\"Unable to create\n> '%s.lock': \")`. Let's grep for that part instead. It verifies that we were indeed\n> unable to create the lock file. (If that fails for some other reason than the file\n> existing, we really really should expect other tests to fail as well.)\n\nI'm hoping that that error message matches. Will test it as soon as it is final is out there.\n\n> An alternative fix would be to loosen the expression a bit and grep for\n> \"File.* exists\" instead. There would be no guarantee that some other\n> implementation couldn't come up with another error string, That is, that\n> could be the first move in an endless game of whack-a-mole. Of course, it\n> could also take us from \"99\" to \"100\" percent of the platforms and we'd\n> never have this problem again. But since we have another way of addressing\n> this, let's not even try the \"loosen it up a bit\" strategy.\n> \n> Reported-by: Randall S. Becker <rsbecker@nexbridge.com>\n> Signed-off-by: Martin Ågren <martin.agren@gmail.com>\n> Acked-by: Derrick Stolee <dstolee@microsoft.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  t/t1091-sparse-checkout-builtin.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-\n> builtin.sh\n> index b4c9c32a03..44a91205d6 100755\n> --- a/t/t1091-sparse-checkout-builtin.sh\n> +++ b/t/t1091-sparse-checkout-builtin.sh\n> @@ -305,7 +305,7 @@ test_expect_success 'fail when lock is taken' '\n>  \ttest_when_finished rm -rf repo/.git/info/sparse-checkout.lock &&\n>  \ttouch repo/.git/info/sparse-checkout.lock &&\n>  \ttest_must_fail git -C repo sparse-checkout set deep 2>err &&\n> -\ttest_i18ngrep \"File exists\" err\n> +\ttest_i18ngrep \"Unable to create .*\\.lock\" err\n>  '\n> \n>  test_expect_success '.gitignore should not warn about cone mode' '\n> --\n> 2.26.0-rc1-6-ga56d361f66\n\nThis still really helps stabilize things for the NonStop platform.\n\nThanks!\nRandall\n\n"}]}