Gauche:Bugs:log11

Gauche:Bugs:log11


SLIBのrequireメカニズム変更(3a5以降)への追随 (0.8.12)

flatline 2008/02/10 11:46:53 PST : 最新版のSLIBが動かない.CVS headから対処済みのslib.scm.inを取ってきてコンパイルすればよい.

もしくはインストール済みのslib.scmにおいて, require:{require,provide,provided?} という関数3つに対しプレフィクスを require: から slib: に置換.

マニュアルの typo (0.8.12)

tabe(2008/02/07 18:52:46 PST): 名前の typo です。

Index: doc/modutil.texi
===================================================================
RCS file: /cvsroot/gauche/Gauche/doc/modutil.texi,v
retrieving revision 1.136
diff -u -r1.136 modutil.texi
--- doc/modutil.texi    19 Dec 2007 07:43:36 -0000      1.136
+++ doc/modutil.texi    8 Feb 2008 02:48:21 -0000
@@ -12934,15 +12934,15 @@
 @c EN
 This module implements the algorithm to find the longest common subsequence
 of two given sequences.  The implemented algorithm is based on
-Eugene Meyers' O(ND) algorithm (@ref{meyers86,[Meyers86],Meyers86}).
+Eugene Myers' O(ND) algorithm (@ref{myers86,[Myers86],Myers86}).

 One of the applications of this algorithm is to calculate
 the difference of two text streams;
 see @ref{Calculate difference of text streams}.
 @c JP
 このモジュールは、与えられた2つのシーケンスの最長共通サブシーケンスを見つける
-アルゴリズムを実装しています。アルゴリズムは、Eugene Meyersの
-O(ND)アルゴリズムに基づいています(@ref{meyers86,[Meyers86],Meyers86})。
+アルゴリズムを実装しています。アルゴリズムは、Eugene Myersの
+O(ND)アルゴリズムに基づいています(@ref{myers86,[Myers86],Myers86})。

 このアルゴリズムを使うアプリケーションの1つは、2つのテキストストリームの
 相違点を計算する@ref{Calculate difference of text streams}です。
