From 41e6b91f01bc9bb7e1679542a8cce9bd4252fd2e Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 27 Mar 2011 12:19:14 -0500 Subject: vcs-svn: add missing cast to printf argument gcc -m32 correctly warns: vcs-svn/fast_export.c: In function 'fast_export_commit': vcs-svn/fast_export.c:54:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'unsigned int' [-Wformat] Fix it. Signed-off-by: Jonathan Nieder diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c index 2e5bb67..99ed70b 100644 --- a/vcs-svn/fast_export.c +++ b/vcs-svn/fast_export.c @@ -51,7 +51,8 @@ void fast_export_commit(uint32_t revision, const char *author, *author ? author : "nobody", *author ? author : "nobody", *uuid ? uuid : "local", timestamp); - printf("data %"PRIuMAX"\n", log->len + strlen(gitsvnline)); + printf("data %"PRIuMAX"\n", + (uintmax_t) (log->len + strlen(gitsvnline))); fwrite(log->buf, log->len, 1, stdout); printf("%s\n", gitsvnline); if (!first_commit_done) { -- cgit v0.10.2-6-g49f6 From 4c502d68666acba7a83379c7abd971aafee91cf8 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 28 Mar 2011 22:08:20 -0500 Subject: tests: make sure input to sed is newline terminated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POSIX only requires sed to work on text files and because it does not end with a newline, this commit's content is not a text file. Add a newline to fix it. Without this change, OS X sed helpfully adds a newline to actual.message, causing t9010.13 to fail. Reported-by: Torsten Bögershausen Tested-by: Brian Gernhardt Signed-off-by: Jonathan Nieder diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh index 478c860..6f6175a 100755 --- a/t/t9010-svn-fe.sh +++ b/t/t9010-svn-fe.sh @@ -407,7 +407,7 @@ test_expect_success 'NUL in log message, file content, and property name' ' OBJID :000000 100644 OBJID OBJID A greeting EOF - printf "\n%s" "something with an ASCII NUL (Q)" >expect.message && + printf "\n%s\n" "something with an ASCII NUL (Q)" >expect.message && printf "%s\n" "helQo" >expect.hello1 && printf "%s\n" "link hello" >expect.hello2 && { @@ -465,7 +465,11 @@ test_expect_success 'NUL in log message, file content, and property name' ' git diff-tree --root --stdin | sed "s/$_x40/OBJID/g" } >actual && - git cat-file commit HEAD | nul_to_q | sed -ne "/^\$/,\$ p" >actual.message && + { + git cat-file commit HEAD | nul_to_q && + echo + } | + sed -ne "/^\$/,\$ p" >actual.message && git cat-file blob HEAD^:greeting | nul_to_q >actual.hello1 && git cat-file blob HEAD:greeting | nul_to_q >actual.hello2 && test_cmp expect actual && -- cgit v0.10.2-6-g49f6 From 9e113988d3d95f1595e2c33f704defeb2cbcc5d6 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Tue, 29 Mar 2011 17:31:30 +0000 Subject: vcs-svn: a void function shouldn't try to return something MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As v1.7.4-rc0~184 (2010-10-04) and C99 §6.8.6.4.1 remind us, standard C does not permit returning an expression of type void, even for a tail call. Noticed with gcc -pedantic: vcs-svn/svndump.c: In function 'handle_node': vcs-svn/svndump.c:213:3: warning: ISO C forbids 'return' with expression, in function returning void [-pedantic] [jn: with simplified log message] Signed-off-by: Michael Witten Signed-off-by: Jonathan Nieder diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c index eef49ca..572a995 100644 --- a/vcs-svn/svndump.c +++ b/vcs-svn/svndump.c @@ -214,7 +214,8 @@ static void handle_node(void) if (have_text || have_props || node_ctx.srcRev) die("invalid dump: deletion node has " "copyfrom info, text, or properties"); - return repo_delete(node_ctx.dst); + repo_delete(node_ctx.dst); + return; } if (node_ctx.action == NODEACT_REPLACE) { repo_delete(node_ctx.dst); -- cgit v0.10.2-6-g49f6 From a892a2ddfefca2e25d595bb685c8853d023fde0a Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 29 Mar 2011 23:30:17 -0400 Subject: tests: kill backgrounded processes more robustly t0081 creates several background processes that write to a fifo and then go to sleep for a while (so the reader of the fifo does not see EOF). Each background process is made in a curly-braced block in the shell, and after we are done reading from the fifo, we use "kill $!" to kill it off. For a simple, single-command process, this works reliably and kills the child sleep process. But for more complex commands like "make_some_output && sleep", the results are less predictable. When executing under bash, we end up with a subshell that gets killed by the $! but leaves the sleep process still alive. This is bad not only for process hygeine (we are leaving random sleep processes to expire after a while), but also interacts badly with the "prove" command. When prove executes a test, it does not realize the test is done when it sees SIGCHLD, but rather waits until the test's stdout pipe is closed. The orphaned sleep process may keep that pipe open via test-lib's file descriptor 5, causing prove to hang for 100 seconds. The solution is to explicitly use a subshell and to exec the final sleep process, so that when we "kill $!" we get the process id of the sleep process. [jn: original patch by Jeff had some additional bits: 1. Wrap the "kill" in a test_when_finished, since we want to clean up the process whether the test succeeds or not. 2. The "kill" is part of our && chain for test success. It probably won't fail, but it can if the process has expired before we manage to kill it. So let's mark it as OK to fail. I'm postponing that for now.] Reported-by: Junio C Hamano Signed-off-by: Jeff King Signed-off-by: Jonathan Nieder diff --git a/t/t0081-line-buffer.sh b/t/t0081-line-buffer.sh index 1dbe1c9..5067d1e 100755 --- a/t/t0081-line-buffer.sh +++ b/t/t0081-line-buffer.sh @@ -47,10 +47,10 @@ long_read_test () { rm -f input && mkfifo input && { - { + ( generate_tens_of_lines $tens_of_lines "$line" && - sleep 100 - } >input & + exec sleep 100 + ) >input & } && test-line-buffer input <<-EOF >output && binary $readsize @@ -109,11 +109,11 @@ test_expect_success PIPE '1-byte read, no input available' ' rm -f input && mkfifo input && { - { + ( printf "%s" a && printf "%s" b && - sleep 100 - } >input & + exec sleep 100 + ) >input & } && test-line-buffer input <<-\EOF >actual && binary 1 -- cgit v0.10.2-6-g49f6