{"thread":{"id":"34594","subject":"[PATCH] git_mkstemps: improve test suite test","startedAt":"2013-08-03T00:27:23Z","lastAt":"2013-08-05T17:32:19Z","messageCount":4,"participants":["Dale R. Worley","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"224479","messageId":"201308030027.r730RNWS022924@freeze.ariadne.com","threadId":"34594","inReplyTo":null,"subject":"[PATCH] git_mkstemps: improve test suite test","fromName":"Dale R. Worley","fromEmail":"worley@alum.mit.edu","sentAt":"2013-08-03T00:27:23Z","receivedAt":"2013-08-03T00:27:23Z","isPatch":true,"sender":{"key":"worley@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/19911107?v=4"},"body":"Commit 52749 fixes a bug regarding testing the return of an open()\ncall for success/failure.  Improve the testsuite test for that fix by\nremoving the helper program 'test-close-fd-0' and replacing it with\nthe shell redirection '<&-'.  (The redirection is Posix, so it should\nbe portable.)\n\nSigned-off-by: Dale Worley <worley@ariadne.com>\n---\n\n> From: Junio C Hamano <gitster@pobox.com>\n> Date: Fri, 19 Jul 2013 07:29:47 -0700\n> \n> The change itself looks good; care to write it up as a proper patch\n> with a proposed log message?\n\nMy apologies for the delay; I've had to do some yak-shaving to learn\nhow to construct patches properly.  (I've written some clarifications\nfor Document/SubmittingPatches, which I will submit separately.)\n\nSomeone has gone ahead and made the code change, so all that remains\nis to update the testsuite test by replacing the helper program\n'test-close-fd-0' with the Posix shell redirection '<&-'.\n\nDale\n\n\n Makefile          |    1 -\n test-close-fd-0.c |   14 --------------\n 2 files changed, 0 insertions(+), 15 deletions(-)\n delete mode 100644 test-close-fd-0.c\n\ndiff --git a/Makefile b/Makefile\nindex 8ad40d4..3588ca1 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -557,7 +557,6 @@ X =\n PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))\n \n TEST_PROGRAMS_NEED_X += test-chmtime\n-TEST_PROGRAMS_NEED_X += test-close-fd-0\n TEST_PROGRAMS_NEED_X += test-ctype\n TEST_PROGRAMS_NEED_X += test-date\n TEST_PROGRAMS_NEED_X += test-delta\ndiff --git a/test-close-fd-0.c b/test-close-fd-0.c\ndeleted file mode 100644\nindex 3745c34..0000000\n--- a/test-close-fd-0.c\n+++ /dev/null\n@@ -1,14 +0,0 @@\n-#include <unistd.h>\n-\n-/* Close file descriptor 0 (which is standard-input), then execute the\n- * remainder of the command line as a command. */\n-\n-int main(int argc, char **argv)\n-{\n-\t/* Close fd 0. */\n-\tclose(0);\n-\t/* Execute the requested command. */\n-\texecvp(argv[1], &argv[1]);\n-\t/* If execve() failed, return an error. */\n-\treturn 1;\n-}\n-- \n1.7.7.6\n"},{"id":"224480","messageId":"20130803003636.GB2945@elie.Belkin","threadId":"34594","inReplyTo":"201308030027.r730RNWS022924@freeze.ariadne.com","subject":"Re: [PATCH] git_mkstemps: improve test suite test","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-03T00:36:36Z","receivedAt":"2013-08-03T00:36:36Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nDale R. Worley wrote:\n\n> Commit 52749 fixes a bug regarding testing the return of an open()\n\n $ git show 52749\n fatal: ambiguous argument '52749': unknown revision or path not in the working tree.\n\nCould you mention its subject line or date so it's easier to find?\n\n> call for success/failure.  Improve the testsuite test for that fix by\n> removing the helper program 'test-close-fd-0' and replacing it with\n> the shell redirection '<&-'.  (The redirection is Posix, so it should\n> be portable.)\n> \n> Signed-off-by: Dale Worley <worley@ariadne.com>\n[...]\n> Someone has gone ahead and made the code change, so all that remains\n> is to update the testsuite test by replacing the helper program\n> 'test-close-fd-0' with the Posix shell redirection '<&-'.\n\nThe above paragraph should be part of the commit message, since\notherwise the patch is hard to understand.\n\nThe patch text looks good.\n\nThanks and hope that helps,\nJonathan\n"},{"id":"224597","messageId":"7vr4e8m7ky.fsf@alter.siamese.dyndns.org","threadId":"34594","inReplyTo":"201308030027.r730RNWS022924@freeze.ariadne.com","subject":"Re: [PATCH] git_mkstemps: improve test suite test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-05T16:21:49Z","receivedAt":"2013-08-05T16:21:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"worley@alum.mit.edu (Dale R. Worley) writes:\n\n> Commit 52749 fixes a bug regarding testing the return of an open()\n> call for success/failure.  Improve the testsuite test for that fix by\n> removing the helper program 'test-close-fd-0' and replacing it with\n> the shell redirection '<&-'.  (The redirection is Posix, so it should\n> be portable.)\n>\n> Signed-off-by: Dale Worley <worley@ariadne.com>\n> ---\n\nSorry, but I have no idea what commit you are talking about, and as\nfar as I can see there is no such file test-close-fd-0.c in my tree.\n\nPuzzled...\n\n>  Makefile          |    1 -\n>  test-close-fd-0.c |   14 --------------\n>  2 files changed, 0 insertions(+), 15 deletions(-)\n>  delete mode 100644 test-close-fd-0.c\n"},{"id":"224606","messageId":"7vfvuokpr0.fsf@alter.siamese.dyndns.org","threadId":"34594","inReplyTo":"7vr4e8m7ky.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git_mkstemps: improve test suite test","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-05T17:32:19Z","receivedAt":"2013-08-05T17:32:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> worley@alum.mit.edu (Dale R. Worley) writes:\n>\n>> Commit 52749 fixes a bug regarding testing the return of an open()\n>> call for success/failure.  Improve the testsuite test for that fix by\n>> removing the helper program 'test-close-fd-0' and replacing it with\n>> the shell redirection '<&-'.  (The redirection is Posix, so it should\n>> be portable.)\n>>\n>> Signed-off-by: Dale Worley <worley@ariadne.com>\n>> ---\n>\n> Sorry, but I have no idea what commit you are talking about, and as\n> far as I can see there is no such file test-close-fd-0.c in my tree.\n>\n> Puzzled...\n\nOK, let's do this on top of a77f106c (run-command: dup_devnull():\nguard against syscalls failing, 2013-07-12) which is at the tip of\ntr/fd-gotcha-fixes that contains the earlier fix.\n\n-- >8 --\nFrom: \"Dale R. Worley\" <worley@alum.mit.edu>\nDate: Fri, 2 Aug 2013 20:27:23 -0400\nSubject: [PATCH] t0070: test that git_mkstemps correctly checks return value of open()\n\nSigned-off-by: Dale R. Worley <worley@alum.mit.edu>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t0070-fundamental.sh | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh\nindex da2c504..ff3776f 100755\n--- a/t/t0070-fundamental.sh\n+++ b/t/t0070-fundamental.sh\n@@ -25,6 +25,10 @@ test_expect_success POSIXPERM 'mktemp to unwritable directory prints filename' '\n \tgrep \"cannotwrite/test\" err\n '\n \n+test_expect_success 'git_mkstemps_mode does not fail if fd 0 is not open' '\n+\tgit commit --allow-empty -m message <&-\n+'\n+\n test_expect_success 'check for a bug in the regex routines' '\n \t# if this test fails, re-build git with NO_REGEX=1\n \ttest-regex\n-- \n1.8.4-rc1-129-g1f3472b\n"}]}