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 #3982, missing output which lacks newlines #8671

Merged
merged 2 commits into from
Jan 3, 2022

Conversation

joeduffy
Copy link
Member

If the last line printed to stdout or stderr was missing a
terminating newline, it would go entirely missing (in all languages).
The reason for this is a bug in the engine's handling of plugin
outputs: Go's Reader.ReadString('\n') returns a string containing what
was read and/or an error; if the string terminated in a '\n', the
error is nil, and the entire line is returned; if the stream ends,
however, a non-nil error is returned and what was read is returned,
even though it wasn't terminated in a newline. The fix is simple:
instead of ignoring that text, we use it, and then exit the read-loop.

Also added some test cases since this is subtle and easy to regress.

@joeduffy joeduffy force-pushed the joeduffy/fix_3982_missing_output branch from 0ed5dcc to 27a1cfc Compare December 31, 2021 16:59
Copy link
Member

@lukehoban lukehoban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Note that this fixes #3982 (not #3892).

If the last line printed to stdout or stderr was missing a
terminating newline, it would go entirely missing (in all languages).
The reason for this is a bug in the engine's handling of plugin
outputs: Go's Reader.ReadString('\n') returns a string containing what
was read and/or an error; if the string terminated in a '\n', the
error is nil, and the entire line is returned; if the stream ends,
however, a non-nil error is returned *and* what was read is returned,
even though it wasn't terminated in a newline. The fix is simple:
instead of ignoring that text, we use it, and *then* exit the read-loop.

Also added some test cases since this is subtle and easy to regress.
@joeduffy joeduffy force-pushed the joeduffy/fix_3982_missing_output branch from 27a1cfc to b46fd45 Compare December 31, 2021 17:21
@joeduffy joeduffy changed the title Fix #3892, missing output which lacks newlines Fix #3982, missing output which lacks newlines Dec 31, 2021
@codecov
Copy link

codecov bot commented Dec 31, 2021

Codecov Report

Merging #8671 (1b4245e) into master (6723272) will decrease coverage by 0.28%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8671      +/-   ##
==========================================
- Coverage   58.95%   58.66%   -0.29%     
==========================================
  Files         634      555      -79     
  Lines       97338    93968    -3370     
  Branches     1382     1382              
==========================================
- Hits        57381    55127    -2254     
+ Misses      36708    35590    -1118     
- Partials     3249     3251       +2     
Impacted Files Coverage Δ
sdk/go/common/resource/plugin/plugin.go 67.87% <75.00%> (+1.20%) ⬆️
...dk/go/common/resource/plugin/langruntime_plugin.go 67.29% <0.00%> (-1.89%) ⬇️
sdk/nodejs/automation/localWorkspace.ts 74.03% <0.00%> (-0.39%) ⬇️
sdk/dotnet/Pulumi/Resources/Resource.cs
sdk/dotnet/Pulumi/Testing/TestOptions.cs
sdk/dotnet/Pulumi/Resources/DependencyResource.cs
sdk/dotnet/Pulumi/Deployment/Deployment.cs
sdk/dotnet/Pulumi/Resources/CustomTimeouts.cs
sdk/dotnet/Pulumi/Testing/IMocks.cs
sdk/dotnet/Pulumi/Core/Alias.cs
... and 76 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6723272...1b4245e. Read the comment docs.

@joeduffy
Copy link
Member Author

Hmm, @lukehoban, the codecov report diffs don't make sense to me. Do they to you? The lines it says I am removing seem entirely unrelated to these changes 🤔 https://app.codecov.io/gh/pulumi/pulumi/compare/8671/changes

@lukehoban
Copy link
Member

Hmm, @lukehoban, the codecov report diffs don't make sense to me. Do they to you?

No - they don't make sense to me either - none of the results from PRs the last month have been "correct" - we need to take deeper look at this. I think this is in part due to the issue I opened in #8629, but it also seems that there are just deeper holes in the coverage reporting, which I've amended onto that issue. For now, unfortunately, we largely have to just ignore this reporting.

@joeduffy joeduffy force-pushed the joeduffy/fix_3982_missing_output branch from 5bafcd8 to 1b4245e Compare December 31, 2021 19:35
@joeduffy joeduffy merged commit 61f27fb into master Jan 3, 2022
@pulumi-bot pulumi-bot deleted the joeduffy/fix_3982_missing_output branch January 3, 2022 22:39
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

2 participants