From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B50421F45D; Sun, 22 Mar 2020 22:13:58 +0000 (UTC) Date: Sun, 22 Mar 2020 22:13:58 +0000 From: Eric Wong To: Grzegorz Daniluk Cc: mwrap-public@80x24.org Subject: Re: mwrap and Ruby 2.6.5 Message-ID: <20200322221358.GA10470@dcvr> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: Grzegorz Daniluk wrote: > Hi Eric, > > Does mwrap work with Ruby 2.6.5? Yes, it should work on all 2.6, but I'm not sure how rbenv configures it... Judging from libruby.so.2.6 addresses in your log it could be with --enable-shared, which isn't the default I've always just built using `./configure && make ...' and never bothered with rvm/rbenv stuff. I no longer have access to hardware capable of building extra Rubies in a reasonable amount of time, though, so my ability to test alternate builds is limited. > I tried to use mwrap from the Gem, it works however there are no Ruby > code line numbers in the output. Memory leaks are reported at places > like libruby.so.2.6(+0xdb97f). I downloaded the git repo and tried to > run the tests, not all tests passed, please see the attached file. Thanks for sharing the log, comments inline. > greg@amd:~/dev/mwrap$ rake test > install -c tmp/x86_64-linux/mwrap/2.6.5/mwrap.so lib/mwrap.so > cp tmp/x86_64-linux/mwrap/2.6.5/mwrap.so tmp/x86_64-linux/stage/lib/mwrap.so > Loaded suite /home/greg/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader > Started > Traceback (most recent call last): > -e:5:in `
': undefined method `each' for nil:NilClass (NoMethodError) I guess `-e loc=Mwrap["-e:3"]' on the command-line failed, probably because of libruby being a shared library. > ======================================================================================================================== > 179: -e loc.each{|size,gen|p([size,gen,count])} > 180: ) > 181: buf = IO.popen(@@env, cmd, &:read) > => 182: assert_predicate $?, :success? > 183: assert_match(/\A\[\s*\d+,\s*\d+,\s*\d+\]\s*\z/s, buf) > 184: size, gen, count = eval(buf) > 185: assert_operator size, :>=, 10000 > /home/greg/dev/mwrap/test/test_mwrap.rb:182:in `test_aref_each' > Failure: test_aref_each(TestMwrap): > <#>.success? is true value expected but was > > ======================================================================================================================== > F > ======================================================================================================================== > /home/greg/dev/mwrap/test/test_mwrap.rb:94:in `test_clear' > /home/greg/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tempfile.rb:336:in `create' > 98: tmp.rewind > 99: buf = tmp.read > 100: assert_not_match(/\s+-e:1$/, buf) > => 101: assert_match(/\b20001\s+1\s+-e:3$/, buf) > 102: end > 103: end > 104: > /home/greg/dev/mwrap/test/test_mwrap.rb:101:in `block in test_clear' > Failure: test_clear(TestMwrap): > was expected to be =~ > <" 20001 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xe0e64) [0x7f5f8a0d7e64]\n">. Yeah, I wonder if the tests need to be relaxed or skipped for builds with shared libraries. > ======================================================================================================================== > .F > ======================================================================================================================== > /home/greg/dev/mwrap/test/test_mwrap.rb:40:in `test_dump_via_destructor' > /home/greg/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tempfile.rb:336:in `create' > 42: res = system(env, *cmd, { 5 => tmp }) > 43: assert res, $?.inspect > 44: tmp.rewind > => 45: assert_match(/\b10001\s+1\s+-e:1$/, tmp.read) > 46: > 47: env['MWRAP'] = 'dump_fd:1,dump_min:10000' > 48: tmp.rewind > /home/greg/dev/mwrap/test/test_mwrap.rb:45:in `block in test_dump_via_destructor' > Failure: test_dump_via_destructor(TestMwrap): > was expected to be =~ > <" 120 1 /lib/x86_64-linux-gnu/libc.so.6(+0x2ec3e) [0x7f4bc5380c3e]\n" + > " 13440 7 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(rb_encdb_replicate+0x288) [0x7f4bc57e5438]\n" + > " 192 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xddd68) [0x7f4bc5820d68]\n" + > " 1723566 3807 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xe0e64) [0x7f4bc5823e64]\n" + > " 208 1 /lib/x86_64-linux-gnu/libc.so.6(+0x2c740) [0x7f4bc537e740]\n" + > " 384 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xa14e1) [0x7f4bc57e44e1]\n" + > " 171 1 /lib/x86_64-linux-gnu/libc.so.6(+0x2ceea) [0x7f4bc537eeea]\n" + > " 3728 12 /lib/x86_64-linux-gnu/libc.so.6(+0x2e1e1) [0x7f4bc53801e1]\n" + > " 640 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(ruby_init_setproctitle+0x68) [0x7f4bc59c2ec8]\n" + > " 1344 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0x25e120) [0x7f4bc59a1120]\n" + > " 32 1 /lib/x86_64-linux-gnu/libpthread.so.0(pthread_getattr_np+0xf5) [0x7f4bc456b515]\n" + > " 240 1 /lib/x86_64-linux-gnu/libc.so.6(getdelim+0x148) [0x7f4bc53d1be8]\n" + > " 552 1 /lib/x86_64-linux-gnu/libc.so.6(fopen+0x1a) [0x7f4bc53d0e4a]\n" + > " 544 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xd8d93) [0x7f4bc581bd93]\n" + > " 120 1 /lib/x86_64-linux-gnu/libc.so.6(getdelim+0xec) [0x7f4bc53d1b8c]\n" + > " 156 2 /lib64/ld-linux-x86-64.so.2(+0x1d32a) [0x7f4bc5eee32a]\n" + > " 1024 1 /lib/x86_64-linux-gnu/libc.so.6(_IO_file_doallocate+0x8c) [0x7f4bc53d018c]\n" + > " 24 2 /lib/x86_64-linux-gnu/libc.so.6(__strdup+0x1a) [0x7f4bc53ef9ba]\n" + > " 128 1 /usr/lib/x86_64-linux-gnu/liburcu-bp.so.6(+0x273d) [0x7f4bc4f4873d]\n" + > " 520 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0x25e12d) [0x7f4bc59a112d]\n" + > " 81920 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0x259080) [0x7f4bc599c080]\n" + > " 304 1 /lib64/ld-linux-x86-64.so.2(_dl_allocate_tls+0x27) [0x7f4bc5ee44a7]\n" + > " 16032 4 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xddcd5) [0x7f4bc5820cd5]\n" + > " 6423 113 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(ruby_xrealloc2+0x6c) [0x7f4bc582799c]\n" + > " 5 1 /lib/x86_64-linux-gnu/libc.so.6(+0x35240) [0x7f4bc5387240]\n" + > " 712 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0x9352e) [0x7f4bc57d652e]\n" + > " 3456 4 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(rb_encdb_declare+0x1e8) [0x7f4bc57e4ce8]\n" + > " 8 1 /lib/x86_64-linux-gnu/librt.so.1(timer_create+0x56) [0x7f4bc435e2f6]\n" + > " 176 1 /lib64/ld-linux-x86-64.so.2(+0x14463) [0x7f4bc5ee5463]\n" + > " 33554432 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xde935) [0x7f4bc5821935]\n" + > " 8192 1 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0x241f92) [0x7f4bc5984f92]\n" + > " 2492 2 /lib64/ld-linux-x86-64.so.2(+0xc101) [0x7f4bc5edd101]\n" + > " 32 1 /lib/x86_64-linux-gnu/libc.so.6(+0xcbea8) [0x7f4bc541dea8]\n" + > " 373480 4365 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(ruby_xcalloc+0x5c) [0x7f4bc58275bc]\n" + > " 208 1 /lib/x86_64-linux-gnu/libc.so.6(+0x2c457) [0x7f4bc537e457]\n" + > " 536 3 /lib64/ld-linux-x86-64.so.2(+0xe90e) [0x7f4bc5edf90e]\n" + > " 6720 24 /home/greg/.rbenv/versions/2.6.5/lib/libruby.so.2.6(+0xdd8f7) [0x7f4bc58208f7]\n" + > " 156 2 /lib64/ld-linux-x86-64.so.2(+0xc3e8) [0x7f4bc5edd3e8]\n">. > ======================================================================================================================== Odd, no match 10001 in the above at all. I wonder if that's a separate issue, since Ruby could theoretically request extra space. I admit some of these tests are fragile and may be worth skipping or removing. > ...E > ======================================================================================================================== > /home/greg/dev/mwrap/test/test_mwrap.rb:25:in `test_mwrap_preload' > /home/greg/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tempfile.rb:336:in `create' > 28: assert res, $?.inspect > 29: tmp.rewind > 30: lines = tmp.readlines `pp lines' here might give some insight on whether there's a `10001' match at all. > => 31: line_1 = lines.grep(/\s-e:1\b/)[0].strip > 32: assert_equal '10001', line_1.split(/\s+/)[0] > 33: end > 34: end > /home/greg/dev/mwrap/test/test_mwrap.rb:31:in `block in test_mwrap_preload' > Error: test_mwrap_preload(TestMwrap): NoMethodError: undefined method `strip' for nil:NilClass > ======================================================================================================================== > ....Traceback (most recent call last): > /tmp/mwrap20200322-8815-172sjvz.rb:5:in `
': undefined method `name' for nil:NilClass (NoMethodError) > ======================================================================================================================== > 221: end > 222: > 223: def test_source_location > => 224: assert_separately(+"#{<<~"begin;"}\n#{<<~'end;'}") > 225: begin; > 226: require 'mwrap' > 227: foo = '0' * 10000 > /home/greg/dev/mwrap/test/test_mwrap.rb:224:in `test_source_location' > /home/greg/dev/mwrap/test/test_mwrap.rb:216:in `assert_separately' > /home/greg/.rbenv/versions/2.6.5/lib/ruby/2.6.0/tempfile.rb:336:in `create' > /home/greg/dev/mwrap/test/test_mwrap.rb:219:in `block in assert_separately' > Failure: test_source_location(TestMwrap): is not true. > ======================================================================================================================== Dunno, but probably related o the other errors. > . > Finished in 0.393798954 seconds. > ------------------------------------------------------------------------------------------------------------------------ > 14 tests, 80 assertions, 4 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications > 64.2857% passed At least some stuff passed, so it's probably down to fragile tests not being compatible with shared library builds. I basically rely on `warn foo.inspect' or `pp' to diagnose things. It may be worth the time to make them pass, when shared builds are detected, but maybe skipping them is easier, for now.