Forums: users (Thread #34941)

bsfilter 1.0.19 Rev. 1.97、ruby 2.1.0でundefined method `force_encodingエラー (2014-01-16 15:57 by tsuchiya_masaru #71308)

CentOS6.5でbsfilter+.procmailrcによるフィルタリングを行っていましたが、
いつの間にかX-Spam-Probabilityがヘッダーに挿入されなくなりました。そ
のため、Spamフィルタリングが働かず、困っています。

bsfilterそのものは正常に動いています。
==================================================
$ bsfilter 11079
combined probability 11079 1 0.500003
==================================================

.procmailrcのレシピは
==================================================
PATH=/bin:/usr/bin:/usr/local/bin
SHELL=/bin/bash
MAILDIR=$HOME/Mail
LOGFILE=$HOME/Mail/procmaillog
VERBOSE=yes
BSFILTER=/usr/bin/bsfilter

:0 fw
| /usr/bin/bsfilter --pipe --insert-flag --insert-probability

:0
* ^X-Spam-Probability: *(1|0\.[89])
spam/.
(以下略)
==================================================
となっています。

procmaillogの内容ですが
==================================================
procmail: Executing "/usr/bin/bsfilter,--pipe,--insert-flag,--insert-probability"
/usr/bin/bsfilter:1086: undefined method `force_encoding' for "[\260\241-\364\244]+":String (NoMethodError)
==================================================
とエラーが表示されています。

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
bsfilter      RELEASE 1.0.19     REVISION 1.87

Reply to #71308×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: bsfilter 1.0.19 Rev. 1.97、ruby 2.1.0でundefined method `force_encodingエラー (2014-01-19 01:52 by nabeken #71330)

line 1086 は常に実行される定数定義のはずで、エラーしたりしなかったり、というのが不可解です。
OSX 10.9.1 に macportsでインストールした
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13]
ではエラーが再現出来ていません。
Reply to #71308

Reply to #71330×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: bsfilter 1.0.19 Rev. 1.97、ruby 2.1.0でundefined method `force_encodingエラー (2014-01-21 18:29 by tsuchiya_masaru #71344)

[メッセージ #71330 への返信]
このエラーは常に発生しており、bsfilterによるヘッダーへの検査結果埋め込みは行われていません。
ruby、bsfilter以外に必要なモジュールが入っていないといったことはあるでしょうか。

> line 1086 は常に実行される定数定義のはずで、エラーしたりしなかったり、というのが不可解です。
> OSX 10.9.1 に macportsでインストールした
> ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13]
> ではエラーが再現出来ていません。

Reply to #71330

Reply to #71344×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: bsfilter 1.0.19 Rev. 1.97、ruby 2.1.0でundefined method `force_encodingエラー (2014-01-22 01:55 by nabeken #71346)

$ bsfilter 11079
のようなコマンドラインからの実行でも、
procmailからの実行でも、line1086は通る箇所はずので、
片方でのみエラーことは本来ないはずです。

rubyインタープリタが複数インストールされていて
コマンドラインからとprocmailからとで異なるバージョンが使われている
ことはないでしょうか。


Reply to #71344

Reply to #71346×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: bsfilter 1.0.19 Rev. 1.97、ruby 2.1.0でundefined method `force_encodingエラー (2014-01-23 12:09 by tsuchiya_masaru #71353)

まさにその通りでした。
.procmailrcでPATH=/bin:/usr/bin:/usr/local/binと設定していましたが、/usr/bin
にruby 1.8.7が入っていました。/usr/local/binのrubyは2.1.0。
/usr/binのrubyを外したら正常に処理されるようになりました。

nabekenさん、ありがとうございました。

Reply to #71346

Reply to #71353×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login