[#81999] [Ruby trunk Bug#13737] "can't modify frozen String" when installing bundled gems — ko1@...
Issue #13737 has been updated by ko1 (Koichi Sasada).
4 messages
2017/07/11
[#82005] [Ruby trunk Bug#13737] "can't modify frozen String" when installing bundled gems — nobu@...
Issue #13737 has been updated by nobu (Nobuyoshi Nakada).
3 messages
2017/07/12
[#82102] Re: register_fstring_tainted:FL_TEST_RAW(str, RSTRING_FSTR) — Eric Wong <normalperson@...>
Koichi Sasada <ko1@atdot.net> wrote:
4 messages
2017/07/18
[#82151] [Ruby trunk Feature#13637] [PATCH] tool/runruby.rb: test with smallest possible machine stack — Rei.Odaira@...
Issue #13637 has been updated by ReiOdaira (Rei Odaira).
3 messages
2017/07/24
[ruby-core:82159] Re: [Ruby trunk Feature#13637] [PATCH] tool/runruby.rb: test with smallest possible machine stack
From:
Eric Wong <normalperson@...>
Date:
2017-07-25 02:50:25 UTC
List:
ruby-core #82159
Sorry, original patch was broken :x (yet "make exam" passed...)
(it leaked memory and used sizeof improperly)
Can you try the following, instead?
diff --git a/io.c b/io.c
index 60af120c18..0d5ca0d95b 100644
--- a/io.c
+++ b/io.c
@@ -10692,7 +10692,7 @@ nogvl_copy_stream_write(struct copy_stream_struct *stp, char *buf, size_t len)
static void
nogvl_copy_stream_read_write(struct copy_stream_struct *stp)
{
- char buf[1024*16];
+ char *buf;
size_t len;
ssize_t ss;
int ret;
@@ -10700,8 +10700,14 @@ nogvl_copy_stream_read_write(struct copy_stream_struct *stp)
int use_eof;
off_t src_offset;
int use_pread;
+ size_t alloc_size = 16384;
copy_length = stp->copy_length;
+ if (copy_length > 0 && copy_length < alloc_size) {
+ alloc_size = copy_length;
+ }
+ buf = xmalloc(alloc_size);
+
use_eof = copy_length == (off_t)-1;
src_offset = stp->src_offset;
use_pread = src_offset != (off_t)-1;
@@ -10713,18 +10719,18 @@ nogvl_copy_stream_read_write(struct copy_stream_struct *stp)
if (r == (off_t)-1 && errno) {
stp->syserr = "lseek";
stp->error_no = errno;
- return;
+ goto out;
}
src_offset = (off_t)-1;
use_pread = 0;
}
while (use_eof || 0 < copy_length) {
- if (!use_eof && copy_length < (off_t)sizeof(buf)) {
+ if (!use_eof && copy_length < (off_t)alloc_size) {
len = (size_t)copy_length;
}
else {
- len = sizeof(buf);
+ len = alloc_size;
}
if (use_pread) {
ss = maygvl_copy_stream_read(0, stp, buf, len, src_offset);
@@ -10735,15 +10741,17 @@ nogvl_copy_stream_read_write(struct copy_stream_struct *stp)
ss = maygvl_copy_stream_read(0, stp, buf, len, (off_t)-1);
}
if (ss <= 0) /* EOF or error */
- return;
+ goto out;
ret = nogvl_copy_stream_write(stp, buf, ss);
if (ret < 0)
- return;
+ goto out;
if (!use_eof)
copy_length -= ss;
}
+out:
+ free(buf);
}
static void *
Thanks.
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>