{"thread":{"id":"44265","subject":"git 2.10.1 test regression in t3700-add.sh","startedAt":"2016-10-10T00:33:58Z","lastAt":"2016-10-12T06:00:53Z","messageCount":9,"participants":["Jeremy Huddleston Sequoia","Junio C Hamano","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"303689","messageId":"A433322C-2B75-4B4B-A8CC-BAC3179EE7A7@freedesktop.org","threadId":"44265","inReplyTo":null,"subject":"git 2.10.1 test regression in t3700-add.sh","fromName":"Jeremy Huddleston Sequoia","fromEmail":"jeremyhu@freedesktop.org","sentAt":"2016-10-10T00:15:24Z","receivedAt":"2016-10-10T00:33:58Z","isPatch":false,"sender":{"key":"jeremyhu@freedesktop.org","avatar":"https://gravatar.com/avatar/46ea598c50b78a027ee7fb567238ed6f8229d3d220a0d9aa6f82909fa2eb62ad?d=mp&s=160"},"body":"Hi Thomas,\n\nI wanted to let you know that this patch of yours, which landed in git 2.10.1, introduced some test failures, seen on macOS.\n\nLet me know if you need any additional information to track these down.\n\nThanks,\nJeremy\n\nnot ok 40 - git add --chmod=[+-]x changes index with already added file\n#\t\n#\t\techo foo >foo3 &&\n#\t\tgit add foo3 &&\n#\t\tgit add --chmod=+x foo3 &&\n#\t\ttest_mode_in_index 100755 foo3 &&\n#\t\techo foo >xfoo3 &&\n#\t\tchmod 755 xfoo3 &&\n#\t\tgit add xfoo3 &&\n#\t\tgit add --chmod=-x xfoo3 &&\n#\t\ttest_mode_in_index 100644 xfoo3\n#\t\n\ncommit 610d55af0f082f6b866dc858e144c03d8ed4424c\nAuthor: Thomas Gummerer <t.gummerer@gmail.com>\nDate:   Wed Sep 14 22:07:47 2016 +0100\n\n    add: modify already added files when --chmod is given\n    \n    When the chmod option was added to git add, it was hooked up to the diff\n    machinery, meaning that it only works when the version in the index\n    differs from the version on disk.\n    \n    As the option was supposed to mirror the chmod option in update-index,\n    which always changes the mode in the index, regardless of the status of\n    the file, make sure the option behaves the same way in git add.\n    \n    Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\n\n"},{"id":"303690","messageId":"98EB348E-221D-488C-A466-1FACB1C768FF@freedesktop.org","threadId":"44265","inReplyTo":"A433322C-2B75-4B4B-A8CC-BAC3179EE7A7@freedesktop.org","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Jeremy Huddleston Sequoia","fromEmail":"jeremyhu@freedesktop.org","sentAt":"2016-10-10T02:51:49Z","receivedAt":"2016-10-10T02:51:56Z","isPatch":false,"sender":{"key":"jeremyhu@freedesktop.org","avatar":"https://gravatar.com/avatar/46ea598c50b78a027ee7fb567238ed6f8229d3d220a0d9aa6f82909fa2eb62ad?d=mp&s=160"},"body":"\n> On Oct 9, 2016, at 17:15, Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> wrote:\n> \n> Hi Thomas,\n> \n> I wanted to let you know that this patch of yours, which landed in git 2.10.1, introduced some test failures, seen on macOS.\n> \n> Let me know if you need any additional information to track these down.\n> \n> Thanks,\n> Jeremy\n> \n> not ok 40 - git add --chmod=[+-]x changes index with already added file\n> #\t\n> #\t\techo foo >foo3 &&\n> #\t\tgit add foo3 &&\n> #\t\tgit add --chmod=+x foo3 &&\n> #\t\ttest_mode_in_index 100755 foo3 &&\n> #\t\techo foo >xfoo3 &&\n> #\t\tchmod 755 xfoo3 &&\n> #\t\tgit add xfoo3 &&\n> #\t\tgit add --chmod=-x xfoo3 &&\n> #\t\ttest_mode_in_index 100644 xfoo3\n> #\t\n> \n> commit 610d55af0f082f6b866dc858e144c03d8ed4424c\n> Author: Thomas Gummerer <t.gummerer@gmail.com>\n> Date:   Wed Sep 14 22:07:47 2016 +0100\n> \n>    add: modify already added files when --chmod is given\n> \n>    When the chmod option was added to git add, it was hooked up to the diff\n>    machinery, meaning that it only works when the version in the index\n>    differs from the version on disk.\n> \n>    As the option was supposed to mirror the chmod option in update-index,\n>    which always changes the mode in the index, regardless of the status of\n>    the file, make sure the option behaves the same way in git add.\n> \n>    Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n>    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n\n\nThis failure looks odd.  I'll dig into it a bit more as it looks like something odd is going on here...\n\nexpecting success: \n\techo foo >foo3 &&\n\tgit add foo3 &&\n\tgit add --chmod=+x foo3 &&\n\ttest_mode_in_index 100755 foo3 &&\n\techo foo >xfoo3 &&\n\tchmod 755 xfoo3 &&\n\tgit add xfoo3 &&\n\tgit add --chmod=-x xfoo3 &&\n\ttest_mode_in_index 100644 xfoo3\n\npass\ncannot chmod 'xfoo3'fail\n120000 c5c4ca97a3a080c32920941b665e94a997901491 0\txfoo3\nnot ok 40 - git add --chmod=[+-]x changes index with already added file\n#\t\n#\t\techo foo >foo3 &&\n#\t\tgit add foo3 &&\n#\t\tgit add --chmod=+x foo3 &&\n#\t\ttest_mode_in_index 100755 foo3 &&\n#\t\techo foo >xfoo3 &&\n#\t\tchmod 755 xfoo3 &&\n#\t\tgit add xfoo3 &&\n#\t\tgit add --chmod=-x xfoo3 &&\n#\t\ttest_mode_in_index 100644 xfoo3\n#\t\n\n"},{"id":"303694","messageId":"6CA5F44F-38C1-4C15-9B85-FE84FB93E616@freedesktop.org","threadId":"44265","inReplyTo":"98EB348E-221D-488C-A466-1FACB1C768FF@freedesktop.org","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Jeremy Huddleston Sequoia","fromEmail":"jeremyhu@freedesktop.org","sentAt":"2016-10-10T03:22:54Z","receivedAt":"2016-10-10T03:23:11Z","isPatch":false,"sender":{"key":"jeremyhu@freedesktop.org","avatar":"https://gravatar.com/avatar/46ea598c50b78a027ee7fb567238ed6f8229d3d220a0d9aa6f82909fa2eb62ad?d=mp&s=160"},"body":"The issue is that the whitespace before the filename in $(git ls-files -s \"$2\") is a tab, and test_mode_in_index only looks for a space.\n\n><\n\n> On Oct 9, 2016, at 19:51, Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> wrote:\n> \n> \n>> On Oct 9, 2016, at 17:15, Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> wrote:\n>> \n>> Hi Thomas,\n>> \n>> I wanted to let you know that this patch of yours, which landed in git 2.10.1, introduced some test failures, seen on macOS.\n>> \n>> Let me know if you need any additional information to track these down.\n>> \n>> Thanks,\n>> Jeremy\n>> \n>> not ok 40 - git add --chmod=[+-]x changes index with already added file\n>> #\t\n>> #\t\techo foo >foo3 &&\n>> #\t\tgit add foo3 &&\n>> #\t\tgit add --chmod=+x foo3 &&\n>> #\t\ttest_mode_in_index 100755 foo3 &&\n>> #\t\techo foo >xfoo3 &&\n>> #\t\tchmod 755 xfoo3 &&\n>> #\t\tgit add xfoo3 &&\n>> #\t\tgit add --chmod=-x xfoo3 &&\n>> #\t\ttest_mode_in_index 100644 xfoo3\n>> #\t\n>> \n>> commit 610d55af0f082f6b866dc858e144c03d8ed4424c\n>> Author: Thomas Gummerer <t.gummerer@gmail.com>\n>> Date:   Wed Sep 14 22:07:47 2016 +0100\n>> \n>>   add: modify already added files when --chmod is given\n>> \n>>   When the chmod option was added to git add, it was hooked up to the diff\n>>   machinery, meaning that it only works when the version in the index\n>>   differs from the version on disk.\n>> \n>>   As the option was supposed to mirror the chmod option in update-index,\n>>   which always changes the mode in the index, regardless of the status of\n>>   the file, make sure the option behaves the same way in git add.\n>> \n>>   Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n>>   Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> \n> \n> This failure looks odd.  I'll dig into it a bit more as it looks like something odd is going on here...\n> \n> expecting success: \n> \techo foo >foo3 &&\n> \tgit add foo3 &&\n> \tgit add --chmod=+x foo3 &&\n> \ttest_mode_in_index 100755 foo3 &&\n> \techo foo >xfoo3 &&\n> \tchmod 755 xfoo3 &&\n> \tgit add xfoo3 &&\n> \tgit add --chmod=-x xfoo3 &&\n> \ttest_mode_in_index 100644 xfoo3\n> \n> pass\n> cannot chmod 'xfoo3'fail\n> 120000 c5c4ca97a3a080c32920941b665e94a997901491 0\txfoo3\n> not ok 40 - git add --chmod=[+-]x changes index with already added file\n> #\t\n> #\t\techo foo >foo3 &&\n> #\t\tgit add foo3 &&\n> #\t\tgit add --chmod=+x foo3 &&\n> #\t\ttest_mode_in_index 100755 foo3 &&\n> #\t\techo foo >xfoo3 &&\n> #\t\tchmod 755 xfoo3 &&\n> #\t\tgit add xfoo3 &&\n> #\t\tgit add --chmod=-x xfoo3 &&\n> #\t\ttest_mode_in_index 100644 xfoo3\n> #\t\n> \n\n"},{"id":"303695","messageId":"49BF26B2-8E6D-40B1-87A2-1FDDF9A76B8E@freedesktop.org","threadId":"44265","inReplyTo":"6CA5F44F-38C1-4C15-9B85-FE84FB93E616@freedesktop.org","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Jeremy Huddleston Sequoia","fromEmail":"jeremyhu@freedesktop.org","sentAt":"2016-10-10T03:46:08Z","receivedAt":"2016-10-10T03:46:16Z","isPatch":false,"sender":{"key":"jeremyhu@freedesktop.org","avatar":"https://gravatar.com/avatar/46ea598c50b78a027ee7fb567238ed6f8229d3d220a0d9aa6f82909fa2eb62ad?d=mp&s=160"},"body":"\n> On Oct 9, 2016, at 20:22, Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> wrote:\n> \n> The issue is that the whitespace before the filename in $(git ls-files -s \"$2\") is a tab, and test_mode_in_index only looks for a space.\n\nActually, looks like that as just a rabbit hole.  The real issue looks to be because an earlier test drops down xfoo3 as a symlink, which causes this test to fail due to the collision.  I'll get out a patch in a bit.\n\n> \n>> <\n> \n>> On Oct 9, 2016, at 19:51, Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> wrote:\n>> \n>> \n>>> On Oct 9, 2016, at 17:15, Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> wrote:\n>>> \n>>> Hi Thomas,\n>>> \n>>> I wanted to let you know that this patch of yours, which landed in git 2.10.1, introduced some test failures, seen on macOS.\n>>> \n>>> Let me know if you need any additional information to track these down.\n>>> \n>>> Thanks,\n>>> Jeremy\n>>> \n>>> not ok 40 - git add --chmod=[+-]x changes index with already added file\n>>> #\t\n>>> #\t\techo foo >foo3 &&\n>>> #\t\tgit add foo3 &&\n>>> #\t\tgit add --chmod=+x foo3 &&\n>>> #\t\ttest_mode_in_index 100755 foo3 &&\n>>> #\t\techo foo >xfoo3 &&\n>>> #\t\tchmod 755 xfoo3 &&\n>>> #\t\tgit add xfoo3 &&\n>>> #\t\tgit add --chmod=-x xfoo3 &&\n>>> #\t\ttest_mode_in_index 100644 xfoo3\n>>> #\t\n>>> \n>>> commit 610d55af0f082f6b866dc858e144c03d8ed4424c\n>>> Author: Thomas Gummerer <t.gummerer@gmail.com>\n>>> Date:   Wed Sep 14 22:07:47 2016 +0100\n>>> \n>>>  add: modify already added files when --chmod is given\n>>> \n>>>  When the chmod option was added to git add, it was hooked up to the diff\n>>>  machinery, meaning that it only works when the version in the index\n>>>  differs from the version on disk.\n>>> \n>>>  As the option was supposed to mirror the chmod option in update-index,\n>>>  which always changes the mode in the index, regardless of the status of\n>>>  the file, make sure the option behaves the same way in git add.\n>>> \n>>>  Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>\n>>>  Signed-off-by: Junio C Hamano <gitster@pobox.com>\n>> \n>> \n>> This failure looks odd.  I'll dig into it a bit more as it looks like something odd is going on here...\n>> \n>> expecting success: \n>> \techo foo >foo3 &&\n>> \tgit add foo3 &&\n>> \tgit add --chmod=+x foo3 &&\n>> \ttest_mode_in_index 100755 foo3 &&\n>> \techo foo >xfoo3 &&\n>> \tchmod 755 xfoo3 &&\n>> \tgit add xfoo3 &&\n>> \tgit add --chmod=-x xfoo3 &&\n>> \ttest_mode_in_index 100644 xfoo3\n>> \n>> pass\n>> cannot chmod 'xfoo3'fail\n>> 120000 c5c4ca97a3a080c32920941b665e94a997901491 0\txfoo3\n>> not ok 40 - git add --chmod=[+-]x changes index with already added file\n>> #\t\n>> #\t\techo foo >foo3 &&\n>> #\t\tgit add foo3 &&\n>> #\t\tgit add --chmod=+x foo3 &&\n>> #\t\ttest_mode_in_index 100755 foo3 &&\n>> #\t\techo foo >xfoo3 &&\n>> #\t\tchmod 755 xfoo3 &&\n>> #\t\tgit add xfoo3 &&\n>> #\t\tgit add --chmod=-x xfoo3 &&\n>> #\t\ttest_mode_in_index 100644 xfoo3\n>> #\t\n>> \n> \n\n"},{"id":"303764","messageId":"xmqq8ttwgkyo.fsf@gitster.mtv.corp.google.com","threadId":"44265","inReplyTo":"49BF26B2-8E6D-40B1-87A2-1FDDF9A76B8E@freedesktop.org","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-10-10T17:41:51Z","receivedAt":"2016-10-10T17:41:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> writes:\n\n> Actually, looks like that as just a rabbit hole.  The real issue\n> looks to be because an earlier test drops down xfoo3 as a symlink,\n> which causes this test to fail due to the collision.  I'll get out\n> a patch in a bit.\n\n[administrivia: please don't top-post, it is extremely hard to\nfollow what is going on]\n\nThere indeed is a test that creates xfoo3 as a symbolic link and\nleaves it in the filesystem pointing at xfoo2 much earlier in the\nsequence.  It seems that later one of the \"add ignore-errors\" tests\n(there are two back-to-back) runs \"git reset --hard\" to make it (and\nother symbolic links that are similarly named) go away, namely this\npart of the code:\n\n    test_expect_success POSIXPERM,SANITY 'git add --ignore-errors' '\n            git reset --hard &&\n            date >foo1 &&\n            date >foo2 &&\n            chmod 0 foo2 &&\n            test_must_fail git add --verbose --ignore-errors . &&\n            git ls-files foo1 | grep foo1\n    '\n\n    rm -f foo2\n\n    test_expect_success POSIXPERM,SANITY 'git add (add.ignore-errors)' '\n            git config add.ignore-errors 1 &&\n            git reset --hard &&\n            date >foo1 &&\n            date >foo2 &&\n            chmod 0 foo2 &&\n            test_must_fail git add --verbose . &&\n            git ls-files foo1 | grep foo1\n    '\n    rm -f foo2\n\n\"git reset --hard\" in the first one, because these symbolic links\nare not in the index at that point in the sequence, would leave them\nuntracked and in the working tree.  Then \"add\" is told to be\nnon-atomic with \"--ignore-errors\", adding them to the index while\nreporting a failure.  When the test after that runs \"git reset --hard\"\nagain, because these symlinks are in the index (and not in HEAD),\nthey are removed from the working tree.\n\nAnd that is why normal people won't see xfoo3 in later tests, like\nthe one you had trouble with.\n\nAre you running without SANITY by any chance (I am not saying that\nyou are doing a wrong thing--just trying to make sure I am guessing\nalong the correct route)?\n\nIf that is the issue, then I think the right correction would be to\nmake sure that the files that an individual test expects to be\nmissing from the file system is indeed missing by explicitly\nremoving it, perhaps like this.\n\nI also notice that the problematic test uses \"chmod 755\"; don't we\nneed POSIXPERM prerequisite on this test, too, I wonder?\n\nThanks.\n\n-- >8 --\nt3700: fix broken test under !SANITY\n\nAn \"add --chmod=+x\" test recently added by 610d55af0f (\"add: modify\nalready added files when --chmod is given\", 2016-09-14) used \"xfoo3\"\nas a test file.  The paths xfoo[1-3] were used by earlier tests for\nsymbolic links but they were expected to have been removed by the\ntest script reached this new test.\n\nThe removal with \"git reset --hard\" however happened in tests that\nare protected by POSIXPERM,SANITY prerequisites.  Platforms and test\nenvironments that lacked these would have seen xfoo3 as a leftover\nsymbolic link, pointing somewhere else, and chmod test would have\ngiven a wrong result.\n\n\n\n t/t3700-add.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 924a266126..53c0cb6dea 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -350,6 +350,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '\n '\n \n test_expect_success 'git add --chmod=[+-]x changes index with already added file' '\n+\trm -f foo3 xfoo3 &&\n \techo foo >foo3 &&\n \tgit add foo3 &&\n \tgit add --chmod=+x foo3 &&\n\n"},{"id":"303766","messageId":"xmqq4m4kgkrd.fsf@gitster.mtv.corp.google.com","threadId":"44265","inReplyTo":"xmqq8ttwgkyo.fsf@gitster.mtv.corp.google.com","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-10-10T17:46:14Z","receivedAt":"2016-10-10T17:46:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> ...\n> I also notice that the problematic test uses \"chmod 755\"; don't we\n> need POSIXPERM prerequisite on this test, too, I wonder?\n>\n> Thanks.\n>\n> -- >8 --\n> t3700: fix broken test under !SANITY\n>\n> An \"add --chmod=+x\" test recently added by 610d55af0f (\"add: modify\n> already added files when --chmod is given\", 2016-09-14) used \"xfoo3\"\n> as a test file.  The paths xfoo[1-3] were used by earlier tests for\n> symbolic links but they were expected to have been removed by the\n> test script reached this new test.\n\nEh, \"removed by the time test script reached...\"\n"},{"id":"303791","messageId":"dddae1eb-347c-a285-0699-31f30eb924d8@kdbg.org","threadId":"44265","inReplyTo":"xmqq8ttwgkyo.fsf@gitster.mtv.corp.google.com","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-10-10T19:14:10Z","receivedAt":"2016-10-10T19:23:18Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 10.10.2016 um 19:41 schrieb Junio C Hamano:\n> I also notice that the problematic test uses \"chmod 755\"; don't we\n> need POSIXPERM prerequisite on this test, too, I wonder?\n\nGood point. Without POSIXPERM the test demonstrate that, since chmod 755 \nis basically a noop, the following add --chmod=-x does not leave an x \nbit in the index when there was none there in the first place. I think \nit does not hurt to keep the test even though it does not quite test the \nsame thing as on POSIXPERM enabled systems.\n\n-- Hannes\n\n"},{"id":"303949","messageId":"EF7F9B45-867A-433B-9623-EBBF33D34793@freedesktop.org","threadId":"44265","inReplyTo":"xmqq8ttwgkyo.fsf@gitster.mtv.corp.google.com","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Jeremy Huddleston Sequoia","fromEmail":"jeremyhu@freedesktop.org","sentAt":"2016-10-11T23:32:51Z","receivedAt":"2016-10-11T23:33:15Z","isPatch":false,"sender":{"key":"jeremyhu@freedesktop.org","avatar":"https://gravatar.com/avatar/46ea598c50b78a027ee7fb567238ed6f8229d3d220a0d9aa6f82909fa2eb62ad?d=mp&s=160"},"body":"\n> On Oct 10, 2016, at 10:41, Junio C Hamano <gitster@pobox.com> wrote:\n> \n> Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> writes:\n> \n>> Actually, looks like that as just a rabbit hole.  The real issue\n>> looks to be because an earlier test drops down xfoo3 as a symlink,\n>> which causes this test to fail due to the collision.  I'll get out\n>> a patch in a bit.\n> \n> [administrivia: please don't top-post, it is extremely hard to\n> follow what is going on]\n> \n> There indeed is a test that creates xfoo3 as a symbolic link and\n> leaves it in the filesystem pointing at xfoo2 much earlier in the\n> sequence.  It seems that later one of the \"add ignore-errors\" tests\n> (there are two back-to-back) runs \"git reset --hard\" to make it (and\n> other symbolic links that are similarly named) go away, namely this\n> part of the code:\n> \n>    test_expect_success POSIXPERM,SANITY 'git add --ignore-errors' '\n>            git reset --hard &&\n>            date >foo1 &&\n>            date >foo2 &&\n>            chmod 0 foo2 &&\n>            test_must_fail git add --verbose --ignore-errors . &&\n>            git ls-files foo1 | grep foo1\n>    '\n> \n>    rm -f foo2\n> \n>    test_expect_success POSIXPERM,SANITY 'git add (add.ignore-errors)' '\n>            git config add.ignore-errors 1 &&\n>            git reset --hard &&\n>            date >foo1 &&\n>            date >foo2 &&\n>            chmod 0 foo2 &&\n>            test_must_fail git add --verbose . &&\n>            git ls-files foo1 | grep foo1\n>    '\n>    rm -f foo2\n> \n> \"git reset --hard\" in the first one, because these symbolic links\n> are not in the index at that point in the sequence, would leave them\n> untracked and in the working tree.  Then \"add\" is told to be\n> non-atomic with \"--ignore-errors\", adding them to the index while\n> reporting a failure.  When the test after that runs \"git reset --hard\"\n> again, because these symlinks are in the index (and not in HEAD),\n> they are removed from the working tree.\n> \n> And that is why normal people won't see xfoo3 in later tests, like\n> the one you had trouble with.\n> \n> Are you running without SANITY by any chance (I am not saying that\n> you are doing a wrong thing--just trying to make sure I am guessing\n> along the correct route)?\n\nAh, yep.  That's the ticket:\n\nok 23 # skip git add should fail atomically upon an unreadable file (missing SANITY of POSIXPERM,SANITY)\nok 24 # skip git add --ignore-errors (missing SANITY of POSIXPERM,SANITY)\nok 25 # skip git add (add.ignore-errors) (missing SANITY of POSIXPERM,SANITY)\nok 26 # skip git add (add.ignore-errors = false) (missing SANITY of POSIXPERM,SANITY)\nok 27 # skip --no-ignore-errors overrides config (missing SANITY of POSIXPERM,SANITY)\n\nI dug into it a bit, and since I'm running the tests during a staging phase which runs as root, !SANITY gets set.  Should be solvable by essentially breaking test out into post-build instead of pre-install.  Thanks for the pointer there.\n\n\n> If that is the issue, then I think the right correction would be to\n> make sure that the files that an individual test expects to be\n> missing from the file system is indeed missing by explicitly\n> removing it, perhaps like this.\n> \n> I also notice that the problematic test uses \"chmod 755\"; don't we\n> need POSIXPERM prerequisite on this test, too, I wonder?\n> \n> Thanks.\n> \n> -- >8 --\n> t3700: fix broken test under !SANITY\n> \n> An \"add --chmod=+x\" test recently added by 610d55af0f (\"add: modify\n> already added files when --chmod is given\", 2016-09-14) used \"xfoo3\"\n> as a test file.  The paths xfoo[1-3] were used by earlier tests for\n> symbolic links but they were expected to have been removed by the\n> test script reached this new test.\n> \n> The removal with \"git reset --hard\" however happened in tests that\n> are protected by POSIXPERM,SANITY prerequisites.  Platforms and test\n> environments that lacked these would have seen xfoo3 as a leftover\n> symbolic link, pointing somewhere else, and chmod test would have\n> given a wrong result.\n> \n> \n> \n> t/t3700-add.sh | 1 +\n> 1 file changed, 1 insertion(+)\n> \n> diff --git a/t/t3700-add.sh b/t/t3700-add.sh\n> index 924a266126..53c0cb6dea 100755\n> --- a/t/t3700-add.sh\n> +++ b/t/t3700-add.sh\n> @@ -350,6 +350,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '\n> '\n> \n> test_expect_success 'git add --chmod=[+-]x changes index with already added file' '\n> +\trm -f foo3 xfoo3 &&\n> \techo foo >foo3 &&\n> \tgit add foo3 &&\n> \tgit add --chmod=+x foo3 &&\n\n\nI actually tried that, but the problem is that xfoo3 was previously added as a symlink, so test_mode_in_index still reports it as a symlink.\n\nIt's fundamentally a question of who is responsible for cleanup.  Is the individual test responsible for cleaning up after itself (such that later tests can rely on a clean state), or should individual tests assume that the initial state might be undefined and try to cleanup after earlier tests?  I'm in favor of either doing the former or ensuring that tests don't step on each-others toes.\n\n--Jeremy\n\n"},{"id":"303962","messageId":"xmqq1szm6rbg.fsf@gitster.mtv.corp.google.com","threadId":"44265","inReplyTo":"EF7F9B45-867A-433B-9623-EBBF33D34793@freedesktop.org","subject":"Re: git 2.10.1 test regression in t3700-add.sh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-10-12T05:59:15Z","receivedAt":"2016-10-12T06:00:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> writes:\n\n>> diff --git a/t/t3700-add.sh b/t/t3700-add.sh\n>> index 924a266126..53c0cb6dea 100755\n>> --- a/t/t3700-add.sh\n>> +++ b/t/t3700-add.sh\n>> @@ -350,6 +350,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '\n>> '\n>> \n>> test_expect_success 'git add --chmod=[+-]x changes index with already added file' '\n>> +\trm -f foo3 xfoo3 &&\n>> \techo foo >foo3 &&\n>> \tgit add foo3 &&\n>> \tgit add --chmod=+x foo3 &&\n>\n>\n> I actually tried that, but the problem is that xfoo3 was\n> previously added as a symlink, so test_mode_in_index still reports\n> it as a symlink.\n\nAh, of course.  That \"rm -f\" needs to remove from the index and also\nfrom the working tree, so has to be \"git rm -f --ignore-unmatch\" or\nsomething like that.\n\n> It's fundamentally a question of who is responsible for cleanup.\n> Is the individual test responsible for cleaning up after itself\n> (such that later tests can rely on a clean state), or should\n> individual tests assume that the initial state might be undefined\n> and try to cleanup after earlier tests?\n\nIn modern tests, we strive to do the former with liberal use of\ntest_when_finished.  I think the one that creates xfoo[123] and\nleaves them behind for a long time predates the modern practice.\n\nA minimal fix with that approach may look like this:\n\n t/t3700-add.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 924a266126..80c7ee3e3b 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -64,6 +64,7 @@ test_expect_success 'git add: filemode=0 should not get confused by symlink' '\n test_expect_success \\\n \t'git update-index --add: Test that executable bit is not used...' \\\n \t'git config core.filemode 0 &&\n+\t test_when_finished \"git rm -f xfoo3\" &&\n \t test_ln_s_add xfoo2 xfoo3 &&\t# runs git update-index --add\n \t test_mode_in_index 120000 xfoo3'\n \n"}]}