Skip to content

gh-128066: Fixed PyREPL history saving on read-only file systems#128088

Closed
vladimir-poghosyan wants to merge 7 commits into
python:mainfrom
vladimir-poghosyan:fix-issue-128066
Closed

gh-128066: Fixed PyREPL history saving on read-only file systems#128088
vladimir-poghosyan wants to merge 7 commits into
python:mainfrom
vladimir-poghosyan:fix-issue-128066

Conversation

@vladimir-poghosyan

@vladimir-poghosyan vladimir-poghosyan commented Dec 19, 2024

Copy link
Copy Markdown

As suggested in the comment of the linked issue by @ZeroIntensity, I simply handled the exception with a resulting warning.

@ghost

ghost commented Dec 19, 2024

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

Comment thread Lib/_pyrepl/readline.py Outdated

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM in general, with few concerns.

  1. Maybe it worth a test.
  2. I worry, that error is too late. Though, this will be fixed by #132294.

@vladimir-poghosyan

Copy link
Copy Markdown
Author

Thank you for reviewing the PR.

I looked through your mentioned pull request an noticed that the call to append_history_file is wrapped in except (FileNotFoundError, PermissionError) exception handler, thus still prone to the same read-only file system error, or am I missing something?

Will it be better, that I add OSError to the except (FileNotFoundError, PermissionError) in the site.py (where the write_history_file is called) with a warning message and leave its implementation as it was? In that way file handling code in both write_history_file and append_history_file methods will match.

@skirpichev

Copy link
Copy Markdown
Member

I looked through your mentioned pull request an noticed that the call to append_history_file is wrapped in except (FileNotFoundError, PermissionError) exception handler

Now I also catch OSError like in your pr.

Will it be better, that I add OSError to the except (FileNotFoundError, PermissionError) in the site.py

Hmm, maybe. (BTW I doubt that FileNotFoundError is relevant at all.)

@vladimir-poghosyan

vladimir-poghosyan commented Apr 11, 2025

Copy link
Copy Markdown
Author

I've changed my implementation and moved error handling to the site.py. Regarding the the FileNotFoundError being caught, I think that it is relevant for missing directories in the history file path.

@ambv

ambv commented May 20, 2025

Copy link
Copy Markdown
Contributor

Closing in favor of #134380.

@ambv ambv closed this May 20, 2025
@vladimir-poghosyan vladimir-poghosyan deleted the fix-issue-128066 branch May 31, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants