Enhance error diagnostics in bundle extraction when fwrite fails#120677
Closed
Enhance error diagnostics in bundle extraction when fwrite fails#120677
Conversation
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enhance error diagnostics in bundle extraction
Enhance error diagnostics in bundle extraction when fwrite or fclose fails
Oct 13, 2025
agocke
reviewed
Oct 14, 2025
| { | ||
| CompressionNative_InflateEnd(&zStream); | ||
| trace::error(_X("I/O failure when writing decompressed file.")); | ||
| if (ferror(file)) |
Member
There was a problem hiding this comment.
It doesn't look like ferror sets errno. But it looks like fwrite almost always does. Let's just print errno in this case.
Contributor
Author
There was a problem hiding this comment.
Updated to always print errno without checking ferror. Commit: 5b4f0d2
| { | ||
| trace::error(_X("Failure extracting contents of the application bundle. Expected size:%" PRId64 " Actual size:%zu"), size, extracted_size); | ||
| trace::error(_X("I/O failure when writing extracted files.")); | ||
| if (ferror(file)) |
Contributor
Author
There was a problem hiding this comment.
Updated to always print errno without checking ferror. Commit: 5b4f0d2
| } | ||
|
|
||
| fclose(file); | ||
| if (fclose(file) != 0) |
Contributor
Author
There was a problem hiding this comment.
Removed fclose error checking. Commit: 5b4f0d2
Member
|
@copilot please address comments |
Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Copilot
AI
changed the title
Enhance error diagnostics in bundle extraction when fwrite or fclose fails
Enhance error diagnostics in bundle extraction when fwrite fails
Oct 14, 2025
This was referenced Oct 14, 2025
Open
Member
|
Closing as I don't think there's a reliable way to view this error code for all platforms. Can't find a guarantee that errno is set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances error diagnostics in bundle extraction to provide actionable information when I/O failures occur during file extraction. Previously, the code only checked if the extracted size didn't match the expected size and emitted generic error messages. Now, it provides detailed diagnostics to help troubleshoot disk full, quota exceeded, permission denied, or hardware errors.
Changes
Enhanced error handling in
src/native/corehost/bundle/extractor.cpp:Added errno checking: Included
<cerrno>to enable system error code inspectionEnhanced fwrite error handling for both compressed and non-compressed extraction paths:
strerror(errno)when fwrite failsExample Error Messages
Before
After - Disk Full
After - Permission Denied
After - Compressed File Write Failure
Benefits
Testing
./build.sh clr+libs+host -rc release./build.sh host.tests -rc release -testFixes #
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.