Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15859
| From | A <auroralanes@protonmail.ch> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Readline history bug |
| Date | 2020-01-31 20:32 +0000 |
| Message-ID | <mailman.88.1580515675.2412.bug-bash@gnu.org> (permalink) |
| References | <GEBO_8wY5MXQyA9XaPplJPssz-_VaRYuLUZ4I3ITmA_1ZbiZQ6pWAQ9PyMYC70ZLlbKxP-ne7QSKXq8Bd6Cy6SzfQksyGwP7ykYgeIrJ-5Y=@protonmail.ch> |
[Multipart message — attachments visible in raw view] - view raw
The readline package doesn't return the errno for some errors in write_history, append_history, and history_truncate_file.
This caused an error in the CPython interpreter(at exit time) when the .python_history file was not writable.
In particular these calls return -1 when the internal`histfile_restore`call fails because`rename`fails. It's fine for`histfile_restore`to return the result from`rename`, but this should be checked for failure (e.g. -1) and handled appropriately by the caller in`history_do_write`and`history_truncate_file`. For example, in`history_do_write`they do the following:
if (rv == 0 && histname && tempname)
rv = histfile_restore (tempname, histname);
if (rv != 0)
{
if (tempname)
unlink (tempname);
history_lines_written_to_file = 0;
}
This needs a simple fix to update the value of`rv`when`histfile_restore`fails:
if (rv == 0 && histname && tempname)
rv = histfile_restore (tempname, histname);
if (rv != 0) {
rv = errno;
if (tempname)
unlink(tempname);
history_lines_written_to_file = 0;
}
Code snippet taken from https://github.com/python/cpython/pull/18299#issuecomment-580883515
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Readline history bug A <auroralanes@protonmail.ch> - 2020-01-31 20:32 +0000
csiph-web