Namazu-devel-ja(旧)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mknmz#check_file の修正
- From: Tadamasa Teranishi <yw3t-trns@xxxxxxxxxxxxxxx>
- Date: Thu, 29 Jan 2004 07:56:29 +0900
- X-ml-name: namazu-devel-ja
- X-mail-count: 03613
寺西です。
mknmz で macbinary.pl を使うと、以下のようなエラーメッセージが
でます。
17/22 - /home/teranisi/src/HEAD/namazu/tests/data/ja-mac/word6.doc
はサイズが 0 なので無視します
17/21 - /home/teranisi/src/HEAD/namazu/tests/data/ja-mac/word95.doc
filter/macbinary.pl gets error from other filter
実際にはファイルサイズが 0 バイトというわけではなくて、macbinary.pl
から呼び出されている msword.pl で未対応のフォーマットと判断され、
エラーが発生したためです。
できれば最後に呼び出されたフィルタのエラーを出力される方がありが
たいので、パッチを作成しました。
パッチをあてると、以下のように最後のフィルタのエラーを表示します。
11/24 - /home/teranisi/src/HEAD/namazu/tests/data/ja-mac/powerpoint4.ppt
未対応の形式 (application/powerpoint4)無視します
:
17/22 - /home/teranisi/src/HEAD/namazu/tests/data/ja-mac/word6.doc
未対応の形式: word7
17/21 - /home/teranisi/src/HEAD/namazu/tests/data/ja-mac/word95.doc
未対応の形式: word7
--
=====================================================================
寺西 忠勝(TADAMASA TERANISHI) yw3t-trns@xxxxxxxxxxxxxxx
http://www.asahi-net.or.jp/~yw3t-trns/index.htm
Key fingerprint = 474E 4D93 8E97 11F6 662D 8A42 17F5 52F4 10E7 D14E
Index: scripts/mknmz.in
===================================================================
RCS file: /storage/cvsroot/namazu/scripts/mknmz.in,v
retrieving revision 1.127
diff -u -r1.127 mknmz.in
--- scripts/mknmz.in 23 Jan 2004 16:44:46 -0000 1.127
+++ scripts/mknmz.in 28 Jan 2004 22:44:00 -0000
@@ -1,7 +1,7 @@
#! %PERL% -w
# -*- Perl -*-
# mknmz - indexer of Namazu
-# $Id: mknmz.in,v 1.127 2004/01/23 16:44:46 opengl2772 Exp $
+# $Id: mknmz.in,v 1.126 2003/10/21 05:53:48 makoto Exp $
#
# Copyright (C) 1997-1999 Satoru Takabayashi All rights reserved.
# Copyright (C) 2000,2001 Namazu Project All rights reserved.
@@ -942,6 +942,10 @@
'::filter($orig_cfile, $contref, $weighted_str, $headings, $fields);';
}
if ($err) {
+ if ($err =~ m/; x-system=unsupported$/) {
+ return (0, $err);
+ }
+
return (0, "$mtype; x-error=$err");
}
@@ -1635,7 +1639,15 @@
my ($cfile, $cfile_size, $text_size, $mtype, $uri) = @_;
my $msg = undef;
- if (! util::isurl($cfile) && ! -e $cfile) {
+ if ($mtype =~ /; x-system=unsupported$/) {
+ $mtype =~ s/; x-system=unsupported$//;
+ $msg = _("Unsupported media type ")."($mtype)"._(" skipped.");
+ } elsif ($mtype =~ /; x-error=.*$/) {
+ $mtype =~ s/^.*; x-error=(.*)$/$1/;
+ $msg = $mtype;
+ } elsif ($mtype =~ /^x-system/) {
+ $msg = _("system error occurred! ")."($mtype)".(" skipped.");
+ } elsif (! util::isurl($cfile) && ! -e $cfile) {
$msg = _("does NOT EXIST! skipped.");
} elsif (! util::isurl($cfile) && ! -r $cfile) {
$msg = _("is NOT READABLE! skipped.");
@@ -1647,14 +1659,6 @@
$msg = _("is larger than your setup before filtered, skipped: ") . 'conf::FILE_SIZE_MAX (' . $conf::FILE_SIZE_MAX . ') < '. $cfile_size ;
} elsif ($text_size > $conf::TEXT_SIZE_MAX) {
$msg = _("is larger than your setup after filtered, skipped: ") . 'conf::TEXT_SIZE_MAX (' . $conf::TEXT_SIZE_MAX . ') < '. $text_size ;
- } elsif ($mtype =~ /; x-system=unsupported$/) {
- $mtype =~ s/; x-system=unsupported$//;
- $msg = _("Unsupported media type ")."($mtype)"._(" skipped.");
- } elsif ($mtype =~ /; x-error=.*$/) {
- $mtype =~ s/^.*; x-error=(.*)$/$1/;
- $msg = $mtype;
- } elsif ($mtype =~ /^x-system/) {
- $msg = _("system error occurred! ")."($mtype)".(" skipped.");
}
return $msg;
Index: filter/macbinary.pl
===================================================================
RCS file: /storage/cvsroot/namazu/filter/macbinary.pl,v
retrieving revision 1.3
diff -u -r1.3 macbinary.pl
--- filter/macbinary.pl 9 Jan 2004 23:43:29 -0000 1.3
+++ filter/macbinary.pl 28 Jan 2004 22:44:00 -0000
@@ -110,11 +110,16 @@
my ($kanji, $mtype) = mknmz::apply_filter($orig_cfile, \$datafork,
$weighted_str, $headings, $fields,
$dummy_shelterfilename, $mmtype);
- if (($mtype =~ /; x-system=unsupported$/) ||
- ($mtype =~ /; x-error=.*$/)){
+ if ($mtype =~ /; x-system=unsupported$/){
$$contref = "";
$err = "filter/macbinary.pl gets error from other filter";
util::dprint($err);
+ $err = $mtype;
+ }elsif ($mtype =~ /; x-error=(.*)$/){
+ $$contref = "";
+ $err = "filter/macbinary.pl gets error from other filter";
+ util::dprint($err);
+ $err = $1;
}else{
$$contref = $datafork;
gfilter::show_filter_debug_info($contref, $weighted_str,