-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
really fix netcat race #5803
really fix netcat race #5803
Conversation
test/sharness/t0235-cli-request.sh
Outdated
rm -f nc_out nc_in && mkfifo nc_in nc_out | ||
# 1. Abuse cat to buffer output. | ||
# 2. Put cat in a subshell so we capture the PID of nc. | ||
nc -k -l 5005 < nc_in > >(cat > nc_out) & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sholudn't this be:
nc -k -l 5005 < nc_in > >(cat > nc_out) & | |
nc -k -l 5005 < <(cat nc_in) > nc_out & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I needed to buffer output because netcat wasn't (or something like that...). Really, I'm not sure what was happening. I just know that everything locked up without this.
756d124
to
c97b811
Compare
This was still buggy because netcat wasn't flushing output and I couldn't find a way to convince netcat to do so (even with stdbuf, reading line by line, etc.). This test now:
(I really hate buffering) |
d39d20b
to
0ed21dd
Compare
Ok, I think I finally got it. We need to make sure to read the complete request before sending a complete response. |
0ed21dd
to
dac93dd
Compare
We hit this once every few Jenkins runs. This: 1. Ensures netcat has started before we try to use it. 2. Waits for it to actually write the request before trying to read it. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
dac93dd
to
c0f979d
Compare
@magik6k this is ready for a final review. I think I finally fixed it... (a quick "let me just fixed this" turned into "let's learn all about fifos, glib buffering, bash + file descriptors, ..."). |
(actually, this is a test fix so I'm just going to merge it to unblock #5801). |
We hit this once every few Jenkins runs. This:
License: MIT