Skip to content

Instantly share code, notes, and snippets.

View shirosaki's full-sized avatar

Hiroshi Shirosaki shirosaki

View GitHub Profile
Index: test/webrick/test_cgi.rb
===================================================================
--- test/webrick/test_cgi.rb (revision 37136)
+++ test/webrick/test_cgi.rb (working copy)
@@ -37,8 +37,13 @@
req = Net::HTTP::Get.new("/webrick.cgi/%3F%3F%3F?foo=bar")
http.request(req){|res| assert_equal("/???", res.body, log.call)}
req = Net::HTTP::Get.new("/webrick.cgi/%A4%DB%A4%B2/%A4%DB%A4%B2")
- http.request(req){|res|
- assert_equal("/\xA4\xDB\xA4\xB2/\xA4\xDB\xA4\xB2", res.body, log.call)}
diff --git a/hash.c b/hash.c
index 06d0ce9..148f802 100644
--- a/hash.c
+++ b/hash.c
@@ -2110,7 +2110,7 @@ static VALUE
env_str_new(const char *ptr, long len)
{
#ifdef _WIN32
- VALUE str = rb_str_conv_enc(rb_str_new(ptr, len), rb_utf8_encoding(), rb_locale_encoding());
+ VALUE str = rb_str_conv_enc(rb_filesystem_str_new(ptr, len), NULL, rb_locale_encoding());
@shirosaki
shirosaki / ld_crash_backtrace.md
Created September 19, 2012 09:14
ld crash on XP backtrace

My Build uses the following sources:

binutils-2.22.tar.bz2
cloog-0.17.0.tar.gz
expat-2.1.0.tar.gz
gcc-4.7.1.tar.bz2
gdb-7.5.tar.gz
gmp-5.0.5.tar.bz2
isl-0.10.tar.bz2
@shirosaki
shirosaki / gdb_ld_rubenbv_4.7.1-2.md
Created September 18, 2012 14:30
gdb session of ld.exe crash
sh-3.1$ gdb --args ld -shared -s --enable-auto-image-base --enable-auto-import
--out-implib=libmsvcrt-ruby200.dll.a msvcrt-ruby200.def --stack 0x00200000 --en
able-auto-import  dln.o encoding.o version.o array.o bignum.o class.o compar.o
complex.o dir.o dln_find.o enum.o enumerator.o error.o eval.o load.o proc.o fil
e.o gc.o hash.o inits.o io.o marshal.o math.o node.o numeric.o object.o pack.o
parse.o process.o random.o range.o rational.o re.o regcomp.o regenc.o regerror.
o regexec.o regparse.o regsyntax.o ruby.o safe.o signal.o sprintf.o st.o strfti
me.o string.o struct.o time.o transcode.o util.o variable.o compile.o debug.o i
seq.o vm.o vm_dump.o vm_backtrace.o vm_trace.o thread.o cont.o ascii.o us_ascii
@shirosaki
shirosaki / 1-strtod.c
Created September 18, 2012 07:58
test strtod
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
int main() {
char n[] = "0.1E-321";
double x;
x = strtod(n, 0);
printf("n = %s\nd = %0.330f\nerrno = %d\n", n, x, errno);
}
@shirosaki
shirosaki / 1-gcc_v.txt
Created September 14, 2012 09:42
Cross compile gcc on Linux 32bit using rubenvb recipe
Using built-in specs.
COLLECT_GCC=c:\devruby\rubyinstaller\sandbox\devkit\mingw\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/devruby/rubyinstaller/sandbox/devkit/mingw/bin/../libexec/gcc/i686-w64-mingw32/4.7.1/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: /home/shirosaki/mingw-w64/src/gcc/configure --host=i686-w64-mingw32 --build=i686-linux-gnu --target=i686-w64-mingw32 --with-sysroot=/home/shirosaki/mingw-w64/mingw32mingw32/mingw32 --prefix=/home/shirosaki/mingw-w64/mingw32mingw32/mingw32 --with-gmp=/home/shirosaki/mingw-w64/prereq/i686-w64-mingw32/install --with-mpfr=/home/shirosaki/mingw-w64/prereq/i686-w64-mingw32/install --with-mpc=/home/shirosaki/mingw-w64/prereq/i686-w64-mingw32/install --with-ppl=/home/shirosaki/mingw-w64/prereq/i686-w64-mingw32/install --with-cloog=/home/shirosaki/mingw-w64/prereq/i686-w64-mingw32/install --disable-ppl-version-check --disable-cloog-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static -lstdc++ -lm' --enable-shared --enable-static --enable-threads=
@shirosaki
shirosaki / 1-build_test_result.md
Created September 12, 2012 07:52
mingw-w64 ruby trunk on Windows XP 32bit

Ruby trunk on Windows XP 32bit

ruby 2.0.0dev (2012-09-11 trunk 36949) [i386-mingw32]

gcc version 4.6.3 (rubenvb-4.6.3)

make test passed.

@shirosaki
shirosaki / 1_9_3_x64.patch
Created September 10, 2012 15:10
Patch for rubenvb-4.7.1-2-release r33830 r33989 r35485 r36247 r36508 r36522 r36544
diff --git a/configure.in b/configure.in
index be818d4..bd6cf62 100644
--- a/configure.in
+++ b/configure.in
@@ -479,7 +479,7 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then
])
])
done
- AS_CASE([" $warnflags "],[*" -Wno-missing-field-initializers "*], [wflag=-Wextra],
+ AS_CASE([" $warnflags "],[*" -Wno-missing-field-initializers "*], [wflag="-Wall -Wextra"],
@shirosaki
shirosaki / fix_test_pstore.patch
Created August 31, 2012 01:49
Fix test_pstore.rb to increase timeout
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb
index 19290c6..4fa037a 100644
--- a/test/ruby/envutil.rb
+++ b/test/ruby/envutil.rb
@@ -74,12 +74,12 @@ module EnvUtil
return stdout, stderr, status
end
ensure
- [in_c, in_p, out_c, out_p, err_c, err_p].each do |io|
- io.close if io && !io.closed?
@shirosaki
shirosaki / bench.txt
Created August 29, 2012 15:30
benchmark scan vs unpack for utf-8 string
$ ruby -v -Ku scan_unpack_banch.rb ~
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Rehearsal -----------------------------------------------------
scan each len: 0.140000 0.000000 0.140000 ( 0.141777)
unpack each len: 0.070000 0.000000 0.070000 ( 0.064889)
scan total len: 0.110000 0.000000 0.110000 ( 0.108800)
unpack total len: 0.000000 0.000000 0.000000 ( 0.004272)
-------------------------------------------- total: 0.320000sec
user system total real