ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: tommy@tmtm.org
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50273] [Ruby trunk Bug#13961] String#unpack の warning メッセージが SHARABLE_MIDDLE_SUBSTRING=1 を考慮していない
Date: Sun, 01 Oct 2017 15:01:11 +0000 (UTC)	[thread overview]
Message-ID: <redmine.issue-13961.20171001150109.bfb290f7a0d3ee34@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-13961.20171001150109@ruby-lang.org>

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/

       reply	other threads:[~2017-10-01 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-13961.20171001150109@ruby-lang.org>
2017-10-01 15:01 ` tommy [this message]
2019-06-24 17:41 ` [ruby-dev:50802] " merch-redmine

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-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.issue-13961.20171001150109.bfb290f7a0d3ee34@ruby-lang.org \
    --to=tommy@tmtm.org \
    --cc=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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 NNTP newsgroup(s).