aspell で C のソースのコメント (と文字列) をスペルチェックするには、
% aspell --lang=en -c --add-filter=ccpp foo.c
とすればいいようだ。
では Ruby のコメントのスペルチェックを、というと、提供されていないので ccpp.amf をちょっと変えて適当にでっち上げてみる。
% cat rb.amf MODE rb ASPELL >=0.60.1 MAGIC /<noregex>/rb/ruby DESCRIPTION mode for checking Ruby comments and string literals FILTER url FILTER context OPTION clear-context-delimiters OPTION add-context-delimiters \# \0 OPTION add-context-delimiters " " OPTION disable-context-visible-first % aspell --lang=en -c --add-filter-path=$PWD --add-filter=rb foo.rb
まぁ、てきとうである。' ' を足したら doesn't がひっかかるようになってしまったのでやめておいた。
ripper と組み合わせてどうにかするのがいい気がする。
openssl-0.9.8l が出ていて、
Changes between 0.9.8k and 0.9.8l [5 Nov 2009]
*) Disable renegotiation completely - this fixes a severe security
problem (CVE-2009-3555) at the cost of breaking all
renegotiation. Renegotiation can be re-enabled by setting
SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION in s3->flags at
run-time. This is really not recommended unless you know what
you're doing.
[Ben Laurie]
だそうな。
うぅむ。renegotiation しなくなっちゃうのか。
renegotiation は、書き込み中に読み込みが発生したり、その逆が起こる例らしくて、non-blocking I/O API の話に関連して興味深いところなのだが。
次回の FSIJ の月例会 は須藤さんのテスティングフレームワーク。
以前にも触れたことがあるが、最近またNetBSD on VAX に触れたので、ひさしぶりにちょっと試してみる。
まぁ、基本的に NetBSD SIMH HOW-TO に書いてあるとおりなのだが。
まず simh というソフトウェアで VAX を実現する。
Debian にも simh のパッケージはあるのだが、(昔試した記憶では) ネットワークがつかえない気がするので、自分でビルドする。ネットワークが使えないとファイルを転送するのも面倒なので、やはりネットワークは重要である。
/home/ruby/vax に入れてみよう。
% cd /home/ruby % mkdir vax % cd vax
まず、libpcap の新しいのをインストールする。(Debian lenny の libpcap は古いので、simh でネットワークを使うのには使えない)
% wget http://www.tcpdump.org/release/libpcap-1.0.0.tar.gz % tar xfz libpcap-1.0.0.tar.gz % cd libpcap-1.0.0 % ./configure --prefix=/home/ruby/vax % make % mkdir /home/ruby/vax/bin % make install % cd ..
で、simh をビルドする。
% wget http://simh.trailing-edge.com/sources/simhv38-1.zip % mkdir simhv38-1 % cd simhv38-1 % unzip ../simhv38-1.zip % vi makefile # /usr/local/include -> /home/ruby/vax/include # /usr/local/lib/libpcap.a -> /home/ruby/vax/lib/libpcap.a % mkdir BIN % make USE_NETWORK=1 % cd .. % cd bin % ln -s ../simhv38-1/BIN/* . % cd ..
これで VAX を動かして NetBSD をインストールする。(ネットワークに libpcap を使うので、そこで特権が必要)
% wget ftp://ftp.NetBSD.org/pub/NetBSD/iso/5.0.1/vaxcd-5.0.1.iso % sudo bin/vax VAX simulator V3.8-1 sim> load -r simhv38-1/VAX/ka655x.bin sim> set cpu 64m sim> set rq0 ra92 sim> at rq0 netbsd.dsk RQ: creating new file sim> set rq1 cdrom sim> at rq1 vaxcd-5.0.1.iso sim> at xq0 eth0 Eth: opened eth0 sim> boot cpu KA655-B V5.3, VMB 2.7 Performing normal system tests. 40..39..38..37..36..35..34..33..32..31..30..29..28..27..26..25.. 24..23..22..21..20..19..18..17..16..15..14..13..12..11..10..09.. 08..07..06..05..04..03.. Tests completed. >>>boot dua1: (BOOT/R5:0 DUA1 ...
しばらくすると以下のように NetBSD のインストーラが普通に立ち上がるので、普通にインストールする。
Welcome to sysinst, the NetBSD-5.0.1 system installation tool. This
menu-driven tool is designed to help you install NetBSD to a hard disk, or
upgrade an existing NetBSD system, with a minimum of work.
In the following menus type the reference letter (a, b, c, ...) to select an
item, or type CTRL+N/CTRL+P to select the next/previous item.
The arrow keys and Page-up/Page-down may also work.
Activate the current selection from the menu by typing the enter key.
+---------------------------------------------+
|>a: Installation messages in English |
| b: Messages d'installation en franais |
| c: Installation auf Deutsch |
| d: Komunikaty instalacyjne w jezyku polskim |
| e: Mensajes de instalacin en castellano |
+---------------------------------------------+
NetBSD SIMH HOW-TO に書いてあるとおり、CD-ROM のデバイスを cd0a から ra1a に変える以外に特別な点はない。
ただ、disk が小さい (1.5GB しかない) ので、インストールするものは最小限にしておく。とはいえ、Ruby をコンパイルするにはコンパイラが必要なので Compiler Tools は欲しい。
+-----------------------------------------------+ | NetBSD-5.0.1 Install System | | | | a: Install NetBSD to hard disk | | b: Upgrade NetBSD on a hard disk | | c: Re-install sets or install additional sets | |>d: Reboot the computer | | e: Utility menu | | x: Exit Install System | +-----------------------------------------------+
syncing disks... done unmounting file systems... done HALT instruction, PC: 800DC47E (PUSHAB 801034FC) sim> quit Goodbye Eth: closed eth0
インストールが終わったら、起動用のスクリプトを用意し、それを指定して vax を起動すればログインプロンプトまで進む。
% cat netbsd-boot load -r /home/ruby/vax/simhv38-1/VAX/ka655x.bin set cpu 64m set rq0 ra92 at rq0 netbsd.dsk at xq0 eth0 boot cpu % sudo bin/vax netbsd-boot VAX simulator V3.8-1 Eth: opened eth0 KA655-B V5.3, VMB 2.7 Performing normal system tests. 40..39..38..37..36..35..34..33..32..31..30..29..28..27..26..25.. 24..23..22..21..20..19..18..17..16..15..14..13..12..11..10..09.. 08..07..06..05..04..03.. Tests completed. >>>boot dua0: (BOOT/R5:0 DUA0 ... NetBSD/vax (Amnesiac) (console) login:
あとは中身をふつうに設定する。ユーザを作るとか。
あと、とりあえず /etc/rc.conf に以下を追加。(仮想マシンのホスト名は面倒なので OS の名前とかで済ますことにしている)
hostname="vax" dhclient=YES sshd=YES
これで再起動すれば、ssh が動いて他のマシンから入れるようになる。(simh のネットワーク実装の都合により、simh を動かしているマシン自体とは通信できない。ネットワークカードを 2枚させば通信できるらしいが)
なお、ssh の鍵生成に時間がかかるので気長に待つ必要がある。
$ uname -a NetBSD vax 5.0.1 NetBSD 5.0.1 (GENERIC) #0: Thu Jul 30 07:31:47 UTC 2009 builds@b6.netbsd.org:/home/builds/ab/netbsd-5-0-1-RELEASE/vax/200907292356Z-obj/home/builds/ab/netbsd-5-0-1-RELEASE/src/sys/arch/vax/compile/GENERIC vax
で、Ruby はスナップショットを取ってきてビルドするのは大きな問題なくできるようだ。(ひとつコンパイルエラーがあったがそれは r25712 で直した。)
$ ./ruby -v ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
ただ、とても遅いので、とても気が長くないとやってられないかもしれない。
svn だの autoconf だの bison だのは入っていないので、リポジトリから取ってきてビルドするのは大変そうである。
テストは... まぁ、さもありなん。
$ ./ruby -v
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
$ make test
sample/test.rb:assignment ....................................................................................................................................................................................................................................................................................................................................................................................
sample/test.rb:condition ..
sample/test.rb:if/unless ...
sample/test.rb:case .....
sample/test.rb:while/until ........
sample/test.rb:exception ..........
sample/test.rb:array .......................................
sample/test.rb:hash ...........................
sample/test.rb:iterator ...............................................................................................................
sample/test.rb:float .........test failed
*** Error code 1
Stop.
make: stopped in /home/akr/ruby/sn/snapshot
$ make test-all TESTS=-v
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./tool/runruby.rb --extout=.ext -- "./test/runner.rb" -v
[1] Floating point exception (core dumped) ./miniruby -I./l...
*** Error code 136
Stop.
make: stopped in /home/akr/ruby/sn/snapshot
% ./ruby bootstraptest/runner.rb
2009-11-11 11:39:21 +0900
Driver is ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
Target is ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
test_method.rb ...........................................................................................................................................................................................................................
test_load.rb ..
test_thread.rb ......................./tmp/bootstraptest20091111-6828-ov7ccz.tmpwd/zzz.rb:2: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:001bdc d:000005 BLOCK /tmp/bootstraptest20091111-6828-ov7ccz.tmpwd/zzz.rb:2
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
/tmp/bootstraptest20091111-6828-ov7ccz.tmpwd/zzz.rb:2:in `block in <top (required)>'
/tmp/bootstraptest20091111-6828-ov7ccz.tmpwd/zzz.rb:2:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
FFF....................
test_objectspace.rb ...
test_finalizer.rb .
test_struct.rb .
test_syntax.rb .................................................................................................................................................
test_marshal.rb .
test_eval.rb ....................................
test_gc.rb ..
test_block.rb .......................................................
test_flip.rb .
test_literal.rb ......................................................................................................................................................
test_exception.rb .................................
test_massign.rb ..................................
test_fork.rb .bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
bootstraptest.tmp.rb:4: [BUG] thread_timer/timedwait: 3
ruby 1.9.2dev (2009-11-09 trunk 25701) [vax-netbsdelf5.0.1]
-- control frame ----------
c:0004 p:---- s:0009 b:0009 l:000008 d:000008 CFUNC :fork
c:0003 p:0009 s:0006 b:0006 l:0018a4 d:000005 BLOCK bootstraptest.tmp.rb:4
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `fork'
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
F.
test_proc.rb ..................................
test_class.rb ............................................
test_io.rb ..F......................................................
test_flow.rb ............................................
test_autoload.rb ...........
test_attr.rb ..
test_jump.rb .........................
#245 test_thread.rb:219:in `<top (required)>':
open("zzz.rb", "w") do |f|
f.puts <<-END
begin
Thread.new { fork { GC.start } }.join
pid, status = Process.wait2
$result = status.success? ? :ok : :ng
rescue NotImplementedError
$result = :ok
end
END
end
require "./zzz.rb"
$result
#=> "ng" (expected "ok")
#246 test_thread.rb:235:in `<top (required)>':
th = Thread.new {sleep 2}
th.join(1)
th.join
#=> not finished in 3 seconds
#247 test_thread.rb:241:in `<top (required)>':
require 'timeout'
th = Thread.new {sleep 2}
begin
Timeout.timeout(1) {th.join}
rescue Timeout::Error
end
th.join
#=> not finished in 3 seconds
#731 test_fork.rb:12:in `<top (required)>':
begin
children = (1..10).map{
Thread.start{fork{}}.value
}
while !children.empty? and pid = Process.wait
children.delete(pid)
end
rescue NotImplementedError
end
#=> not finished in 10 seconds [ruby-core:22158]
#813 test_io.rb:33:in `<top (required)>':
r, w = IO.pipe
Thread.new {
w << "ab"
sleep 0.1
w << "ab"
}
r.gets("abab")
#=> not finished in 1 seconds
FAIL 5/949 tests failed
Wed Nov 11 13:31:37 JST 2009
> "ng" (expected "ok")
#246 test_thread.rb:235:in `<top (required)>':
th = Thread.new {sleep 2}
th.join(1)
th.join
#=> not finished in 3 seconds
#250 test_thread.rb:268:in `<top (required)>': [ruby-dev:34492]
#731 test_fork.rb:12:in `<top (required)>':
begin
children = (1..10).map{
Thread.start{fork{}}.value
}
while !children.empty? and pid = Process.wait
children.delete(pid)
end
rescue NotImplementedError
end
#=> not finished in 10 seconds [ruby-core:22158]
#813 test_io.rb:33:in `<top (required)>':
r, w = IO.pipe
Thread.new {
w << "ab"
sleep 0.1
w << "ab"
}
r.gets("abab")
#=> not finished in 1 seconds
FAIL 5/949 tests failedtest-all が途中で異常終了するのが嫌いである。
というのはテストで ruby が (どの程度) 壊れているか観測できなくなるからである。
だが、異常終了する時に文句を言うのもいい加減面倒である。
というわけで、chkbuild の test-all で異常終了したら、test/* を個々に実行するようにしてみた。
これで、異常終了する場合でもかなり観測可能になる。
ただ、dl のテストが直った後に実装したので、この機能がちゃんと動くかテストできないかな、と一瞬思ったが、思い出すと 1.9.1 とか、test-all が異常終了するのはちゃんとあるので、テストには困らないのであった。
JavaScript (ECMAScript) の仕様を調べていて知ったのだが、1.toString() とはできないのだな。
もちろん 1..toString() や (1).toString() はできる。
1..toString() が (1.).toString() という解釈になることが変に思える理由を考えてみると、これは類同の法則に反するからな気がする。
. という文字がふたつ並んでいるのは、同じ形がふたつ並んでいるということで、これが知覚的なまとまりを形成するのに、構文木はそのまとまりに反する構造になっている。
トークンは最長一致により分解される、という規則が知覚と衝突しているわけだ。
ここで類同の法則を字句解析に組み込んでしまうというのはどうだろうか。つまり、ソースは文字の並びで、それをトークンの並びに変換するのが字句解析だが、文字の並びを、まず同じ文字の連続の並びに変換し、それからトークンの並びに変換するのはどうだろうか。
1..toString() を同じ文字の連続に分割して、[1][..][t][o][S][t][r][i][n][g][(][)] というのを得て、これからさらにトークンの並びを取り出す。
このやりかたを広く適用できるか考えてみると... 文字列の中では伝統に反することが起きるな。"\ttttt" は (C の) 伝統としては \t と tttt に分割されるが、ttttt がひとまとまりとされると、そういう分割はできない。
もちろん、そういう伝統 (および多くのプログラマがが持っているであろうその知識) を気にせずに、新しいやりかたでいくというのであればありうるが。
Freely Distributable LIBM というものがあるようだ。
第25回出版UD研究会「カラーユニバーサルデザインの最新動向」に行ってみた。
女性に色弱が少ない理由と三毛猫がすべて雌な理由を始めて知った。
これは変だな。
% js -e 'print(new RegExp("\\\\/"))'
/\\//
いや、ECMAScript 3rd Edition としては問題ないのか?
[latest]