Index: doc/references.texi
===================================================================
RCS file: /cvsroot/gauche/Gauche/doc/references.texi,v
retrieving revision 1.4
diff -u -r1.4 references.texi
--- doc/references.texi 8 Dec 2007 03:24:30 -0000       1.4
+++ doc/references.texi 8 Feb 2008 02:48:21 -0000
@@ -17,8 +17,8 @@
 Representing control in the presence of one-shot continuations,
 in @i{Proceedings of SIGPLAN '96}, pp. 99--107, 1996.

-@anchor{meyers86}
-@item [Meyers86]
+@anchor{myers86}
+@item [Myers86]
 Eugene Myers,
 An O(ND) Difference Algorithm and Its Variations,
 @i{Algorithmica} Vol. 1 No. 2, pp. 251-266, 1986.

copy-fileのキーワード引数の扱い(0.8.12)

yuyam(2008/02/01 06:46:34 PST): 勘違いしていたらすみません。 リファレンスを読むと、keep-modeが偽の場合(デフォルト)は、コピー先が既に存在して safe引数が偽の場合にコピー先のもとのパーミッションが保持されるとあるのですが、この場合でもdefaultpermを設定しようとしているように思います。

http://practical-scheme.net/gauche/man/gauche-refj_128.html#IDX2624

define-syntaxの中でwith-moduleを使うとうまく参照できないことがある (0.8.12)

koguro(2008/01/15 07:14:47 PST): 以下の例のようにdefine-syntaxの中でwith-moduleを使った場合、barではモジュールfooのシンボルaを参照できますが、bazでは参照できません(どうもuserモジュールのシンボルaを参照しようとしているみたいです)。

gosh> (define-module foo)
#<undef>
gosh> (select-module foo)
#<undef>
gosh> (define a 1)
a
gosh> (select-module user)
#<undef>
gosh> (define-syntax bar
  (syntax-rules ()
    ((_ v)
     (with-module foo v))))
#<undef>
gosh> (bar a)
1
gosh> (define-syntax baz
  (syntax-rules ()
    ((_)
     (with-module foo a))))
#<undef>
gosh> (baz)
*** ERROR: unbound variable: a
Stack Trace:
_______________________________________
gosh> 

Shiro(2008/02/02 02:11:24 PST): ですね。hygieneとwith-moduleのインタラクションを ちゃんと考えてないっぽいです。

これは結構厄介だなあ。もっと考えないとまずそうです。 保留ということで (以後はsourceforgeのtrackerで)

http-get などで Host ヘッダにポート番号が渡らない (0.8.12)

tabe(2007/12/06 10:10:18 PST): 最初の引数に80以外のポート番号を指定

gosh> (http-get "localhost:8000" "/")

しても、リクエストが

GET / HTTP/1.1
Host: localhost

になります。

case-folding な正規表現の書き出し (0.8.12)

tabe(2007/11/19 19:07:43 PST): write すると i が落ちます。

gosh> #/abc/i
#/abc/

パッチ:

--- src/regexp.c.orig   2007-08-26 17:16:04.000000000 +0900
+++ src/regexp.c        2007-11-20 11:41:58.000000000 +0900
@@ -238,7 +238,7 @@ static ScmRegexp *make_regexp(void)
 static void regexp_print(ScmObj rx, ScmPort *out, ScmWriteContext *ctx)
 {
     if (SCM_REGEXP(rx)->pattern) {
-        Scm_Printf(out, "#/%A/", SCM_REGEXP(rx)->pattern);
+        Scm_Printf(out, (SCM_REGEXP(rx)->flags&SCM_REGEXP_CASE_FOLD) ? "#/%A/i" : "#/%A/", SCM_REGEXP(rx)->pattern);
     } else {
         /* fail safe */
         Scm_Printf(out, "#<regexp %p>", rx);

cygwinでdefine-cclassを使うとコンパイルエラー (0.8.12)

koguro(2007/11/11 04:02:45 PST): cygwin環境で以下のようなstubを作ってコンパイルしようとすると "initializer element is not constant" のエラーが発生します。どうもSCM_CLASS_DEFAULT_CPLが定数でないため発生しているようです(Gauche:Windows/VC++の「DLLとタイプタグ」に書いてあるようなことが原因かと思います)。なお、cpaの内容を明示的に指定("Scm_TopClass"など)すればエラーは回避できました。

(define-cclass <foo> :built-in
  "ScmFooType*" "Scm_FooTypeClass"
  ()
  ())

空の環境飛ばしちゃう問題 (CVS HEAD)

(2007/11/08 19:43:17 PST): 手許に残っていた唯一のunofficial patch を見て、何じゃこりゃ、と思ったので蒸し返しておきます。

でも多分まだ対応はされてないですよね。

gauche.parseopt の `f' の扱い(0.8.11)

leque(2007/09/30 06:14:11 PDT): gauche.parseopt のドキュメントには、 parse-options や let-args の option-spec では、`f' は引き数の型が「実数 (flonum)」であることを表すとありますが、有理数 (ratnum)を渡してもエラーになりません(有理数∈実数なので問題というほどではないのですが)。

http://practical-scheme.net/gauche/man/gauche-refj_87.html#SEC248

(use gauche.parseopt)

(let-args '("-scale" "2/3")
    ((scale "scale=f"))
  (print scale))                        ; =| 2/3
--- parseopt.scm.orig   2007-08-24 02:22:50.468750000 +0900
+++ parseopt.scm        2007-09-30 21:49:53.046875000 +0900
@@ -100,7 +100,8 @@
                 (ref optspec 'name) arg)))
   (define (get-real arg)
     (or (and-let* ((num (string->number arg))
-                   ((real? num)))
+                   ((real? num))
+                  ((= (denominator num) 1)))
           num)
         (errorf "a real number is required for option ~a, but got ~a"
                 (ref optspec 'name) arg)))

run-processでの"-i"の展開(0.8.11)

初学者(2007/09/11 08:31:06 PDT):最近scheme始めたばかりなので、勘違いをしてたら申し訳ありません。

gosh> (use gauche.process)
#<undef>
gosh> (run-process '(ls -i) :wait #t)
ls: cannot access 0.0-1.0i: そのようなファイルやディレクトリはありません
#<process 7071 "ls" inactive>
gosh> (run-process "ls" "-i" :wait #t)
12095895 hoge
#<process 7072 "ls" inactive>

実行するコマンドに"-i"を指定すると"0.0-1.0i"に展開されてしまいます。(以前の記法だとうまくいきます。)
ls 以外のコマンドでも同様でした。

ソケットポートのバッファリングモード

Shiro(2007/08/26 12:59:54 PDT): socket portのバッファリングモードが強制的に:fullに なってしまうバグがありました。ネットワークアプリケーションの多くは:lineか :noneでないと正常に動作しないと思います。 (悪いことに、:buffering引数を指定しても上書きできません)。 以下のパッチを適用してください。

--- ext/net/netlib.stub 10 Aug 2007 01:19:36 -0000      1.49
+++ ext/net/netlib.stub 26 Aug 2007 19:25:39 -0000
@@ -176,7 +176,7 @@
                                  &keyword (buffering #f) (buffered? #f))
   (body <top>
         (let* ((bufmode :: int))
-          (cond ((SCM_FALSEP buffered?) ;for backward compatibility
+          (cond ((not (SCM_FALSEP buffered?)) ;for backward compatibility
                  (set! bufmode SCM_PORT_BUFFER_FULL))
                 (else
                  (set! bufmode (Scm_BufferingMode buffering
@@ -188,7 +188,7 @@
                                   &keyword (buffering #f) (buffered? #f))
   (body <top>
         (let* ((bufmode :: int))
-          (cond ((SCM_FALSEP buffered?) ;for backward compatibility
+          (cond ((not (SCM_FALSEP buffered?)) ;for backward compatibility
                  (set! bufmode SCM_PORT_BUFFER_FULL))
                 (else
                  (set! bufmode (Scm_BufferingMode buffering

make check で gettext が fail (cygwin w/sjis encoding)

isi(2007/08/26 07:00:05 PDT): 以前からだと思いますが、make checkでgettextがfailします。
内部文字エンコーディングをsjisでビルドしたcygwin上のGaucheです。

failed.
discrepancies found.  Errors are:
test get-en: "Menu|File|Quit": expects "Quit" => got "Menu|File|Quit"
test gettext-en: "Menu|File|Quit": expects "Quit" => got "Menu|File|Quit"
test dcgettext-en: "Menu|File|Quit": expects "Quit" => got "Menu|File|Quit"
test get-en: "Menu|File|Quit": expects "Quit" => got "Menu|File|Quit"
test gettext-en: "Menu|File|Quit": expects "Quit" => got "Menu|File|Quit"
test dcgettext-en: "Menu|File|Quit": expects "Quit" => got "Menu|File|Quit"

このとき test.po と motest.mo に関するワーニングが複数行出力されます。

WARNING: error reading from file "../test/data/locale/en/LC_MESSAGES/test.po": #<error "invalid character sequence in  ...">
WARNING: error reading from file "../test/data/locale/en/LC_MESSAGES/motest.mo": #<error "invalid character sequence in  ...">

原因はcygwinのiconvにあり(下記参照)、また多分にこのようなマイナーな状況下でしか発生しないと思われ、自分も特に困っている訳ではなく、どうしようかとも思ったのですが、make check での fail だし newcommer には優しいだろうとのことで、報告することにしました。

$ iconv --version
iconv (GNU libiconv 1.11)
Copyright (C) 2000-2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Bruno Haible.

$ echo "\\"| iconv -f ascii -t sjis
iconv: (stdin):1:0: cannot convert

$ echo "\\"| iconv -f ascii -t cp932
\

$ gosh
gosh> (use gauche.charconv)
#<undef>
gosh> (ces-convert "\\" "ascii" "sjis")
*** ERROR: invalid character sequence in the input stream: #*"\\" ...
Stack Trace:
_______________________________________
  0  (read-byte src)
        At line 131 of "/usr/local/share/gauche/0.8.10/lib/gauche/portutil.scm"
gosh> (ces-convert "\\" "ascii" "cp932")
"\\"
gosh>

cp932だとOK。手元のDebianではsjisもOKだった。

$ iconv --version
iconv (GNU libc) 2.3.2
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
これはフリーソフトウェアです。利用許諾についてはソースをご覧ください。
商業性や特定の目的への適合性の如何に関わらず、無保証です。
Ulrich Drepperによる書き込み.

$ echo "\\"| iconv -f ascii -t sjis
\

$

cygwinのiconvがDebianのiconvと同じような仕様になればよいのだけれど...
gauche.charconvでiconvを呼ぶときにsjisだったらcp932に変えてしまう手はどうかな...

Shiro(2007/08/29 19:32:47 PDT): なるほど。Gaucheにとって未知のエンコーディングXとsjis間の 変換だとGauche自前のsjisテーブルは使われないわけですね。それだと「変換テーブル の非互換性を避けたい」という最初の目的が果たされないわけだ。

gauche.charconvのレイヤでエンコーディング名のエイリアスを設定できるように するのは可能なので、「Gauche界でのsjisはcp932のaliasです」と してしまう手も無くは無いですね。

変換テーブルのコンパチビリティを重視するなら、sjis <-> X の変換が要求された 場合はunicodeをピボットとした2段変換 sjis <-> utf-8 <-> X として、 utf-8 <-> X にiconvを、sjis <-> utf-8 に内部テーブルを使う、という手も あります。2度手間のようですが、iconv実装もUnicodeをピボットにして変換している はずなので、変換テーブルのルックアップ回数だけ見ればそれほど無駄なことを しているわけではないんじゃないかと (2種のAPIが呼ばれるオーバヘッドは確かに ありますが)。

Shiro(2007/10/29 01:41:36 PDT): 0.8.12には間に合わないので持ち越します (以降はSourceforgeのbug tracker参照)。

some typo

enami (2007/08/16 22:17:24 PDT): typo です。0.8.11には間に合わないかな?

Index: ext/net/net.scm
===================================================================
RCS file: /cvsroot/gauche/Gauche/ext/net/net.scm,v
retrieving revision 1.40
diff -u -0 -r1.40 net.scm
--- ext/net/net.scm     16 Mar 2007 02:21:37 -0000      1.40
+++ ext/net/net.scm     17 Aug 2007 03:56:48 -0000
@@ -78 +78 @@
-;; if ipv6 is supported, these symbols are defiend in the C routine.
+;; if ipv6 is supported, these symbols are defined in the C routine.
Index: ext/net/gauche/net.h
===================================================================
RCS file: /cvsroot/gauche/Gauche/ext/net/gauche/net.h,v
retrieving revision 1.8
diff -u -0 -r1.8 net.h
--- ext/net/gauche/net.h        22 Mar 2007 11:20:22 -0000      1.8
+++ ext/net/gauche/net.h        17 Aug 2007 03:56:48 -0000
@@ -80 +80 @@
-/* Alternative implemenation in case the system doesn't provide
+/* Alternative implementation in case the system doesn't provide
Index: lib/gauche/cgen/cise.scm
===================================================================
RCS file: /cvsroot/gauche/Gauche/lib/gauche/cgen/cise.scm,v
retrieving revision 1.4
diff -u -0 -r1.4 cise.scm
--- lib/gauche/cgen/cise.scm    16 Aug 2007 11:29:50 -0000      1.4
+++ lib/gauche/cgen/cise.scm    17 Aug 2007 03:56:48 -0000
@@ -457 +457 @@
-(define-binary logaor= "&=")
+(define-binary logand= "&=")

負の有理数の比較

Pla?(2007/08/26 08:08:38 PDT): 分母が異なっていて、両方分数で、両方とも負のときに逆転することがあります

>gosh -V
Gauche scheme interpreter, version 0.8.11 [euc-jp,pthreads]
>gosh
gosh> (> -1/3 -1/2)
#f
More ...