Skip to content

stdio: fix fgets(), add gets()#473

Draft
julianuziemblo wants to merge 1 commit into
masterfrom
julianuziemblo/#1489
Draft

stdio: fix fgets(), add gets()#473
julianuziemblo wants to merge 1 commit into
masterfrom
julianuziemblo/#1489

Conversation

@julianuziemblo
Copy link
Copy Markdown
Contributor

@julianuziemblo julianuziemblo commented May 8, 2026

Fixes: phoenix-rtos/phoenix-rtos-project#1489

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?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: ia32-generic-qemu

Checklist:

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
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes the gets stub from posix/stubs.c and provides a functional implementation in stdio/file.c. The implementation introduces a static helper _fgets to share logic between fgets_unlocked and the new gets function, which now correctly handles locking on stdin. I have no feedback to provide as there were no review comments to evaluate.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Unit Test Results

10 550 tests  +7   9 892 ✅ +11   54m 11s ⏱️ +19s
   649 suites ±0     656 💤  -  6 
     1 files   ±0       2 ❌ + 2 

For more details on these failures, see this check.

Results for commit 1a2af56. ± Comparison against base commit 1383f55.

This pull request removes 82 and adds 89 tests. Note that renamed tests count towards both.
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype._tolower
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype._toupper
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.isalnum
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.isalpha
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.isascii
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.isblank
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.iscntrl
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.isdigit
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.isgraph
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc.ctype.islower
…
phoenix-rtos-tests/libc/misc ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/misc
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.fgets_newline_preserved
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.fgets_partial_reads
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.fgets_sizes
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.fgets_truncation
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.fgetsfputs_basic
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.fgetsfputs_readonly
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.gets_basic
phoenix-rtos-tests/libc/stdio ‑ aarch64a53-zynqmp-qemu:phoenix-rtos-tests/libc/stdio.stdio_getput.gets_multiline
phoenix-rtos-tests/libc/stdio ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/stdio.stdio_getput.fgets_newline_preserved
…

♻️ This comment has been updated with latest results.

@julianuziemblo julianuziemblo force-pushed the julianuziemblo/#1489 branch from 8c3af92 to fb9fffb Compare May 8, 2026 11:49
@julianuziemblo julianuziemblo requested a review from etiaro May 8, 2026 11:59
Copy link
Copy Markdown
Member

@nalajcie nalajcie left a comment

Choose a reason for hiding this comment

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

Adding multiple people before even the test were run (and failed)? Please be more mindful to the potential reviewers,

Comment thread stdio/file.c Outdated
@julianuziemblo julianuziemblo force-pushed the julianuziemblo/#1489 branch from 578643c to 1a2af56 Compare May 14, 2026 13:30
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.

fgets() behavior and implementation diverges from ISO C standard

2 participants