最新のもの: Gauche:Bugs
2006/04/08 22:07:06 PDT: 些細なことなんですが、 例えば(html:body)は
("<" body ">" "</" body "\n>")
でなく、
("<" body ">" "</" body ">\n")
となるべきではないでしょうか。
--- html-lite.scm.original 2006-04-09 13:55:14.000000000 +0900 +++ html-lite.scm 2006-04-09 13:47:12.000000000 +0900 @@ -126,7 +126,7 @@ (list "<" name attr " />"))) (lambda args (receive (attr args) (get-attr args '()) - (list "<" name attr ">" args "</" name "\n>")))))) + (list "<" name attr ">" args "</" name ">\n")))))) (define-macro (define-html-elements . elements) (define (make-scheme-name name)
び(2006/04/06 07:30:28 PDT): -d でディレクトリを作成する際、-o/-g/-mの指定が効きません。
Index: src/gauche-install.in =================================================================== RCS file: /cvsroot/gauche/Gauche/src/gauche-install.in,v retrieving revision 1.2 diff -u -r1.2 gauche-install.in --- src/gauche-install.in 17 Jul 2005 04:01:36 -0000 1.2 +++ src/gauche-install.in 6 Apr 2006 14:26:16 -0000 @@ -85,15 +85,26 @@ (newline (current-error-port)) (exit 1)) -(define (ensure-directory path) +(define (ensure-directory path . args) (if (file-exists? path) (unless (file-is-directory? path) (app-errorf "non-directory file gets in my way: ~s" path)) - (do-it #`"creating directory ,path" - (with-error-handler + (let-optionals* args ((mode #f) + (owner #f) + (group #f)) + (do-it #`"creating directory ,path" + (with-error-handler (lambda (e) (app-errorf "can't create directory: ~s" (ref e 'message))) - (lambda () (make-directory* path)))))) + (lambda () + (and (make-directory* path) + (begin + (when mode (sys-chmod path mode)) + (when (or owner group) + (sys-chown path + (->ugid sys-user-name->uid owner "user") + (->ugid sys-group-name->gid group "group"))))) + )))))) ;; user/group -> uid/gid (define (->ugid str->id arg type) @@ -155,7 +166,7 @@ (dry-run dry)) (when shebang (set! shebang #`"#!,shebang?n")) (cond - (mkdir (for-each ensure-directory args)) + (mkdir (for-each (cut ensure-directory <> mode owner group) args)) (target (for-each (lambda (src) (let1 dst (build-path target src) (ensure-directory (sys-dirname dst))
yokota(2006/04/01 14:56:26 JST): Gauche の標準漢字コードが EUC-JP から UTF-8 になったのに合わせて付属の日本語 info ドキュメントの文字コードが UTF-8 になりましたが、これが原因で問題が起こっています。
このため、現状ではドキュメントの処理に UTF-8 を用いるのは時期尚早かと思います。
Shiro(2006/04/01 14:00:19 PST): そっちで問題が出ましたか… utf-8に変更したのは、 新しいtexi2htmlのためなんです。こいつがutf-8を要求しますんで。 make時にそれぞれ変換かけるしかないかな。
yokota(2006/04/01 13:41:28 JST): 手元にある texi2html-1.76 では Makefile の通りに処理しても html 文章は utf-8 なのに文書の先頭部にある charset が us-ascii になってしまうので正しく表示できません。 これは texi2html に具体的な日本語サポートが無いために英語文書と見なして処理してしまうためです。処理時にその旨警告が出ます。
この場合は texi2html の Unicode サポートを無効にします。現状ではコマンドラインオプションからは無効にできないので、以下のようにします。
まず、以下のような初期設定ファイル "ja-init.pl" を作成します。
# -*- mode: perl -*- $USE_UNICODE = 0; # $ENCODING = "euc-jp"; 1;
更に texinfo ドキュメントの先頭に
@documentencoding euc-jp
を追加します。追加する代わりに上のファイルでコメントになっている部分のように初期設定ファイルで指定しても良いです。この状態で以下のようなコマンドを実行すると euc-jp の html ドキュメントが生成できます。
$ texi2html --init-file=ja-init.pl gauche-refj.texi
Shiro(2006/04/02 00:13:26 PST): 私の手元のtexi2htmlも1.76なんですが、--lang=ja をつけるとcharset=utf-8を出してくれてたうえにメッセージカタログも日本語に なります。コンパイルオプションの違いでしょうか。ただその場合、utf-8以外の エンコーディングにする方法がわからなかったのと、メッセージカタログ自体に 間違いがある ( http://practical-scheme.net/gauche/man/gauche-refj.html の 一番下の行を見てください) んでちょっと困ってました。
ja-init.plを用意する方法だとメッセージカタログは英語のままなんですよね? そっちの方がいいな。
yokota(2006/04/02 19:41:59 JST): はい、英語のままになります。 今気が付きましたが、上で述べた方法だと <body> タグの lang 属性が "en" のままになりますね。あまり良い方法では無かったかもしれません。
カタログファイルそのものは texinfo ドキュメントのあるディレクトリに "i18n/ja" というファイルを置いてそこに記述すればそちらを使ってくれるようです。カタログファイルの構造は texi2html のソースコードを参照して下さい。( http://download.savannah.gnu.org/releases/texi2html/ ) カタログファイルは上記以外にも幾つかの場所に置けるようです。
私が現在使用している物や上の URL で見つかる texi2html 1.76 は日本語のカタログを持っていません。Shiro さんの texi2html は改良版かもしれません。
Shiro(2006/04/07 06:23:52 PDT): ja-init.plを用意する方向で変更しました。 lang属性はhtmlを作った後にsedで書き換えています。
leque(2006/03/28 09:09:15 PST): reload の第二引き数でクラスを保護するように指定しても、クラスに再定義フラグが立ってしまいます。
;;; hoge.scm (define-module hoge (export-all)) (select-module hoge) (define-class <bar> () ()) (define-method foo ((x <bar>)) "foo") (provide "hoge")
% gosh -u hoge gosh> (foo (make <bar>)) "foo" gosh> <bar> #<class <bar>> gosh> (use gauche.reload) #<undef> gosh> (reload-verbose #t) #f gosh> (reload 'hoge '((hoge <bar>))) keeping value of <bar> #<undef> gosh> (foo (make <bar>)) *** ERROR: no applicable method for #<generic foo (1)> with arguments (#<<bar>:redefined 0x798b28>) Stack Trace: _______________________________________ gosh> <bar> #<class <bar> (redefined)>
び(2006/03/25 03:00:17 PST): バグじゃないですし、些末なことで恐縮ですが、変数dummyは不要なんじゃないかと思いました。
Index: ext/threads/threads.c =================================================================== RCS file: /cvsroot/gauche/Gauche/ext/threads/threads.c,v retrieving revision 1.9 diff -u -r1.9 threads.c --- ext/threads/threads.c 22 Jul 2005 09:26:55 -0000 1.9 +++ ext/threads/threads.c 25 Mar 2006 00:26:05 -0000 @@ -156,7 +156,7 @@ #ifdef GAUCHE_USE_PTHREADS int err_state = FALSE, err_create = FALSE; pthread_attr_t thattr; - sigset_t omask, dummy; + sigset_t omask; (void)SCM_INTERNAL_MUTEX_LOCK(vm->vmlock); if (vm->state != SCM_VM_NEW) { @@ -171,7 +171,7 @@ vm->state = SCM_VM_NEW; err_create = TRUE; } - pthread_sigmask(SIG_SETMASK, &omask, &dummy); + pthread_sigmask(SIG_SETMASK, &omask, NULL); pthread_attr_destroy(&thattr); } (void)SCM_INTERNAL_MUTEX_UNLOCK(vm->vmlock);
2006/03/18 05:43:34 PST
%gosh gosh> (use gauche.macroutil) #<undef> gosh> (xmac #t) *** ERROR: unbound variable: %macro-expand Stack Trace: _______________________________________ 0 (unwrap-syntax (%macro-expand #t)) [unknown location] 1 (unwrap-syntax (%macro-expand #t)) [unknown location] 2 (%macro-expand #t) [unknown location] gosh> (xmac1 #t) *** ERROR: unbound variable: %macro-expand-1 Stack Trace: _______________________________________ 0 (unwrap-syntax (%macro-expand-1 #t)) [unknown location] 1 (unwrap-syntax (%macro-expand-1 #t)) [unknown location] 2 (%macro-expand-1 #t) [unknown location]
--- macroutil.scm.org Sat Mar 18 22:04:33 2006 +++ macroutil.scm Sat Mar 18 22:04:46 2006 @@ -15,11 +15,11 @@ (define-syntax xmac (syntax-rules () ((_ ?form) - (unwrap-syntax (%macro-expand ?form))))) + (unwrap-syntax (%macroexpand ?form))))) (define-syntax xmac1 (syntax-rules () ((_ ?form) - (unwrap-syntax (%macro-expand-1 ?form))))) + (unwrap-syntax (%macroexpand-1 ?form))))) (provide "gauche/macroutil")
(2005/11/18 05:52:20 PST)
mingw(とmsys環境)でビルドしたものです。 WindowsMeとWindowsXPの両方で再現を確かめました。
$ gosh gauche-install.in -T /testdir/1/2/3 test.scm can't create directory: "stat failed for D:: ?xffA?xffN?xffZ?xffX?xff?xff?xff?xff?xffロ・xff?xff黷彌xff?xff?xff?xff?xffB?r?n"
C:?msys?1.0?local?bin>gosh.exe -u file.util -E "(make-directory* ?"C:/a/b?")" *** SYSTEM-ERROR: stat failed for C:: 指定されたファイルが見つかりません。 Stack Trace: _______________________________________ 0 (eq? (slot-ref (sys-stat path) 'type) 'directory) At line 53 of "C:??msys??1.0??local??share??gauche??0.8.6??lib/gauche/fileutil.scm" 1 (sys-stat path) At line 53 of "C:??msys??1.0??local??share??gauche??0.8.6??lib/gauche/fileutil.scm" 2 (make-directory* "C:/a/b") At line 1 of "(input string port)"
2006/03/05 01:50:54 PST時点でCVS HEADをmake/make checkすると、failしました。cut-sea
Testing object system ... failed. discrepancies found. Errors are: test method sorting: expects 1 => got 0
configureオプションはこれです。
cut-sea@nkisi> uname -rms NetBSD 2.0.2 i386 cut-sea@nkisi> gauche-config --reconfigure ./configure '--with-slib=/usr/pkg/share/slib' '--with-local=/usr/pkg' '--with-prefix=/usr/local' '--enable-ipv6' '--with-rpath=/usr/local/lib:/usr/pkg/lib:/usr/lib' '--with-iconv=/usr/pkg' '--enable-multibyte=euc-jp' '--enable-threads=pthreads'
% gauche-config --reconfigure ./configure '--enable-multibyte=utf-8' '--with-slib=/usr/pkg/share/slib' '--with-iconv=/usr/pkg' '--enable-threads=pthreads' '--host=i386--netbsdelf' '--prefix=/usr/local' '--infodir=/usr/local/info' '--with-rpath=/usr/local/lib:/usr/pkg/lib:/usr/lib' '--with-local=/usr/local:/usr/pkg' 'CC=cc' 'CFLAGS=-O2 -march=i686' 'host_alias=i386--netbsdelf' %
setenv LD_LIBRARY_PATH /home/cut-sea/devel/Gauche-0.8.7_pre1/src/lib:${LD_LIBRARY_PATH}として直下のものを見てたつもりだったのですが、完全に思い込みによる勘違いでした。
/home/cut-sea/devel/Gauche-0.8.7_pre1/src:${LD_LIBRARY_PATH}でないとダメじゃないか!ってことで、面目ないです。お騒がせしました。 ということは以前インストールした0.8.7_pre1の時にfailしてたのに 気付かずにインストールしてたってことですか。二重にショック。cut-sea:2006/03/06 01:32:20 PST
koguro(2006/03/04 20:11:25 PST): 0.8.7_pre1のGaucheで((('a 'b) 'c |...|))を評価するとAssertion failedとなります。
% gosh gosh> ((('a 'b) 'c |...|)) "intlib.c", line 1447 (intlib_cenv_lookup): Assertion failed: SCM_IDENTIFIERP(name)
Index: compile.scm =================================================================== RCS file: /cvsroot/gauche/Gauche/src/compile.scm,v retrieving revision 1.40 diff -c -r1.40 compile.scm *** compile.scm 22 Jan 2006 00:54:04 -0000 1.40 --- compile.scm 5 Mar 2006 07:38:10 -0000 *************** *** 1461,1466 **** --- 1461,1467 ---- (pair? (cddr expr)) (null? (cdddr expr)) (variable? (caddr expr)) + (symbol? (car expr)) ;; we check the heaviest one last. (and-let* ((var (cenv-lookup cenv (car expr) SYNTAX)) ( (identifier? var) )
び(2006/03/04 00:05:24 PST): この影響で、NetBSD上でマルチスレッド版Gaucheで組み込みクラスをdescribeするとコアダンプします。
% gosh gosh> (describe <string>) #<class <string>> is an instance of class <string-meta> slots: name : <string> cpl : (#<class <string>> #<class <sequence>> #<class <collection>> direct-supers: (#<class <sequence>>) accessors : () slots : () direct-slots: () num-instance-slots: 0 direct-subclasses: () direct-methods: () initargs : () defined-modules: () gosh: Error detected by libpthread: Invalid mutex. Detected by file "/usr/src/lib/libpthread/pthread_mutex.c", line 334, function "pthread_mutex_unlock". See pthread(3) for information. zsh: abort (core dumped) gosh % gosh gosh> (ref <string> 'redefined) gosh: Error detected by libpthread: Invalid mutex. Detected by file "/usr/src/lib/libpthread/pthread_mutex.c", line 334, function "pthread_mutex_unlock". See pthread(3) for information. zsh: abort (core dumped) gosh %
そもそも現状のGaucheでは組み込みクラスの再定義が許されているのは、カテゴリーがSCM_CLASS_SCHEMEだけのようなので、次のようにしてしまっていいのではないかと思います。(2006/03/04 01:00:41 PSTに説明とパッチを書き換えました)
Index: src/class.c =================================================================== RCS file: /cvsroot/gauche/Gauche/src/class.c,v retrieving revision 1.133 diff -u -r1.133 class.c --- src/class.c 9 Feb 2006 08:59:21 -0000 1.133 +++ src/class.c 4 Mar 2006 08:58:02 -0000 @@ -730,7 +730,8 @@ int abandoned = FALSE; /* If this class is being redefined by other thread, you should wait */ - (void)SCM_INTERNAL_MUTEX_LOCK(klass->mutex); + if (SCM_CLASS_CATEGORY(klass) == SCM_CLASS_SCHEME) + (void)SCM_INTERNAL_MUTEX_LOCK(klass->mutex); while (SCM_VMP(klass->redefined)) { if (SCM_VM(klass->redefined)->state == SCM_VM_TERMINATED) { /* TODO: this means redefinition of klass has been abandoned, @@ -739,11 +740,13 @@ abandoned = TRUE; klass->redefined = SCM_FALSE; } else { - (void)SCM_INTERNAL_COND_WAIT(klass->cv, klass->mutex); + if (SCM_CLASS_CATEGORY(klass) == SCM_CLASS_SCHEME) + (void)SCM_INTERNAL_COND_WAIT(klass->cv, klass->mutex); } } r = klass->redefined; - (void)SCM_INTERNAL_MUTEX_UNLOCK(klass->mutex); + if (SCM_CLASS_CATEGORY(klass) != SCM_CLASS_SCHEME) + (void)SCM_INTERNAL_MUTEX_UNLOCK(klass->mutex); if (abandoned) { Scm_Warn("redefinition of class %S has been abandoned", klass); } %
と思ったんですが、これだとmake check中、class redefinition (part 1)の途中で刺さりますね。うーむ。
Index: src/gauche.h =================================================================== RCS file: /cvsroot/gauche/Gauche/src/gauche.h,v retrieving revision 1.446 diff -u -r1.446 gauche.h --- src/gauche.h 27 Jan 2006 10:04:46 -0000 1.446 +++ src/gauche.h 4 Mar 2006 10:39:33 -0000 @@ -638,7 +638,9 @@ SCM_NIL, /*directMethods*/ ? SCM_NIL, /*initargs*/ ? SCM_NIL, /*modules*/ ? - SCM_FALSE /*redefined*/ ? + SCM_FALSE, /*redefined*/ ? + PTHREAD_MUTEX_INITIALIZER, /* mutex */ ? + PTHREAD_COND_INITIALIZER /* cv */ ? } /* Define built-in class statically -- full-featured version */
horii(2006/02/14 19:43:18 PST): katsujiro さんのページで見かけたのですが、以下ってバグではないでしょうか。 共に rest 引数があって必須引数の数が異なるときに、選択されるメソッドがメソッドの定義順によって変わったりします。
gosh> (define-method foo ((x <string>) . rest) 'foo-1) #<generic foo (1)> gosh> (define-method foo rest 'foo-2) #<generic foo (2)> gosh> (define-method bar rest 'bar-1) #<generic bar (1)> gosh> (define-method bar ((x <string>) . rest) 'bar-2) #<generic bar (2)> gosh> (foo "foo" "bar") foo-2 gosh> (bar "foo" "bar") bar-2
--- class.c.orig 2006-02-15 12:02:08.705318426 +0900 +++ class.c 2006-02-15 12:02:39.415030050 +0900 @@ -2052,6 +2052,11 @@ Scm_Panic("internal error: couldn't determine more specific method."); } } + if (SCM_PROCEDURE_REQUIRED(x) > SCM_PROCEDURE_REQUIRED(y)) { + return TRUE; + } else if (SCM_PROCEDURE_REQUIRED(x) < SCM_PROCEDURE_REQUIRED(y)) { + return FALSE; + } /* all specializers match. the one without optional arg is more special.*/ if (SCM_PROCEDURE_OPTIONAL(y)) return TRUE; else return FALSE;
Shiro(2006/02/17 12:02:52 PST): 長くなったので移動します→Gauche:対話環境での入出力
shibata (2006/01/26 07:33:37 PST) generate-sql/parametersの<dbi-unsupported-error>を発生させる箇所から sqlが見えてませんでした。
--- dbi.scm.orig 2006-01-27 00:26:36.000000000 +0900 +++ dbi.scm 2006-01-26 23:39:29.000000000 +0900 @@ -255,9 +255,9 @@ (call-with-output-string (lambda (p) (with-port-locking p - (cut generate-sql/parameters conn tokens args p))))))) + (cut generate-sql/parameters conn tokens args p sql))))))) -(define (generate-sql/parameters conn tokens args p) +(define (generate-sql/parameters conn tokens args p sql) (let loop ((tokens tokens) (args args) (delim #t))
koguro (2006/01/21 06:30:12 PST): gosh -ptimeでプロファイラをONにするとprocess-output->stringがちゃんと動作しないことがあります(以下のように空文字列が返ってくる)。ただし、条件が分からないのですがうまく動くときもあります。
% uname -a Darwin atropos.local 8.4.0 Darwin Kernel Version 8.4.0: Tue Jan 3 18:22:10 PST 2006; root:xnu-792.6.56.obj~1/RELEASE_PPC Power Macintosh powerpc % gosh gosh> (use gauche.process) #<undef> gosh> (process-output->string "ls") "AUTHORS COPYING ChangeLog" % gosh -ptime gosh> (use gauche.process) #<undef> gosh> (process-output->string "ls") ""
井上 (2006/01/20 22:09:42 PST)
jun@debian /dvl/gauche/current $ gosh gosh> (let-syntax ((macro (syntax-rules () ((_ . _) 'mismatch)))) (list (macro 0 1 2 . 3))) *** ERROR: Compile Error: proper list required for function application: (macro 0 1 2 . 3) "(stdin)":1:(let-syntax ((macro (syntax-rules () ... Stack Trace: _______________________________________ gosh> (let-syntax ((macro (syntax-rules () ((_ . _) 'mismatch)))) (macro 0 1 2 . 3)) mismatch
R5RS の記述を見る限りでは別に間違った動作ではないようですが、動作の一貫性の無さから不具合と判断しました。(2006/01/21 11:27:56 PST: link 張り間違えてました。失礼。)
shibata 2006/01/18 08:39:15 PST sql-tokenizeに巨大な文字列を渡すと正規表現のスタックが溢れてしまう?
gosh> (use text.sql) gosh> (sql-tokenize (format "~s" (make-string 12340 #?A))) *** ERROR: stack overrun during matching regexp #/^?"((?:[^?"]|?"?")*)?"/
バックトラックが発生するような正規表現を使う時はMAX_STACK_USAGEを超えないように 気を付ける必要があるんですかね.
正規表現を使わない方針でsql-tokenizeにパッチを当ててみたんですが, 文字列操作の効率が悪いんじゃないか不安です.
*** sql.scm.orig 2005-08-31 14:46:32.000000000 +0900 --- sql.scm 2006-01-19 00:58:25.000000000 +0900 *************** *** 166,184 **** ;; ;; subscanners ;; (define (scan-string s r) ! (cond ((#/^'((?:[^']|'')*)'/ s) => (lambda (m) ! (entry (m 'after) ! (cons `(string ,(regexp-replace-all #/''/ (m 1) "'")) r)))) (else (e "unterminated string literal in SQL: ~s" sql-string)))) (define (scan-delimited s r) ! (cond ((#/^?"((?:[^?"]|?"?")*)?"/ s) => (lambda (m) ! (entry (m 'after) ! (cons `(delimited ,(regexp-replace-all #/""/ (m 1) "?"")) r)))) (else (e "unterminated delimited identifier in SQL: ~s" sql-string)))) --- 166,198 ---- ;; ;; subscanners ;; + (define (tokenize-quote s demi) + (and + (eqv? (string-ref s 0) demi) + (let loop ((start 1)) + (let1 pos (string-index s demi start) + (cond ((and pos + (eqv? (string-ref s (+ pos 1) #f) + demi)) + (loop (+ pos 2))) + (else + (and pos + (cons (substring s 1 pos) + (substring/shared s (+ pos 1)))))))))) + (define (scan-string s r) ! (cond ((tokenize-quote s #?') => (lambda (m) ! (entry (cdr m) ! (cons `(string ,(regexp-replace-all #/''/ (car m) "'")) r)))) (else (e "unterminated string literal in SQL: ~s" sql-string)))) (define (scan-delimited s r) ! (cond ((tokenize-quote s #?") => (lambda (m) ! (entry (cdr m) ! (cons `(delimited ,(regexp-replace-all #/""/ (car m) "?"")) r)))) (else (e "unterminated delimited identifier in SQL: ~s" sql-string))))
(2006/01/16 04:34:09 PST) GaucheRefj:dbm-delete!では、値が存在しない場合は何もしないという事になってますが、qdbmでは、エラー例外を投げるようになっています(gdbmやfsdbmではエラー例外は投げないです)。 どこに書けばいいのか分からないので、ここに書きます……。
--- qdbm.scm.orig 2005-11-15 05:12:20.000000000 +0900 +++ qdbm.scm 2005-11-15 05:12:39.000000000 +0900 @@ -121,8 +121,7 @@ (define-method dbm-delete! ((self <qdbm>) key) (next-method) - (unless (qdbm-dpout (qdbm-file-of self) (%dbm-k2s self key)) - (errorf "dbm-delete!: deleteting key ~s from ~s failed" key self))) + (qdbm-dpout (qdbm-file-of self) (%dbm-k2s self key))) ;; ;; Iterations
それから、Gauche-0.8.6のdbm.scmに文言ミスがありました。
--- lib/dbm.scm.orig 2006-01-16 21:03:18.000000000 +0900 +++ lib/dbm.scm 2006-01-16 21:03:23.000000000 +0900 @@ -145,7 +145,7 @@ (define-method dbm-delete! ((dbm <dbm>) key) (when (dbm-closed? dbm) (errorf "dbm-delete!: dbm already closed: ~s" dbm)) (when (eqv? (slot-ref dbm 'rw-mode) :read) - (errorf "dbm-put!: dbm is read only: ~s" dbm))) + (errorf "dbm-delete!: dbm is read only: ~s" dbm))) (define-method dbm-fold ((dbm <dbm>) proc knil) #f)
び(2006/01/05 19:26:04 PST): 下記のコンパイラへのパッチを試していて気づきました。
Index: src/gauche.h =================================================================== RCS file: /cvsroot/gauche/Gauche/src/gauche.h,v retrieving revision 1.442 diff -u -r1.442 gauche.h --- src/gauche.h 13 Oct 2005 08:14:13 -0000 1.442 +++ src/gauche.h 6 Jan 2006 03:19:17 -0000 @@ -1262,7 +1262,7 @@ #define SCM_VECTOR_FOR_EACH(cnt, obj, vec) ? for (cnt = 0, obj = SCM_VECTOR_ELEMENT(vec, 0); ? cnt < SCM_VECTOR_SIZE(vec); ? - obj = SCM_VECTOR_ELEMENT(vec, ++cnt)) + (++cnt < SCM_VECTOR_SIZE(vec)) && (obj = SCM_VECTOR_ELEMENT(vec, cnt))) /*-------------------------------------------------------- * PORT
元のコードだと、elementsのひとつ後ろを参照してしまうため、SEGVを喰らうことがあります。具体的には、NetBSD 3.0 RELEASE上で、下記コンパイラパッチ+拙作NetBSDネイティブスレッドパッチを適用した状態で、make checkでtest/hash.scm実行中にSEGVを喰らいます。このパッチはチェックが二重に行うのがかなりいやな感じですが、うまい方法が思い浮かびませんでした。
--- gauche.h.orig 2006-01-06 13:53:17.078224931 +0900 +++ gauche.h 2006-01-06 13:57:46.035465811 +0900 @@ -1260,9 +1260,9 @@ ScmObj fill); #define SCM_VECTOR_FOR_EACH(cnt, obj, vec) ? - for (cnt = 0, obj = SCM_VECTOR_ELEMENT(vec, 0); ? - cnt < SCM_VECTOR_SIZE(vec); ? - obj = SCM_VECTOR_ELEMENT(vec, ++cnt)) + for (cnt = 0; ? + cnt < SCM_VECTOR_SIZE(vec) && (obj = SCM_VECTOR_ELEMENT(vec, cnt)); ? + cnt++) /*-------------------------------------------------------- * PORT
--- gauche.h.orig 2006-01-06 13:53:17.078224931 +0900 +++ gauche.h 2006-01-06 13:57:46.035465811 +0900 @@ -1260,9 +1260,9 @@ ScmObj fill); #define SCM_VECTOR_FOR_EACH(cnt, obj, vec) ? - for (cnt = 0, obj = SCM_VECTOR_ELEMENT(vec, 0); ? - cnt < SCM_VECTOR_SIZE(vec); ? - obj = SCM_VECTOR_ELEMENT(vec, ++cnt)) + for (cnt = 0; ? + cnt < SCM_VECTOR_SIZE(vec) && (obj = SCM_VECTOR_ELEMENT(vec, cnt), 1); ? + cnt++) /*-------------------------------------------------------- * PORT
2005/12/31 07:38:17 PST
2005/12/22 02:28:25 PST
最初のシーケンスの長さが他のシーケンスの長さより長いときに <vector> などにマップすると出力がおかしくなります.
gosh> (map-to <vector> + '(1 2 3) '(4 5)) #(5 7 #<undef>) gosh> (map-to-with-index <vector> + '(1 2 3) '(4 5)) #(5 8 #<undef>)
マニュアルを読む限り,バグだと思うので.
--- collection.scm.orig 2005-12-22 18:58:43.475640847 +0900 +++ collection.scm 2005-12-22 18:59:05.622545468 +0900 @@ -265,7 +265,7 @@ (do () ((end?) (get)) (add! (proc (next)))))) - (with-builder (class add! get :size (size-of coll)) + (with-builder (class add! get) (call-with-iterators (cons coll more) (lambda (ends? nexts)
--- sequence.scm.orig 2005-12-22 18:59:19.323630505 +0900 +++ sequence.scm 2005-12-22 19:01:55.252835586 +0900 @@ -169,7 +169,7 @@ (do ((i 0 (+ i 1))) ((end?) (get)) (add! (proc i (next)))))) - (with-builder (class add! get :size (size-of seq)) + (with-builder (class add! get) (call-with-iterators (cons seq more) (lambda (ends? nexts)
2005/12/21 03:13:15 PST
修正し忘れだと思いますが,->stream-char と write-stream で let-optionals* にアスタリスクがついてません.
--- stream.scm.orig 2005-12-21 19:46:06.376819422 +0900 +++ stream.scm 2005-12-21 19:47:09.128073356 +0900 @@ -633,7 +633,7 @@ (define (->stream-char obj . rest) (stream-delay - (let-optionals rest ((tail stream-null)) + (let-optionals* rest ((tail stream-null)) (cond ((string? obj) (string->stream obj tail)) ((or (number? obj) (boolean? obj) (symbol? obj)) (->stream-char (->string obj) tail)) @@ -657,7 +657,7 @@ (stream-map (lambda (c) (if (equal? c from) to c)) str)) (define (write-stream stream . rest) - (let-optionals rest ((port (current-output-port)) (writer write-char)) + (let-optionals* rest ((port (current-output-port)) (writer write-char)) (let loop ((s stream)) (unless (stream-null? s) (writer (stream-car s) port)
2005/12/20 04:11:44 PST
complement がないです.
gosh> (stream-remove odd? (stream 1 2 3)) *** ERROR: unbound variable: complement Stack Trace:
--- stream.scm.orig 2005-12-20 20:09:15.183441387 +0900 +++ stream.scm 2005-12-20 20:10:14.212204539 +0900 @@ -523,7 +523,7 @@ ;;; Filtering & Partitioning (define (stream-remove pred str) - (stream-filter (complement pred) str)) + (stream-filter (compose not pred) str)) ; The following version is faster than the current but has the problem of ; eagerly evaluating the streams rather than create them as they are
2005/12/19 00:12:18 PST
Top level でない関数三つを相互に呼び出させると、compile に失敗します。
$ cat (define (rename) (define (canonicalize func-name) (regexp-fold func-name )) (define (regexp-fold str) str) (define (map-ident str) (canonicalize str)) (let loop ()) ) jun@debian /dvl/uim/org/branches/r5rs/sigscheme $ gosh -V Gauche scheme interpreter, version 0.8.4 [utf-8,pthreads] jun@debian /dvl/uim/org/branches/r5rs/sigscheme $ gosh rename-functions.scm *** ERROR: Compile Error: [internal error] stray local variable: "./rename-functions.scm":1:(define (rename) (define (canonicali ... Stack Trace: _______________________________________
--- compile.scm 13 Aug 2005 06:51:52 -0000 1.33 +++ compile.scm 20 Dec 2005 09:38:44 -0000 @@ -2197,10 +2197,7 @@ ) ($let form 'rec lvars (map (lambda (lv init) - (let1 iexpr - (pass1 init (cenv-add-name newenv (lvar-name lv))) - (lvar-initval-set! lv iexpr) - iexpr)) + (pass1 init (cenv-add-name newenv (lvar-name lv)))) lvars expr) (pass1/body body '() newenv)))) (else
--- compile.scm 13 Aug 2005 06:51:52 -0000 1.33 +++ compile.scm 20 Dec 2005 10:42:42 -0000 @@ -2647,8 +2647,8 @@ (let loop ((lvars lvars) (inits inits) (rl '()) (ri '()) (rr '())) (cond ((null? lvars) (values (reverse rl) (reverse ri) (reverse rr))) - ((and (zero? (lvar-ref-count (car lvars))) - (zero? (lvar-set-count (car lvars)))) + ((and (<= (lvar-ref-count (car lvars)) 0) + (<= (lvar-set-count (car lvars)) 0)) ;; TODO: if we remove $LREF from inits, we have to decrement ;; refcount? (loop (cdr lvars) (cdr inits) rl riただ根本的な改善があり得ると思うので、もう少し粘ってみます。
--- compile.scm 2005-12-24 17:43:52.000000000 -0800 +++ compile.scm.mutilated 2005-12-24 17:46:40.000000000 -0800 @@ -2926,7 +2926,8 @@ ;; Directly inlinable case. NB: this only happens if the $LREF ;; node is the lvar's single reference, so we know the inlined ;; procedure is never called recursively. Thus we can safely - ;; travarse the inlined body without going into infinite loop. + ;; traverse the inlined body without going into infinite loop. + ($call-proc-set! iform result) (pass2/rec (expand-inlined-procedure ($*-src iform) result args) penv tail?)) (else
2005/12/17 21:10:41 PST
--- sql.orig.scm 2005-12-18 13:45:12.000000000 +0900 +++ sql.scm 2005-12-18 13:46:27.000000000 +0900 @@ -160,7 +160,7 @@ ((#/^?w+/ s) => (lambda (m) (entry (m 'after) - (cons (string->symbol (string-downcase (m))) r)))) + (cons (string->symbol (m)) r)))) (else (e "invalid SQL token beginning with ~s in: ~s" c sql-string))))))) ;;
大文字のテーブル名も小文字に変換されてしまってエラーになるので。 お願いします。
2005/12/14
$ diff -u modutil.texi.orig modutil.texi --- modutil.texi.orig 2005-12-14 19:39:01.543372191 +0900 +++ modutil.texi 2005-12-14 19:39:52.134326005 +0900 @@ -1961,7 +1961,7 @@ is passed to @var{proc}. This port is closed when @var{proc} returns. If this argument is omitted, the current output port is passed. @c JP -この引数は入力ポートかファイル名を示す文字列でなければなりません。 +この引数は出力ポートかファイル名を示す文字列でなければなりません。 出力ポートの場合、それはそのまま@var{proc}に渡されます。 文字列が渡された場合は、そのファイル名を持つファイルを出力用にオープンし、 そのポートが@var{proc}に渡されます (但し、@var{temporary-file}
a-san?(2005-12-01) http://www.shiro.dreamhost.com/scheme/gauche/man/gauche-refj_2.html#SEC2 IEでも、FireFoxでも同じです。 調べてみると、HTMLの先頭に文字コードを識別するための EF BB BF がありません。 おそらく、HTML作成後、テキストエディタで編集したため、誤って先頭の識別コードを 削ってしまったと思われます。 [snip]
gauche.vportのセクションでbyte-ready?手続きに言及していますが、byte-ready?の説明がどこにもないようです。
(2005/11/27 09:56:12 PST)
socket-input-portを:buffering :modestで取得し、通信先から少しだけデータを送り、 peek-byteで少し覗いてから、充分に大きい範囲に対してread-blockしようとすると、 bufferingを:modestにしていても、ブロックしてしまいます。 bufferingを:noneにするか、:modestでもpeek-byteしなければ、ブロックせずに、 予想した通りに動作します。
このパッチで、:modest時にpeekしても、予想通りに動作するようになったのを 確認しましたが、本当に正しく直せたか、他の部分に影響が無いか、自信が無いです。
--- src/port.c.orig 2005-11-28 01:23:09.000000000 +0900 +++ src/port.c 2005-11-28 02:59:31.000000000 +0900 @@ -574,6 +574,12 @@ dst += req; } while (siz > 0) { + if (nread && (p->src.buf.mode != SCM_PORT_BUFFER_FULL)) { + if (p->src.buf.ready + && p->src.buf.ready(p) == SCM_FD_WOULDBLOCK) { + break; + } + } req = MIN(siz, p->src.buf.size); r = bufport_fill(p, req, TRUE); if (r <= 0) break; /* EOF or an error*/ @@ -591,10 +597,6 @@ } if (p->src.buf.mode != SCM_PORT_BUFFER_FULL) { if (r < req) break; - if (p->src.buf.ready - && p->src.buf.ready(p) == SCM_FD_WOULDBLOCK) { - break; - } } } return nread;
2005/11/23 23:21:25 PST
util.relationのrelation-rowsが、exportされてなくて使えないようです。
(with-module util.relation (export relation-rows))
2005/11/20 06:48:13 PST
http://www.shiro.dreamhost.com/scheme/gauche/index-j.html
との事ですが…。
2005/11/18 02:14:11 PST
gosh> (use util.stream) #<undef> gosh> (stream->list (stream-iota 5)) (0 1 2 3 4) gosh> (stream-car (stream-filter even? (stream-iota 5))) 0 gosh> (stream->list (stream-filter even? (stream-iota 5))) *** ERROR: pair required, but got () [...]
gosh> (stream->list (stream-take (stream-filter even? (stream-iota 10)) 5)) (0 2 4 6 8) gosh> (stream->list (stream-take (stream-filter even? (stream-iota 10)) 6)) *** ERROR: pair required, but got () [...]
--- lib/util/stream.scm 23 Aug 2005 10:44:05 -0000 1.5 +++ lib/util/stream.scm 18 Nov 2005 10:35:12 -0000 @@ -172,11 +172,13 @@ (error "attempt to apply stream-filter to non-stream")) (else (stream-unfoldn (lambda (s) - (values - (stream-cdr s) - (cond ((stream-null? s) '()) - ((pred? (stream-car s)) (list (stream-car s))) - (else #f)))) + (cond + ((stream-null? s) + (values stream-null '())) + ((pred? (stream-car s)) + (values (stream-cdr s) (list (stream-car s)))) + (else + (values (stream-cdr s) #f)))) strm 1))))
2005/11/16 05:18:32 PST:
scmail の scbayes でデータベースの更新をしたら SEGV しました。scbayes の101,102行目のどちらかをコメントアウトすれば SEGV しません。バックトレースはこんな感じでした
(gdb) bt #0 get_string_from_body (b=0x855c5d8) at string.c:244 #1 0x4006c62e in Scm_PutsUnsafe (s=0x855c5d0, p=0x848a770) at portapi.c:202 #2 0x40068e72 in Scm_Puts (s=0x855c5d0, p=0x848a770) at portapi.c:220 #3 0x40064449 in string_print (obj=0x855c5d8, port=0x848a770, ctx=0x856e000) at string.c:1195 #4 0x40070df1 in write_general (obj=0x855c5d0, out=0x848a770, ctx=0xbfffe920) at write.c:274 #5 0x40071788 in write_ss_rec (obj=0x855c5d0, port=0x848a770, ctx=0xbfffe920) at write.c:536 #6 0x4007078e in Scm_Write (obj=0x855c5d0, p=0x0, mode=0) at write.c:166 #7 0x40098cc4 in stdlib_display (SCM_FP=0x855c5d0, SCM_ARGCNT=139911168, data_=0x0) at stdlib.c:3940 #8 0x4004de8f in run_loop () at vm.c:880 #9 0x4004fbfc in user_eval_inner (program=0x400f9960, codevec=0x8498440) at vm.c:2869 #10 0x08049ecd in main (argc=4, argv=0xbfffeeb4) at main.c:411
if (SCM_STRING_BODY_START(b)[size] == '?0') {です。SCM_START_BODY_START(b)[size]を参照して落ちてるみたいなのですが、これって確保した領域のひとつ後ろを見てたりしませんかね?
Index: src/string.c =================================================================== RCS file: /cvsroot/gauche/Gauche/src/string.c,v retrieving revision 1.75 diff -u -r1.75 string.c --- src/string.c 13 Oct 2005 08:14:13 -0000 1.75 +++ src/string.c 21 Nov 2005 10:51:32 -0000 @@ -241,7 +241,8 @@ static const char *get_string_from_body(const ScmStringBody *b) { int size = SCM_STRING_BODY_SIZE(b); - if (SCM_STRING_BODY_START(b)[size] == '?0') { + if ((!SCM_STRING_BODY_INCOMPLETE_P(b)) + && SCM_STRING_BODY_START(b)[size] == '?0') { /* we can use string data as C-string */ return SCM_STRING_BODY_START(b); } else {あるいは、ここに不完全文字列が渡ってくるのがおかしい? ちなみに、上記のような意味で「+1」していないのはread-blockの定義(src/extlib.stub: 969行目)だと思います。でも、ここを「+1」するのは意味的に正しいと思えません。
Index: src/extlib.stub =================================================================== RCS file: /cvsroot/gauche/Gauche/src/extlib.stub,v retrieving revision 1.256 diff -u -r1.256 extlib.stub --- src/extlib.stub 13 Oct 2005 08:14:13 -0000 1.256 +++ src/extlib.stub 24 Nov 2005 11:12:11 -0000 @@ -966,11 +966,12 @@ " char *buf; int nread; if (bytes < 0) Scm_Error(?"bytes must be non-negative integer: %d?", bytes); if (bytes == 0) SCM_RETURN(Scm_MakeString(?"?", 0, 0, 0)); - buf = SCM_NEW_ATOMIC2(char*, bytes); + buf = SCM_NEW_ATOMIC2(char*, bytes+1); nread = Scm_Getz(buf, bytes, port); if (nread <= 0) { SCM_RETURN(SCM_EOF); } else { + buf[nread] = '?0'; SCM_RETURN(Scm_MakeString(buf, nread, nread, SCM_MAKSTR_INCOMPLETE)); }")
2005/11/10 08:00:05 PST:
(/ (expt 10 10) 0)
を実行すると
WARNING: Signal queue overflow
をひたすら表示して暴走する。
--- number.c 13 Oct 2005 08:14:13 -0000 1.123 +++ number.c 10 Nov 2005 20:38:56 -0000 @@ -1210,9 +1210,20 @@ inexact number */ if (SCM_INTP(arg1)) { long rem; - ScmObj div = Scm_BignumDivSI(SCM_BIGNUM(arg0), - SCM_INT_VALUE(arg1), - &rem); + ScmObj div; + + if (SCM_EQ(arg1, SCM_MAKE_INT(0))) { + if (SCM_BIGNUM_SIGN(arg0) > 0) { + result_real = 1.0 / 0.0; /* +inf */ + } else { + result_real = -1.0 / 0.0; /* -inf */ + } + exact = FALSE; + goto DO_FLONUM; + } + div = Scm_BignumDivSI(SCM_BIGNUM(arg0), + SCM_INT_VALUE(arg1), + &rem); if (rem != 0) { result_real = Scm_BignumToDouble(SCM_BIGNUM(arg0)); exact = FALSE;
(2005/11/07 06:34:05 PST):
WindowsMe上で起動時にエラーメッセージが出て終了します。
Goshが原因で LIBGAUCHE.DLL にエラーが発生しました。Gosh は終了します。 問題が解決しない場合は、コンピュータを再起動してください。
WindowsMeではNetApiBufferFreeが使えませんので、getpwnamは常にNULLを返すように弄ってます。 それ以外はそのままconfigureとmakeしただけです。 configureにもmakeにもオプションはつけませんでした。 WindowsMeはWindowsの中で特に不安定で知られるものだけに、環境の問題なのかバグの顕在化なのかはわかりません。 printfをちりばめる原始的な確認ではScm_Init_scmlib関数の中のどこかで異常が起きているらしく思われます。 WindowsMe環境をお持ちの方は追試験して頂けたらと思います。 因みにここでエラー発生したバイナリをそのままWindowsXP上で動かすと正常に機能しているようです。 曖昧な情報で申し訳ないですが、WindowsMeユーザーは少ないと思われますのでまずは報告させて頂いた次第です。
(2005/11/02 03:59:13 PST):
(use gauche.net) (define s (make-client-socket (make <sockaddr-in> :host "127.0.0.1" :port 80))) (socket-close s) (port-closed? (socket-input-port s)) (read-line (socket-input-port s))
で、
"port.c", line 792 (file_flusher): Assertion failed: fd >= 0
でgoshが終了してしまいます。
read-blockしているところでは、それが失敗する可能性に対応する必要があると思います。read-blockの失敗でプログラムが終了してしまいまったので。
RCS file: /cvsroot/gauche/Gauche/lib/gauche/listener.scm,v retrieving revision 1.6 diff -u -r1.6 listener.scm --- lib/gauche/listener.scm 30 Jan 2004 20:20:27 -0000 1.6 +++ lib/gauche/listener.scm 2 Nov 2005 07:14:22 -0000 @@ -104,15 +104,18 @@ (listener-show-prompt self))) (set! (ref self 'rbuf) (port->string (current-input-port))))) (repl))))) - + (define (finalize) + (cond ((ref self 'finalizer) => (lambda (f) (f))))) + (lambda () - (let ((chunk (read-block 8192 (ref self 'input-port)))) + (and-let* ((chunk (guard (e ((<system-error> e) (finalize) #f)) + (read-block 8192 (ref self 'input-port))))) (if (eof-object? chunk) - (cond ((ref self 'finalizer) => (lambda (f) (f)))) - (begin - (update! (ref self 'rbuf) (cut string-append <> chunk)) - (string-incomplete->complete! (ref self 'rbuf)) - (with-error-to-port (ref self 'error-port) repl))))) + (finalize) + (begin + (update! (ref self 'rbuf) (cut string-append <> chunk)) + (string-incomplete->complete! (ref self 'rbuf)) + (with-error-to-port (ref self 'error-port) repl))))) ) ;; Check if the given string can be parsed as a complete sexp.