From: usa@garbagecollect•jp
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50459] [Ruby trunk Bug#13957] readline が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
Date: Wed, 31 Jan 2018 13:40:13 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-70088.20180131134002.f02c4aac3f466048@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13957.20170930143319@ruby-lang.org
Issue #13957 has been updated by usa (Usaku NAKAMURA).
Backport changed from 2.3: REQUIRED, 2.4: DONE to 2.3: DONE, 2.4: DONE
ruby_2_3 r62140 merged revision(s) 60071.
----------------------------------------
Bug #13957: readline が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
https://bugs.ruby-lang.org/issues/13957#change-70088
* Author: tommy (Masahiro Tomita)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.5.0dev (2017-09-29 trunk 60062) [x86_64-linux]
* Backport: 2.3: DONE, 2.4: DONE
----------------------------------------
SHARABLE_MIDDLE_SUBSTRING=1 でコンパイルしたRubyで、Readline.insert_text の文字列が正しく扱われません。
```
% ruby -rreadline -e 'p Readline.insert_text(("a"*100)[0,24]).line_buffer'
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
```
次のパッチで直ると思います。
```diff
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 253798f9e6..deebc282f5 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -93,6 +93,7 @@ static char **readline_attempted_completion_function(const char *text,
#define OutputStringValue(str) do {\
SafeStringValue(str);\
+ StringValueCStr(str);\
(str) = rb_str_conv_enc((str), rb_enc_get(str), rb_locale_encoding());\
} while (0)\
```
パッチ適用後
```
% ruby -rreadline -e 'p Readline.insert_text(("a"*100)[0,24]).line_buffer'
"aaaaaaaaaaaaaaaaaaaaaaaa"
```
--
https://bugs.ruby-lang.org/
prev parent reply other threads:[~2018-01-31 13:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-13957.20170930143319@ruby-lang.org>
2017-09-30 14:33 ` [ruby-dev:50271] [Ruby trunk Bug#13957] readline が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない tommy
2017-12-24 20:07 ` [ruby-dev:50388] " nagachika00
2018-01-31 13:40 ` usa [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-70088.20180131134002.f02c4aac3f466048@ruby-lang.org \
--to=ruby-dev@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).