Skip to content

Fix #20919: clear ungetc buffer on IO#seek with encoding #12714

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

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

Conversation

mrzasa
Copy link
Contributor

@mrzasa mrzasa commented Feb 7, 2025

Changes:

  • When IO#seek is called, it clears cbuf (the ungetc buffer, not only the rbuf (the read buffer`

When we call IO#ungetc on a file that not requires encoding, the char is returned to the read bugger rbuf. But when encoding is set on the file, we have a separate bugger for characters that were sent via ungetc. This buffer has not been cleared in master, and as a result, we had issues with a combinaiton of #seek #ungetc and encoding.

I still have a failing cygwin build, It's a bit cryptic to me as I don't have too much of experience with the Ruby build process, I'd appreciate some hints how to fix it.

Fixes issue https://bugs.ruby-lang.org/issues/20919

This comment has been minimized.

@mrzasa mrzasa force-pushed the fix-20919-ungetc-with-encoding branch from 9a1e01c to 7251395 Compare February 8, 2025 14:49
@mrzasa mrzasa marked this pull request as ready for review February 8, 2025 20:39
@mrzasa mrzasa marked this pull request as draft February 10, 2025 13:43
@mrzasa mrzasa force-pushed the fix-20919-ungetc-with-encoding branch from de9f1f9 to 28c216f Compare February 10, 2025 13:52
@mrzasa mrzasa marked this pull request as ready for review February 10, 2025 21:20
@mrzasa mrzasa force-pushed the fix-20919-ungetc-with-encoding branch 3 times, most recently from d5490b1 to 1e51ee4 Compare February 12, 2025 13:55
This reverts commit 9691ece.
This is to check if CI will pass on a pristine master version
This reverts commit d5490b1.
This restores my fix to check the CI
@mrzasa mrzasa force-pushed the fix-20919-ungetc-with-encoding branch from 32acfbf to b24d9de Compare February 13, 2025 12:26
@byroot byroot requested a review from nobu April 15, 2025 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant