Project

General

Profile

Bug #13957

readline が SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない

Added by tommy (Masahiro Tomita) almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-09-29 trunk 60062) [x86_64-linux]
[ruby-dev:50271]

Description

SHARABLE_MIDDLE_SUBSTRING=1 でコンパイルしたRubyで、Readline.insert_text の文字列が正しく扱われません。

% ruby -rreadline -e 'p Readline.insert_text(("a"*100)[0,24]).line_buffer'
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

次のパッチで直ると思います。

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"
#1

Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED
  • Status changed from Open to Closed

Updated by nagachika (Tomoyuki Chikanaga) over 2 years ago

  • Backport changed from 2.3: REQUIRED, 2.4: REQUIRED to 2.3: REQUIRED, 2.4: DONE

ruby_2_4 r61456 merged revision(s) 60071.

Updated by usa (Usaku NAKAMURA) over 2 years ago

  • Backport changed from 2.3: REQUIRED, 2.4: DONE to 2.3: DONE, 2.4: DONE

ruby_2_3 r62140 merged revision(s) 60071.

Also available in: Atom PDF