Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix t5516 flakiness in MSVC builds #2373

Merged
merged 1 commit into from Oct 30, 2019

Conversation

dscho
Copy link
Member

@dscho dscho commented Oct 25, 2019

This is based, in part, on gitgitgadget#407, but it avoids the complexity incurred by the desire to allow for unlimited messages.

@dscho
Copy link
Member Author

dscho commented Oct 25, 2019

FYI @SyntevoAlex

@dscho dscho force-pushed the fix-t5516-flakiness branch 2 times, most recently from 455026c to e426627 Compare October 29, 2019 12:38
@dscho
Copy link
Member Author

dscho commented Oct 29, 2019

This is actually a companion PR to gitgitgadget#428 (which probably won't make it into -rc2, hence this PR because I want to get these patches so that I don't have to re-run so many build jobs per day).

@dscho dscho force-pushed the fix-t5516-flakiness branch 3 times, most recently from bd4bc28 to fce0894 Compare October 29, 2019 19:59
The MSVC runtime behavior differs from glibc's with respect to
`fprintf(stderr, ...)` in that the former writes out the message
character by character.

In t5516, this leads to a funny problem where a `git fetch` process as
well as the `git upload-pack` process spawned by it _both_ call `die()`
at the same time. The output can look like this:

	fatal: git uploadfata-lp: raemcokte :error:  upload-pnot our arcef k6: n4ot our ea4cr1e3f 36d45ea94fca1398e86a771eda009872d63adb28598f6a9
	8e86a771eda009872d6ab2886

Let's avoid this predicament altogether by rendering the entire message,
including the prefix and the trailing newline, into the buffer we
already have (and which is still fixed size) and then write it out via
`write_in_full()`.

We still clip the message to at most 4095 characters.

The history of `vreportf()` with regard to this issue includes the
following commits:

d048a96 (2007-11-09) - 'char msg[256]' is introduced to avoid interleaving
389d176 (2009-03-25) - Buffer size increased to 1024 to avoid truncation
625a860 (2009-11-22) - Buffer size increased to 4096 to avoid truncation
f4c3edc (2015-08-11) - Buffer removed to avoid truncation
b5a9e43 (2017-01-11) - Reverts f4c3edc to be able to replace control
                        chars before sending to stderr
9ac13ec (2006-10-11) - Another attempt to solve interleaving.
                        This is seemingly related to d048a96.
137a0d0 (2007-11-19) - Addresses out-of-order for display()
34df8ab (2009-03-10) - Switches xwrite() to fprintf() in recv_sideband()
                        to support UTF-8 emulation
eac14f8 (2012-01-14) - Removes the need for fprintf() for UTF-8 emulation,
                        so it's safe to use xwrite() again
5e5be9e (2016-06-28) - recv_sideband() uses xwrite() again

Note that we print nothing if the `vsnprintf()` call failed to render
the error message; There is little we can do in that case, and it should
not happen anyway.

The process may have written to `stderr` and there may be something left
in the buffer kept in the stdio layer. Call `fflush(stderr)` before
writing the message we prepare in this function.

Helped-by: Jeff King <peff@peff.net>
Helped-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho added this to the Next release milestone Oct 30, 2019
@dscho dscho merged commit e96e0b4 into git-for-windows:master Oct 30, 2019
dscho added a commit to dscho/git that referenced this pull request Oct 30, 2019
git-for-windows-ci pushed a commit that referenced this pull request Oct 30, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Oct 30, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Oct 30, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Oct 30, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 2, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 2, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 2, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit to dscho/git that referenced this pull request Nov 4, 2019
@dscho dscho mentioned this pull request Nov 4, 2019
git-for-windows-ci pushed a commit that referenced this pull request Nov 4, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 4, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 5, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 5, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 6, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 6, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 6, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 11, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 11, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 16, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 16, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 16, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 25, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Nov 25, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Nov 26, 2019
Fix t5516 flakiness in MSVC builds
@dscho dscho deleted the fix-t5516-flakiness branch December 2, 2019 22:56
dscho added a commit that referenced this pull request Dec 7, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Dec 10, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Dec 10, 2019
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Dec 13, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Dec 29, 2019
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Jan 4, 2020
Fix t5516 flakiness in MSVC builds
dscho added a commit that referenced this pull request Jan 13, 2020
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Jan 16, 2020
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Jan 17, 2020
Fix t5516 flakiness in MSVC builds
git-for-windows-ci pushed a commit that referenced this pull request Jan 22, 2020
Fix t5516 flakiness in MSVC builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant