* [ruby-dev:50273] [Ruby trunk Bug#13961] String#unpack の warning メッセージが SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
[not found] <redmine.issue-13961.20171001150109@ruby-lang.org>
@ 2017-10-01 15:01 ` tommy
2019-06-24 17:41 ` [ruby-dev:50802] " merch-redmine
1 sibling, 0 replies; 2+ messages in thread
From: tommy @ 2017-10-01 15:01 UTC (permalink / raw)
To: ruby-dev
Issue #13961 has been reported by tommy (Masahiro Tomita).
----------------------------------------
Bug #13961: String#unpack の warning メッセージが SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
https://bugs.ruby-lang.org/issues/13961
* Author: tommy (Masahiro Tomita)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.5.0dev (2017-10-01 trunk 60085) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
String#unpack で不正なディレクティブが指定された時のwarningメッセージが指定文字列ではなくNUL終端まで出力してしまいます。
```
% ruby -we '"hoge".unpack(("o"*100)[0,24])'
-e:1: warning: unknown unpack directive 'o' in 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo'
-e:1: warning: unknown unpack directive 'o' in 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo'
```
次のパッチで直ると思います。
```diff
diff --git a/pack.c b/pack.c
index 327c478af8..532e03cb14 100644
--- a/pack.c
+++ b/pack.c
@@ -1738,8 +1738,8 @@ pack_unpack_internal(VALUE str, VALUE fmt, int mode)
break;
default:
- rb_warning("unknown unpack directive '%c' in '%s'",
- type, RSTRING_PTR(fmt));
+ rb_warning("unknown unpack directive '%c' in '% "PRIsVALUE"'",
+ type, fmt);
break;
}
}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ruby-dev:50802] [Ruby trunk Bug#13961] String#unpack の warning メッセージが SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
[not found] <redmine.issue-13961.20171001150109@ruby-lang.org>
2017-10-01 15:01 ` [ruby-dev:50273] [Ruby trunk Bug#13961] String#unpack の warning メッセージが SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない tommy
@ 2019-06-24 17:41 ` merch-redmine
1 sibling, 0 replies; 2+ messages in thread
From: merch-redmine @ 2019-06-24 17:41 UTC (permalink / raw)
To: ruby-dev
Issue #13961 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
Fixed by commit:027cf467a4d093275b9c18fe694337765ff00213.
----------------------------------------
Bug #13961: String#unpack の warning メッセージが SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
https://bugs.ruby-lang.org/issues/13961#change-78820
* Author: tommy (Masahiro Tomita)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.5.0dev (2017-10-01 trunk 60085) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
String#unpack で不正なディレクティブが指定された時のwarningメッセージが指定文字列ではなくNUL終端まで出力してしまいます。
```
% ruby -we '"hoge".unpack(("o"*100)[0,24])'
-e:1: warning: unknown unpack directive 'o' in 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo'
-e:1: warning: unknown unpack directive 'o' in 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo'
```
次のパッチで直ると思います。
```diff
diff --git a/pack.c b/pack.c
index 327c478af8..532e03cb14 100644
--- a/pack.c
+++ b/pack.c
@@ -1738,8 +1738,8 @@ pack_unpack_internal(VALUE str, VALUE fmt, int mode)
break;
default:
- rb_warning("unknown unpack directive '%c' in '%s'",
- type, RSTRING_PTR(fmt));
+ rb_warning("unknown unpack directive '%c' in '% "PRIsVALUE"'",
+ type, fmt);
break;
}
}
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-24 17:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <redmine.issue-13961.20171001150109@ruby-lang.org>
2017-10-01 15:01 ` [ruby-dev:50273] [Ruby trunk Bug#13961] String#unpack の warning メッセージが SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない tommy
2019-06-24 17:41 ` [ruby-dev:50802] " merch-redmine
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 NNTP newsgroup(s).