-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ext/readline: fix global readline vars when updating rl_line_buffer. #15120
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
Conversation
4e2363c
to
e3cde84
Compare
if the new value was larger, rl_line_buffer_length was never updated. neither was rl_end (on unixes).
e3cde84
to
4335e31
Compare
ext/readline/readline.c
Outdated
if (strlen(oldstr) < Z_STRLEN_P(value)) { | ||
rl_extend_line_buffer(Z_STRLEN_P(value) + 1); | ||
} | ||
strcpy(rl_line_buffer, Z_STRVAL_P(value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not memcpy? We already checked that the buffer is large enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that s the thing, since we know it s large enough strcpy fits by its simplicity :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after 2nd thoughts, will give it a try.
fe185fb
to
f472621
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable
@remicollet just reported that this broke libedit builds. Maybe somebody wants to have a look at this. And it might be a good idea to run at least one CI against libedit-dev instead of libreadline-dev. |
|
if the new value was larger, rl_line_buffer_length was never updated. neither was rl_end (on unixes).