flux-framework / flux-core

core services for the Flux resource management framework
GNU Lesser General Public License v3.0
168 stars 50 forks source link

libsubprocess: ensure bulk-exec output is terminated #6368

Closed garlick closed 1 month ago

garlick commented 1 month ago

Problem: garbage appears in the logs when the bulkexec imp-kill generates output.

Since bulk-exec always uses unbuffered reads for performance, the output buffers returned by flux_subprocess_read() are not guaranteed to be NULL terminated.

Use "%.*s" instead of "%s" in the log format string for:

Fixes #6366

garlick commented 1 month ago

Thanks! I'll set MWP.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.26%. Comparing base (50f8dc2) to head (df77f35). Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/common/libsubprocess/bulk-exec.c 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6368 +/- ## ========================================== - Coverage 83.28% 83.26% -0.03% ========================================== Files 524 524 Lines 86230 86230 ========================================== - Hits 71820 71802 -18 - Misses 14410 14428 +18 ``` | [Files with missing lines](https://app.codecov.io/gh/flux-framework/flux-core/pull/6368?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=flux-framework) | Coverage Δ | | |---|---|---| | [src/common/libsubprocess/bulk-exec.c](https://app.codecov.io/gh/flux-framework/flux-core/pull/6368?src=pr&el=tree&filepath=src%2Fcommon%2Flibsubprocess%2Fbulk-exec.c&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=flux-framework#diff-c3JjL2NvbW1vbi9saWJzdWJwcm9jZXNzL2J1bGstZXhlYy5j) | `81.55% <0.00%> (ø)` | | ... and [11 files with indirect coverage changes](https://app.codecov.io/gh/flux-framework/flux-core/pull/6368/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=flux-framework)