From: Johannes Sixt <hidden> Date: 2016-06-15 22:56:27
From: Johannes Sixt <redacted>
Two tests use GIT_TRACE=3 to dump debugging information of git. On
Windows, however, bash is unable to set up file descriptor 3 correctly
for its child process, so that git reports "Bad file descriptor" on
every trace attempt. The 'git clone' test succeeds nevertheless because
an empty trace file remains, and there is only a check for the
absence of a particular line. But the 'git fetch' process ultimately
hangs (the dynamics that lead to this surprising result have not been
investigated).
Since we do not otherwise use stderr in the test cases, divert the
trace dump to stderr.
Signed-off-by: Johannes Sixt <redacted>
---
This fixes a regression introduced in
t/t5700-clone-reference.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -55,7 +55,7 @@ cd "$base_dir" rm-f"$U.D" test_expect_success'cloning with reference (no -l -s)'\-'GIT_TRACE_PACKET=3 git clone --reference B "file://$(pwd)/A" D 3>"$U.D"'+'GIT_TRACE_PACKET=2 git clone --reference B "file://$(pwd)/A" D 2>"$U.D"' test_expect_success'fetched no objects'\'! grep " want" "$U.D"'
From: Jeff King <hidden> Date: 2016-06-15 22:56:27
On Wed, Mar 20, 2013 at 09:24:44AM +0100, Johannes Sixt wrote:
From: Johannes Sixt <redacted>
Two tests use GIT_TRACE=3 to dump debugging information of git. On
Windows, however, bash is unable to set up file descriptor 3 correctly
for its child process, so that git reports "Bad file descriptor" on
every trace attempt. The 'git clone' test succeeds nevertheless because
an empty trace file remains, and there is only a check for the
absence of a particular line. But the 'git fetch' process ultimately
hangs (the dynamics that lead to this surprising result have not been
investigated).
Since we do not otherwise use stderr in the test cases, divert the
trace dump to stderr.
I think that is OK, but I'm curious why this is a problem _now_, and not
with the code prior to 97a83fa8. The old GIT_DEBUG_SEND_PACK was also
just calling write() to descriptor 3.
Signed-off-by: Johannes Sixt <redacted>
---
This fixes a regression introduced in
From: Johannes Sixt <hidden> Date: 2016-06-15 22:56:27
Am 3/20/2013 10:33, schrieb Jeff King:
On Wed, Mar 20, 2013 at 09:24:44AM +0100, Johannes Sixt wrote:
quoted
From: Johannes Sixt <redacted>
Two tests use GIT_TRACE=3 to dump debugging information of git. On
Windows, however, bash is unable to set up file descriptor 3 correctly
for its child process, so that git reports "Bad file descriptor" on
every trace attempt. The 'git clone' test succeeds nevertheless because
an empty trace file remains, and there is only a check for the
absence of a particular line. But the 'git fetch' process ultimately
hangs (the dynamics that lead to this surprising result have not been
investigated).
Since we do not otherwise use stderr in the test cases, divert the
trace dump to stderr.
I think that is OK, but I'm curious why this is a problem _now_, and not
with the code prior to 97a83fa8. The old GIT_DEBUG_SEND_PACK was also
just calling write() to descriptor 3.
Before this change, both affected commands completed and the trace file
was empty. Notice that in both test cases we only check for the absence of
certain lines, which is naturally true for an empty file, so that the
tests pass.
With the updated code, 'git fetch' hung, which is how I noticed the
problem. As I said, I didn't investigate where and why this happens.
quoted
This fixes a regression introduced in
...in 97a83fa8, I assume.
Yes, correct. (Sorry, I got distracted while I looked up the commit.)
-- Hannes
From: Jeff King <hidden> Date: 2016-06-15 22:56:27
On Wed, Mar 20, 2013 at 12:30:47PM +0100, Johannes Sixt wrote:
quoted
I think that is OK, but I'm curious why this is a problem _now_, and not
with the code prior to 97a83fa8. The old GIT_DEBUG_SEND_PACK was also
just calling write() to descriptor 3.
Before this change, both affected commands completed and the trace file
was empty. Notice that in both test cases we only check for the absence of
certain lines, which is naturally true for an empty file, so that the
tests pass.
Hmm. The code in t5503 is similar, but before my patch used to actually
use "test -s" to make sure that some trace output was written. Did it
fail before 97a83fa8 (and does it pass now)?
We should probably be adjusting t5503, too. And possibly adding back in
the "test -s" checks (which I removed as redundant, but I guess the
double-checking might have caught a platform error in this case).
Also, though I think your use of stderr is probably OK, might it be a
little more robust against future output changes to use:
GIT_TRACE_PACKET=$PWD/$U.D git clone ...
to write directly to the file. The original GIT_DEBUG_SEND_PACK did not
support such niceties, but GIT_TRACE gives them to us for free.
With the updated code, 'git fetch' hung, which is how I noticed the
problem. As I said, I didn't investigate where and why this happens.
Thinking on it more, almost certainly what is happening is that fd 3 is
being used for the actual protocol, and we are jamming random bytes over
it. Since we have changed the bytes, the code is reacting in a different
way (but the actual reaction doesn't matter; we should stop the cause,
not worry about the symptom).
-Peff
From: Jeff King <hidden> Date: 2016-06-15 22:56:27
On Wed, Mar 20, 2013 at 01:06:07PM -0400, Jeff King wrote:
On Wed, Mar 20, 2013 at 12:30:47PM +0100, Johannes Sixt wrote:
quoted
quoted
I think that is OK, but I'm curious why this is a problem _now_, and not
with the code prior to 97a83fa8. The old GIT_DEBUG_SEND_PACK was also
just calling write() to descriptor 3.
Before this change, both affected commands completed and the trace file
was empty. Notice that in both test cases we only check for the absence of
certain lines, which is naturally true for an empty file, so that the
tests pass.
Hmm. The code in t5503 is similar, but before my patch used to actually
use "test -s" to make sure that some trace output was written. Did it
fail before 97a83fa8 (and does it pass now)?
Ah, I see. It did fail, and it was marked with NOT_MINGW. I think we can
fix that now. Patch coming in a moment.
-Peff
From: Jeff King <hidden> Date: 2016-06-15 22:56:27
Some test scripts use the GIT_TRACE mechanism to dump
debugging information to descriptor 3 (and point it to a
file using the shell). On Windows, however, bash is unable
to set up descriptor 3. We do not write our trace to the
file, and worse, we may interfere with other operations
happening on descriptor 3, causing tests to fail or other
even behave inconsistently.
Prior to commit 97a83fa (upload-pack: remove packet debugging
harness), these tests used GIT_DEBUG_SEND_PACK, which only
supported output to a descriptor. The tests in t5503 were
always broken on Windows, and were marked to be skipped via
the NOT_MINGW prerequisite. In t5700, the tests used to pass
prior to 97a83fa, but only because they were not careful
enough; because we only grepped the trace file, an empty
file looked successful to us. But post-97a83fa, the writing
to descriptor 3 causes "git fetch" to hang (presumably
because we are throwing random bytes into the middle of the
protocol).
Now that we are using the GIT_TRACE mechanism, we can
improve both scripts by asking git to write directly to a
file rather than a descriptor. That fixes the hang in t5700,
and should allow t5503 to successfully run on Windows.
In both cases we now also use "test -s" to double-check that
our trace file actually contains output, which should reduce
the possibility of an erroneously passing test.
Signed-off-by: Jeff King <redacted>
---
On top of jk/pkt-line-cleanup.
This works for me on Linux, but I do not have a mingw system to test
t5503 on. If my reasoning is right, it should, but one never knows. :)
Johannes, can you report whether it fixes the problem?
t/t5503-tagfollow.sh | 38 ++++++++++++++++++--------------------
t/t5700-clone-reference.sh | 14 +++++++++-----
2 files changed, 27 insertions(+), 25 deletions(-)
@@ -4,10 +4,6 @@ test_description='test automatic tag following' ../test-lib.sh-if!test_have_prereqNOT_MINGW;then-say"GIT_TRACE_PACKET not supported - skipping tests"-fi-# End state of the repository:## T - tag1 S - tag2
@@ -39,33 +35,35 @@ test_expect_success NOT_MINGW 'fetch A (new commit : 1 connection)' ''U=UPLOAD_LOG+UPATH="$(pwd)/$U"-test_expect_successNOT_MINGW'setup expect''+test_expect_success'setup expect'' cat-<<EOF>expect want$A EOF' get_needs(){+test-s"$1"&&perl-alne'nextunless$F[1]eq"upload-pack<";lastif$F[2]eq"0000";print$F[2]," ",$F[3];-'"$@"+'"$1"}-test_expect_successNOT_MINGW'fetch A (new commit : 1 connection)''+test_expect_success'fetch A (new commit : 1 connection)''rm-f$U&&(cdcloned&&-GIT_TRACE_PACKET=3gitfetch3>../$U&&+GIT_TRACE_PACKET=$UPATHgitfetch&&test$A=$(gitrev-parse--verifyorigin/master))&&get_needs$U>actual&&test_cmpexpectactual'-test_expect_successNOT_MINGW"create tag T on A, create C on branch cat"'+test_expect_success"create tag T on A, create C on branch cat"'gittag-a-mtag1tag1$A&&T=$(gitrev-parse--verifytag1)&&
@@ -77,18 +75,18 @@ test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 1 connection)' 'gitcheckoutmaster'-test_expect_successNOT_MINGW'setup expect''+test_expect_success'setup expect'' cat-<<EOF>expect want$C want$T EOF'-test_expect_successNOT_MINGW'fetch C, T (new branch, tag : 1 connection)''+test_expect_success'fetch C, T (new branch, tag : 1 connection)''rm-f$U&&(cdcloned&&-GIT_TRACE_PACKET=3gitfetch3>../$U&&+GIT_TRACE_PACKET=$UPATHgitfetch&&test$C=$(gitrev-parse--verifyorigin/cat)&&test$T=$(gitrev-parse--verifytag1)&&test$A=$(gitrev-parse--verifytag1^0)
@@ -97,7 +95,7 @@ test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 1 connection)' 'test_cmpexpectactual'-test_expect_successNOT_MINGW"create commits O, B, tag S on B"'+test_expect_success"create commits O, B, tag S on B"'test_tick&&echoO>file&&gitaddfile&&
@@ -113,18 +111,18 @@ test_expect_success NOT_MINGW 'fetch B, S (commit and tag : 1 connection)' 'S=$(gitrev-parse--verifytag2)'-test_expect_successNOT_MINGW'setup expect''+test_expect_success'setup expect'' cat-<<EOF>expect want$B want$S EOF'-test_expect_successNOT_MINGW'fetch B, S (commit and tag : 1 connection)''+test_expect_success'fetch B, S (commit and tag : 1 connection)''rm-f$U&&(cdcloned&&-GIT_TRACE_PACKET=3gitfetch3>../$U&&+GIT_TRACE_PACKET=$UPATHgitfetch&&test$B=$(gitrev-parse--verifyorigin/master)&&test$B=$(gitrev-parse--verifytag2^0)&&test$S=$(gitrev-parse--verifytag2)
@@ -54,11 +54,14 @@ test_expect_success 'cloning with reference (no -l -s)' \ rm-f"$U.D"-test_expect_success'cloning with reference (no -l -s)'\-'GIT_TRACE_PACKET=3 git clone --reference B "file://$(pwd)/A" D 3>"$U.D"'+test_expect_success'cloning with reference (no -l -s)''+GIT_TRACE_PACKET=$U.Dgitclone--referenceB"file://$(pwd)/A"D+'-test_expect_success'fetched no objects'\-'! grep " want" "$U.D"'+test_expect_success'fetched no objects''+test-s"$U.D"&&+!grep" want""$U.D"+'cd"$base_dir"
From: Eric Sunshine <hidden> Date: 2016-06-15 22:56:28
On Wed, Mar 20, 2013 at 1:43 PM, Jeff King [off-list ref] wrote:
Some test scripts use the GIT_TRACE mechanism to dump
debugging information to descriptor 3 (and point it to a
file using the shell). On Windows, however, bash is unable
to set up descriptor 3. We do not write our trace to the
file, and worse, we may interfere with other operations
happening on descriptor 3, causing tests to fail or other
even behave inconsistently.
From: Jeff King <hidden> Date: 2016-06-15 22:56:28
On Wed, Mar 20, 2013 at 04:29:40PM -0400, Eric Sunshine wrote:
On Wed, Mar 20, 2013 at 1:43 PM, Jeff King [off-list ref] wrote:
quoted
Some test scripts use the GIT_TRACE mechanism to dump
debugging information to descriptor 3 (and point it to a
file using the shell). On Windows, however, bash is unable
to set up descriptor 3. We do not write our trace to the
file, and worse, we may interfere with other operations
happening on descriptor 3, causing tests to fail or other
even behave inconsistently.
s/other even/even/
Urgh, I should probably add another proofreading pass to my commit
messages. Thanks.
-Peff
From: Johannes Sixt <hidden> Date: 2016-06-15 22:56:28
Am 3/20/2013 18:43, schrieb Jeff King:
Now that we are using the GIT_TRACE mechanism, we can
improve both scripts by asking git to write directly to a
file rather than a descriptor. That fixes the hang in t5700,
and should allow t5503 to successfully run on Windows.
Well spotted, and, right, both tests pass with this patch.
Tested-by: Johannes Sixt <redacted>
Thanks,
-- Hannes