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

stdio/file: fix numerous issues in the fread/fwrite functions #376

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ziemleszcz
Copy link
Contributor

@ziemleszcz ziemleszcz commented Aug 21, 2024

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

  • This PR needs additional PRs to work (list the PRs, preferably in merge-order).
  • I will merge this PR by myself when appropriate.

Copy link

github-actions bot commented Aug 21, 2024

Unit Test Results

7 741 tests  +16   7 026 ✅ +16   39m 21s ⏱️ +39s
  461 suites +16     715 💤 ± 0 
    1 files   ± 0       0 ❌ ± 0 

Results for commit 408aeb3. ± Comparison against base commit fc34b6e.

♻️ This comment has been updated with latest results.

@ziemleszcz ziemleszcz changed the title Ziemleszcz/rtos 892 stdio/file: fix numerous issues in the fread/fwrite functions Aug 22, 2024
@ziemleszcz ziemleszcz marked this pull request as ready for review August 22, 2024 11:57
unistd/file.c Show resolved Hide resolved
@ziemleszcz ziemleszcz marked this pull request as draft September 23, 2024 13:55
Also fixed error handling in blocking safe write to return -1 in case of undefined behavior.

JIRA: RTOS-892, RTOS-874
stdio/file.c Outdated Show resolved Hide resolved
stdio/file.c Outdated Show resolved Hide resolved
@ziemleszcz ziemleszcz force-pushed the ziemleszcz/RTOS-892 branch 2 times, most recently from 0f3e3de to 5df66ae Compare October 14, 2024 07:20
@ziemleszcz ziemleszcz marked this pull request as ready for review October 14, 2024 09:09
Fixed the following issues:
 - fclose returned -EINVAL instead of EOF
 - fclose did not return EOF on stream buffer flushing errors
 - removed unnecessary stream buffer flushing in fopen & fdopen
 - freopen did not return NULL on stream buffer flushing errors
 - fseek/fseeko/fsetpos cleared F_EOF flag on error
 - ftell/ftello/fgetpos cleared F_EOF flag
 - ftell/ftello/fgetpos flushed the stream buffer
 - non-blocking fflush was unsupported
 - flushing failed for non-seekable streams (lseek returning ESPIPE)
 - interleaved fread/fwrite failed for non-seekable streams (lseek returning ESPIPE)
 - non-blocking fread was unsupported
 - unbuffered fread did not set F_ERROR flag on read errors
 - unbuffered fread did not set F_EOF flag at end-of-file
 - buffered fread did not set F_ERROR flag on write buffer flushing errors
 - buffered fread did not return 0 on write buffer flushing errors
 - buffered fread did not set F_ERROR flag on buffer refilling errors
 - buffered fread incorrectly set F_EOF flag on EAGAIN errors
 - buffered fread did not always read full blocks from files
 - non-blocking fwrite was unsupported
 - unbuffered fwrite did not set F_ERROR flag on write errors
 - buffered fwrite did not set F_ERROR flag on read buffer flushing errors
 - buffered fwrite did not return 0 on read buffer flushing errors
 - buffered fwrite did not always write full blocks to files

JIRA: RTOS-892
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.

2 participants