最新のもの: Gauche:Bugs
(2005/11/02 00:05:49 PST): non-greedy matching や assertion を含むパターンを regexp-compile できないみたいです。
gosh> (regexp-compile (regexp-parse "(?=a)")) *** ERROR: invalid regexp AST: (assert #\a) Stack Trace: _______________________________________ 0 (regexp-compile (regexp-parse "(?=a)")) At line 1 of "(stdin)" 1 (regexp-compile (regexp-parse "(?=a)")) At line 1 of "(stdin)"
--- regexp.c.orig Wed Nov 2 16:54:45 2005 +++ regexp.c Wed Nov 2 16:57:22 2005 @@ -1550,12 +1550,15 @@ } if (SCM_EQ(type, SCM_SYM_SEQ) || SCM_EQ(type, SCM_SYM_ALT) || SCM_EQ(type, SCM_SYM_SEQ_UNCASE) || SCM_EQ(type, SCM_SYM_SEQ_CASE) - || SCM_EQ(type, SCM_SYM_REP) || SCM_EQ(type, SCM_SYM_REP_WHILE)) { + || SCM_EQ(type, SCM_SYM_ASSERT) || SCM_EQ(type, SCM_SYM_NASSERT) + || SCM_EQ(type, SCM_SYM_REP) || SCM_EQ(type, SCM_SYM_REP_MIN) + || SCM_EQ(type, SCM_SYM_REP_WHILE)) { rest = rc_setup_context_seq(ctx, SCM_CDR(ast)); if (SCM_EQ(SCM_CDR(ast), rest)) return ast; else return Scm_Cons(type, rest); } - if (SCM_EQ(type, SCM_SYM_REP_BOUND)) { + if (SCM_EQ(type, SCM_SYM_REP_BOUND) + || SCM_EQ(type, SCM_SYM_REP_BOUND_MIN)) { if (!SCM_PAIRP(SCM_CDR(ast)) || !SCM_INTP(SCM_CADR(ast)) || SCM_INT_VALUE(SCM_CADR(ast)) < 0) { goto badast;
pg-getvalue は pq-getvalue だと思いますkatsujiro
nekoie (2005/10/30 04:10:27 PST) かなり以前の、with-error-handlerのエラーハンドラ内はエラー時の環境を引き継ぐようになった時からの不具合だと思います。 ついでなので、エラー画面にはスタックダンプも表示するようにしておきました(こっちの方は、セキュリティ的に微妙な問題が発生しないとは限らないですけど)。
(2005/10/28 02:32:34 PDT) #/(?:abc){2,5}/ のような正規表現の optimize に失敗しているみたいです。
gosh> #/(?:abc){2,5}/ "regexp.c", line 1256 (rc3_rec): Assertion failed: Scm_Length(ast) == 3 && SCM_INTP(SCM_CADR(ast)) gosh> (regexp-compile (regexp-parse "(?:abc){2,5}")) #<regexp 0x9ed70> gosh> (regexp-optimize (regexp-parse "(?:abc){2,5}")) (0 #\a #\b #\c #\a #\b #\c (rep-bound 3 #\a #\b #\c)) gosh> (regexp-compile (regexp-optimize (regexp-parse "(?:abc){2,5}"))) "regexp.c", line 1256 (rc3_rec): Assertion failed: Scm_Length(ast) == 3 && SCM_INTP(SCM_CADR(ast))
2005/10/28 02:15:14 PDT: regexp-compile に wb, nwb を含む抽象構文木を与えるとエラーになります。
gosh> (regexp-parse "\\b\\w+") (0 wb (seq #0=#[0-9A-Z_a-z] (rep #0#))) gosh> (regexp-compile (regexp-parse "\\b\\w+")) *** ERROR: invalid regexp AST: wb Stack Trace: _______________________________________ 0 (regexp-compile (regexp-parse "\\b\\w+")) At line 2 of "(stdin)" 1 (regexp-compile (regexp-parse "\\b\\w+")) At line 2 of "(stdin)" gosh> (regexp-compile '(0 nwb)) *** ERROR: invalid regexp AST: nwb Stack Trace: _______________________________________ 0 (regexp-compile '(0 nwb)) At line 3 of "(stdin)" 1 (regexp-compile '(0 nwb)) At line 3 of "(stdin)"
こんな感じでしょうか。
--- regexp.c.orig Fri Oct 28 18:07:56 2005 +++ regexp.c Fri Oct 28 18:09:41 2005 @@ -1527,6 +1527,7 @@ return ast; } if (SCM_EQ(ast, SCM_SYM_BOL) || SCM_EQ(ast, SCM_SYM_EOL) + || SCM_EQ(ast, SCM_SYM_WB) || SCM_EQ(ast, SCM_SYM_NWB) || SCM_EQ(ast, SCM_SYM_ANY)) { return ast; }
2005/10/24 04:43:52 PDT 小田と言います。
上記を利用しているdecompose-pathもこけます。
正確にいうと、incomplete文字列になる可能性があります。
仕様なのかな? でもWindowsでまじめに使おうと思うといろいろと弊害もあるので、以下のようなパッチを当ててみました。
EUCやutf-8のときに迷惑なのは重々承知しておりますので、条件コンパイルなどにしていただければ、と。
(2005/10/24 01:11:25 PDT)srfi-13のstring-prefix-lengthの返す結果が間違える場合があるみたいです。
gosh> (string-prefix-length "abc" "abcd") 3 gosh> (string-prefix-length "abcd" "abc") 4
たぶんlib/srfi-13/prefix.scmの%string-prefix-intのcond節2行目の
((eof-object? ch2) (action (string-pointer-index sp1) #f))
のsp1をsp2にすれば良いと思うのですが。
nekoie(2005/09/21 16:06:11 PDT) gauche/portutil.scmのport->stringの内部でread-charを使っているので、 マルチバイト文字を構成しないバイナリデータがあると、エラーになってしまう。 とりあえず、read-charをread-byteにして、動くのを確認しました。
--- portutil.scm.orig 2005-09-22 07:52:30.000000000 +0900 +++ portutil.scm 2005-09-22 07:54:30.000000000 +0900 @@ -47,10 +47,10 @@ (let ((out (open-output-string :private? #t))) (with-port-locking port (lambda () - (let loop ((ch (read-char port))) + (let loop ((ch (read-byte port))) (unless (eof-object? ch) - (write-char ch out) - (loop (read-char port)))) + (write-byte ch out) + (loop (read-byte port)))) (get-output-string out))))) (define (port->list reader port)
動作確認用一発S式(euc-jp用)。
(port->string (open-input-string #*"a\0a\xff\xfe\xfd"))
(with-port-locking port (lambda () (call-with-output-string (cute copy-port port <>)))もっともこれにしたところで、完全文字列で表現できるかどうかバッファを一回スキャンするはずなので、遅そうですけど。
Shiro(2005/09/20 22:02:15 PDT): soutaroさんのところより。 autoloadの定義時の環境と解決時の環境が異なっているせいだろう。 次のパッチでどうか。 kahua-dev:1050も 同根か。
--- src/load.c 25 Aug 2005 03:19:54 -0000 1.101 +++ src/load.c 21 Sep 2005 04:48:44 -0000 @@ -986,6 +986,8 @@ ScmObj Scm_LoadAutoload(ScmAutoload *adata) { int error = FALSE; + ScmModule *prev_module; + ScmVM *vm = Scm_VM(); /* check if some other thread already loaded this before attempt to lock */ if (adata->loaded) { @@ -997,14 +999,14 @@ do { if (adata->loaded) break; if (adata->locker == NULL) { - adata->locker = Scm_VM(); /* take me */ - } else if (adata->locker == Scm_VM()) { + adata->locker = vm; + } else if (adata->locker == vm) { /* bad circular dependency */ error = TRUE; } else if (adata->locker->state == SCM_VM_TERMINATED) { /* the loading thread have died prematurely. let's take over the task. */ - adata->locker = Scm_VM(); + adata->locker = vm; } else { (void)SCM_INTERNAL_COND_WAIT(adata->cv, adata->mutex); continue; @@ -1023,8 +1025,11 @@ adata->module, adata->name); } + prev_module = vm->module; SCM_UNWIND_PROTECT { + vm->module = adata->module; Scm_Require(SCM_OBJ(adata->path)); + vm->module = prev_module; if (adata->import_from) { /* autoloaded file defines import_from module. we need to @@ -1059,6 +1064,7 @@ } } SCM_WHEN_ERROR { adata->locker = NULL; + vm->module = prev_module; SCM_INTERNAL_COND_SIGNAL(adata->cv); SCM_NEXT_HANDLER; } SCM_END_PROTECT;
nobsun(2005/09/20 21:00:56 PDT): 隠し手続き? :-)
gosh> (integer? (/ (expt 3 33) 2)) #f gosh> (integer? (/ (expt 3 34) 2)) #t
び(2005/09/20 20:04:53 PDT): バグと言うより実装上の制限なのかな、という気もするんですが...
(2005/09/13 23:43:00 PDT): 先頭が~のファイルがいると、:add-path? #tでdirectory-list を呼んだとき error になる。
gosh> (touch-file "~hoge") gosh> (directory-list "./" :add-path? #t) *** ERROR: can't append absolute path after other path "~hoge" Stack Trace: _______________________________________ 0 (rec (cond ((string-null? base) component) ((string-null? componen ... At line 201 of "/usr/local/share/gauche/0.8.5/lib/file/util.scm" 1 (rec (cond ((string-null? base) component) ((string-null? componen ... At line 201 of "/usr/local/share/gauche/0.8.5/lib/file/util.scm" 2 (sys-normalize-pathname p) At line 200 of "/usr/local/share/gauche/0.8.5/lib/file/util.scm"
(define (relative-path? path) (cond-expand (gauche-windows (not (#/^[?/??]|^[A-Za-z]:/ path))) (else (not (#/^?// path)))))
(2005/09/11 16:32:17 PDT) はじめまして。 プラットホーム依存かもしれませんが、多分バグだと思うので報告しておきます。 src/wiliki/format.scmのコンパイルに失敗しました。
Testing formatter ... *** ERROR: Comp ile Error: Compile Error: wrong number of arguments: loop requires 3, but got 4 "../src/wiliki/format.scm":328:(define (fmt-lines generator) (defin ... "./format.scm":9:(use wiliki.format) Stack Trace: ______________________________________ *** Error code 70 Stop in /bsd/current/ports/www/wiliki/work/WiLiKi-0.5/test.
今のところ0.8.3で動かしています。0.8.4は未確認。
(2005/09/11 02:45:01 PDT) socket-statusの返すシンボルが、マニュアルでは小文字ですが、実際に返ってくるのは大文字です。
SOCKET の内部状態を、以下のシンボルのどれかで返します。 none 生成直後 bound `socket-bind' によって、あるアドレスに束縛されている listening `socket-listen' によって、接続をリッスンしている connected `socket-connect' あるいは `socket-accept' によって接続されている shutdown `socket-shutdown' によってシャットダウンされた closed `socket-close' によってクローズされた
実際には大文字のNONE, BOUND, LISTENING, CONNECTED, SHUTDOWN, CLOSEDが返ります。どちらかにあわせてもらうと助かります。
び(2005/09/10 16:00:02 PDT): いつの頃からかわかりませんが、モジュールからexportされていないシンボルが、モジュール外からも見えてしまっています。
% gosh gosh> (use www.cgi) #<undef> gosh> get-meta #<closure get-meta> gosh>
katsujiro(2005/09/09 06:57:56 PDT) 0.8.6pre2 CVS HEAD
string->dateを使うと unbound variable read-chと出ますので、多分、下のパッチで良いのではないかと。
*** srfi-19-lib.scm Fri Sep 2 10:57:19 2005 --- /usr/local/share/gauche/0.8.6_pre2/lib/srfi-19.scm Fri Sep 9 22:33:42 2005 *************** *** 1013,1020 **** (+ (* accum 10) (tm:char->int (read-char port))) (+ nchars 1))) (padding-ok ! (read-ch port) ; consume padding ! (accum-int prot accum (+ nchars 1))) (else ; padding where it shouldn't be (error "string->date: Non-numeric characters in integer read.")) ))) --- 1013,1020 ---- (+ (* accum 10) (tm:char->int (read-char port))) (+ nchars 1))) (padding-ok ! (read-char port) ; consume padding ! (accum-int port accum (+ nchars 1))) (else ; padding where it shouldn't be (error "string->date: Non-numeric characters in integer read.")) )))
当方ではこれをこのままCに変換せずに使って使えてます。
び(2005/09/07 20:21:50 PDT): mt-random-set-seed!にはu32vectorも渡せるのだから、(make <mersenne-twister> :seed ...)にもu32vectorを渡せていいんじゃないでしょうか。
Index: ext/mt-random/mt-random.c =================================================================== RCS file: /cvsroot/gauche/Gauche/ext/mt-random/mt-random.c,v retrieving revision 1.15 diff -u -r1.15 mt-random.c --- ext/mt-random/mt-random.c 22 Jul 2005 09:26:54 -0000 1.15 +++ ext/mt-random/mt-random.c 8 Sep 2005 03:13:09 -0000 @@ -277,8 +277,8 @@ ScmObj seed = Scm_GetKeyword(key_seed, initargs, SCM_FALSE); ScmMersenneTwister *mt; - if (!SCM_FALSEP(seed) && !SCM_EXACTP(seed)) { - Scm_Error("seed needs to be an exact integer, but got: %S", seed); + if (!SCM_FALSEP(seed) && !SCM_EXACTP(seed) && !SCM_U32VECTORP(seed)) { + Scm_Error("seed needs to be an exact integer or u32vector, but got: %S", seed); } mt = SCM_NEW(ScmMersenneTwister); @@ -286,6 +286,8 @@ mt->mti = N+1; if (SCM_EXACTP(seed)) { Scm_MTInitByUI(mt, Scm_GetUInteger(seed)); + } else if (SCM_U32VECTORP(seed)) { + Scm_MTInitByArray(mt, SCM_U32VECTOR_ELEMENTS(seed), SCM_U32VECTOR_SIZE(seed)); } return SCM_OBJ(mt); }
Testing net ... failed. discrepancies found. Errors are: test inet server socket: expects #t => got #<error "const C string or #f required, but got #f"> test inet client socket: expects ("ABC" "XYZ") => got #<error "connect failed to #<sockaddr inet ?"127.0.0.1:6726?">: Connection refused"> test inet client socket: expects #t => got #<error "connect failed to #<sockaddr inet ?"127.0.0.1:6726?">: Connection refused"> test inet client socket: expects #t => got #<error "connect failed to #<sockaddr inet6 ?"[::1]:6726?">: Connection refused"> test inet client socket: expects 33 => got #<error "connect failed to #<sockaddr inet ?"127.0.0.1:6726?">: Connection refused"> failed. discrepancies found. Errors are: test inet client socket: expects ("ABC" "XYZ") => got #<error "connect failed to #<sockaddr inet ?"127.0.0.1:6726?">: Connection refused"> test inet client socket: expects #t => got #<error "connect failed to #<sockaddr inet ?"127.0.0.1:6726?">: Connection refused"> test inet client socket: expects #t => got #<error "connect failed to #<sockaddr inet6 ?"[::1]:6726?">: Connection refused"> test inet client socket: expects 33 => got #<error "connect failed to #<sockaddr inet ?"127.0.0.1:6726?">: Connection refused">
1.29ではこの問題は起こりません。何となくgenstubの問題(maybe:<const-cstring>の展開がおかしい)のような気もします。Mac OS X 10.4.2で確認しました。
define-cclassでslot指定をするときに、gauche/class.hがないとincomplete typeとかでおこられます。ねるWiki:ねる (2005/08/03 00:31:06 PDT)
マニュアルでは、object-isomorphic?を特定化することにより、ユーザ定義のクラスに対してisomorph?の動作をカスタマイズできるということになっていますが、これが動作しません。util.isomorphの中で、object-isomorphic?が(ジェネリック関数ではなく)手続きとして定義されているのがとりあえずの原因です。(2005/08/02 05:08:31 PDT)
(define (match str) (rxmatch-case str (#/?((.*)?)/ (match) (print match))))
というパターンで、
(match "(xxx)") -> (xxx)
とマッチ。サブマッチで要求してるのは括弧の内側だけだから変ですよね。 Kitani 2005/06/24 13:13:11 PDT
あら、バックスラッシュが出ない。。外側は()のリテラルです。
以降の変数にサブマッチをbindします。サブマッチが欲しければ
(rxmatch-case str ($/?((.*)?)/ (#f sub) (print sub)))
のようにして下さい。
0.8.3と0.8.4でdefineの挙動が少し変わったようです。具体的には下記のコードを実行したとき、
(define (test1) (define l (list 1 2 3)) (define firstl (car l)) (print firstl)) (test1)
0.8.4では次のようなエラーになりますが、0.8.3では「1」と表示されます。
*** ERROR: pair required, but got #<undef> Stack Trace: _______________________________________ 0 l
ふじさわ 2005/06/23 17:28:19 PDT
(define (test2) (define firstl (car l)) (define l (list 1 2 3)) (print firstl)) (test2)や
(define (test3) (define l '(1 2 3)) (define firstl (car l)) (print firstl)) (test3)で 1 が表示されるのもホントはまずい…ということでいいんですよね(^^;). 『Scheme:内部defineの評価順』をざっと読んでの解釈なのですが….
うっかりミスで書いてしまうというようなものではないので、 厳密なエラー検出を実装する優先度はかなり低いです。
i686-pc-cygwin の環境で ssax:xml->sxml を繰り返すとメモリ使用量がどんどん増えていってしまいます。 i686-pc-linux-gnu では発生しません。(2005/06/20 04:43:13 PDT)
(use sxml.ssax) (let loop () (call-with-input-file "適当なXMLファイル.xml" (cut ssax:xml->sxml <> '())) (loop))
gosh> (if #f (/ 1 0) #t) *** ERROR: Compile Error: divide by zero "(stdin)":2:(if #f (/ 1 0) #t) Stack Trace: _______________________________________ gosh> (and #f (/ 1 0)) *** ERROR: Compile Error: divide by zero "(stdin)":1:(and #f (/ 1 0)) Stack Trace: _______________________________________ gosh> (or 1 2 3 (/ 1 0)) *** ERROR: Compile Error: divide by zero "(stdin)":1:(or 1 2 3 (/ 1 0)) Stack Trace: _______________________________________
これって先走り過ぎ?cut-sea:2005/06/15 06:11:19 PDT
ちなみにgosh -fno-inlineだとOK.cut-sea:2005/06/15 07:04:43 PDT
基本的には全部そうなんかな。cut-sea
gosh> (or 1 2 3 (apply / '(1 0))) 1 gosh> (or 1 2 3 (apply / '(1 0))) 1 gosh> (if #f (apply / '(1 0)) #t) #t gosh> (and #f (apply / '(1 0))) #f gosh> (apply / '(1 0)) *** ERROR: divide by zero Stack Trace: _______________________________________ 0 (apply / '(1 0)) At line 13 of "(stdin)" 1 (apply / '(1 0)) At line 13 of "(stdin)" 2 /確かにコンパイルerrorであって実行時errorではないですね。 失礼。cut-sea:2005/06/15 18:04:43 PDT
うげげげ、
gosh> (- (/ 1 2)) 0.5 gosh> (- 0 (/ 1 2)) -0.5 gosh> (- (- 1)) -1 gosh> (- (- 0 1)) -1 gosh> (- (- (- 1))) -1 gosh> (- (- (- (- 1)))) -1 gosh> (- 0 (- (- 1))) 1
単項マイナスがへんです。0.8.4, CVS 版でMacOS 10.4.1 と NetBSD-1.6.1 の両方で発生。 割り算は OK っぽい。
Shiro (2005/06/15 23:52:46 PDT): うわ痛てぇ。近いうちに修正版を0.8.5として リリースします。パッチはこれで。
diff -u -r1.30 compile.scm --- compile.scm 8 Jun 2005 17:21:33 -0000 1.30 +++ compile.scm 16 Jun 2005 06:13:49 -0000 @@ -4019,7 +4019,7 @@ ((x) (receive (num tree) (check-numeric-constant x cenv) (if num - (or tree ($const (- num))) + ($const (- num)) ($asm form `(,NEGATE) (list tree))))) ((x y . more) (receive (xval xtree) (check-numeric-constant x cenv)
origformがないっておこられました ねるWiki:ねる
Index: compile.scm =================================================================== RCS file: /cvsroot/gauche/Gauche/src/compile.scm,v retrieving revision 1.28 diff -u -r1.28 compile.scm --- compile.scm 2 Jun 2005 09:43:21 -0000 1.28 +++ compile.scm 6 Jun 2005 07:34:51 -0000 @@ -1633,7 +1633,7 @@ oform flags module cenv)) ((_ name expr) (unless (variable? name) - (error "syntax-error:" origform)) + (error "syntax-error:" oform)) (let1 cenv (cenv-add-name cenv (variable-name name)) ($define oform flags (make-identifier (unwrap-syntax name) module '()) @@ -1666,7 +1666,7 @@ ($const-undef))) ((_ name expr) (unless (variable? name) - (error "syntax-error:" origform)) + (error "syntax-error:" oform)) ;; TODO: macro autoload (let1 trans (make-macro-transformer name (eval expr module)) (%insert-binding module name trans)
Perl式のlookahead assertionについてマニュアルに記述がないようです。(2005/06/01 19:58:57 PDT)
Shiro(2005/06/01 20:09:21 PDT): 間に合いませんでした。
(use srfi-19) (make <time> :type 'time-duration :second 0 :nanosecond 1000000000))
上記のコードで、goshが"*** ERROR: Error occurred in error handler"と出力し終了してしまいます。[2005/06/01 08:19:06 PDT]
Shiro(2005/06/01 11:40:36 PDT):
--- src/system.c 24 May 2005 23:28:38 -0000 1.63 +++ src/system.c 1 Jun 2005 18:38:05 -0000 @@ -616,7 +616,7 @@ Scm_Error("real number required, but got %S", val); } if ((l = Scm_GetInteger(val)) >= 1000000000) { - Scm_Error("nanoseconds out of range: %l", l); + Scm_Error("nanoseconds out of range: %ld", l); } t->nsec = l;
ces変換portの仕様変更で、 変換portをcloseするまでは全部書き込まれなくなった為に、 永続的なプロセス内でcgi-mainを使うと、 cgi-output-character-encodingが動かなくなっている気がします。
--- lib/www/cgi.scm.orig 2005-01-26 02:09:37.000000000 +0900 +++ lib/www/cgi.scm 2005-01-26 02:15:13.000000000 +0900 @@ -389,8 +389,10 @@ (html:p (html-escape-string (slot-ref e 'message))))))) (define (cgi-default-output tree) - (write-tree tree (wrap-with-output-conversion - (current-output-port) - (cgi-output-character-encoding)))) + (with-output-conversion + (current-output-port) + (lambda () + (write-tree tree)) + :encoding (cgi-output-character-encoding))) (provide "www/cgi")
とすると、動くようになった気がします。
nekoie: 以下を実行すると、二回目の(uname)のprocess-output->stringの中のsys-waitpidで、正常に子プロセスのpidが取得できずに、以下のエラーになります。(2005/01/07 16:17:34 PST)
*** SYSTEM-ERROR: waitpid() failed: No child processes
一回目の(uname)は正常に動作します。
(use gauche.process) (define (uname) (with-signal-handlers () (lambda () (process-output->string-list "/usr/bin/uname")))) (uname) (uname)
以下の二つの環境でエラーになるのを確認しました。
./configure '--enable-multibyte=euc-jp' '--enable-threads=pthreads' '--without-iconv' 'CFLAGS=-Os -march=i686'
./configure '--enable-multibyte=euc-jp' '--enable-threads=pthreads' '--disable-ipv6' '--without-iconv' 'CFLAGS=-O2 -march=pentium4'以下の環境では二回目以降も問題無く、正常に動作しました。
Shiro(2005/05/11 02:57:56 PDT): waitpidを呼ぶ前に子プロセスのステータスが 回収されてしまっているようです。SIGCHLDのハンドラがSIG_IGNに設定されていると、 子プロセスのステータスをカーネルが勝手に回収してしまうのでこういう 症状が出ることが考えられます。Gauche本体ではSIGCHLDには触ってない はずなんですが、もしかしてシェルか何かからSIG_IGNが継承されちゃってる なんてことはあるんでしょうか。
Shiro(2005/06/01 03:18:43 PDT): これはむしろ、process-output->string-list等の 関数内でSIGCHLDを設定すべき? でもmultithreadな環境ではそれもやばいな。
Shiro(2005/06/30 12:41:50 PDT): 直ったかな (signal.c,v 1.32)