Repository navigation
Conversation
On the calculator, `"file" Purge` called f_unlink with disk writes disabled, which raises "Flush while write protect" or an error in qspi_disc.c, then freezes the calculator until a reset. Enable writes around f_unlink, as file::open does. Leave them enabled if a file is currently open for writing. The simulator does not use this code. Author & design: Jean Wilson Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
On the calculator,
"file" Purgecallsf_unlinkwith disk writes disabled. On my DM32 this raised "Flush while write protect" once and an error in../dm/qspi_disc.c:149another time, then froze the calculator until a reset.file::opencallssys_disk_write_enable(1)for writing;file::unlinkdid not.Fix
In
file::unlink,src/file.cc, enable disk writes aroundf_unlink, then disable them again unless a file is currently open for writing.Tests
On a DM32, with a build that contains this commit (0.10.0-77-6ef8, my test branch), USB cable unplugged:
"abc" "/t9.txt" STO"/t9.txt" Purge"/t9.txt" RCLBefore this fix, on 0.10.0-72-eb92,
"/t1.txt" Purgefroze the calculator.The simulator does not use this code, so the test suite cannot show the problem, and I have not added a test. I have not run the suite on this branch for the same reason.
Author & design: Jean Wilson
🤖 Generated with Claude Code