Win XP / Ferret & Acts_as_ferret .dump problem

Hey,

Has anyone managed to bypass or fix the ferret’s .dump method problem?
When I include acts_as_ferret my whole rails app just blows up because
of Ferret’s .dump method. Ex:


print “\t hello”.dump >> “\t hello”>Exit code: 0


require ‘ferret’
print “\t hello”.dump >> " hello"(NUL char)>Exit code: 0

Essentially this breaks erb and thus Rails template engines dies. I’ve
found topics on this issue before and best recommendation I’ve found is
‘remove all tabs in your rhtml files’. Now, first off it fails even on
non-tab characters in my case, so this is a no go… (Not to mention
that this is hardly a solution)

I’m running:
ruby 1.8.4 (2006-04-14) [i386-mswin32]
rails 1.1.6
ferret 0.10.4 (10.6 and all the rest all have same issue)

Hi!

please see
http://rubyforge.org/tracker/?func=detail&aid=3837&group_id=12&atid=133
for extensive info on this issue.

Apparently this doesn’t have to do with Ferret itself, but with you
using
another ruby version than the one the Ferret binary extension was built
against. I don’t know, however, with which Ruby version the win32 gem is
built.

Jens

On Fri, Sep 22, 2006 at 06:33:31AM +0200, Ilya G. wrote:


I’m running:
ruby 1.8.4 (2006-04-14) [i386-mswin32]
rails 1.1.6
ferret 0.10.4 (10.6 and all the rest all have same issue)


Posted via http://www.ruby-forum.com/.


Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

On 9/22/06, Ilya G. [email protected] wrote:


I’m running:
ruby 1.8.4 (2006-04-14) [i386-mswin32]
rails 1.1.6
ferret 0.10.4 (10.6 and all the rest all have same issue)

Hi Ilya,

Firstly, String#dump isn’t a Ferret method. Secondly, I have no idea
why this is occuring. The error isn’t happening in Ferret code so it
is difficult for me to diagnose the problem. I didn’t realize that it
was this easy to replicate the problem though so I’ll have another
look at it tonight. Don’t get your hopes up though. It isn’t only
Ferret that is causing this problem so I’m not goig to count out the
possibility that the bug is in Ruby of VC6.

Cheers,
Dave

Dave and Tim…

I tried running all ms-win versions of ferret on 1.8.5 / 1.8.4-20 and
even 1.8.2, all of them resulted in the same error. It’s absurd, I don’t
understand why you guys are unable to reproduce this error. (I did
restart and all that jazz… with each reinstall of ruby etc).

Mind you, I only tried this on my main development machine so I will see
if I can reproduce this on my laptop in a second. From my readings on
this problem, RMagick seems to have had the same bug because it
overwrote the default .dump method. Hence I assumed that Ferret is doing
the same.

I’ll let you guys know on the results of my experiment…

Ilya

Same problem, 1.8.4-20 stable…

C:\Documents and Settings\Ilya>irb
irb(main):001:0> “\t\tabcd”.dump
=> “”\t\tabcd""
irb(main):002:0> require ‘ferret’
=> true
irb(main):003:0> “\t\tabcd”.dump
=> “” abcd"\000\000"
irb(main):004:0>

Null chars, spaces… Oi. Am I missing something something in my install?
I’m just installing the one-click ruby and then ‘gem install ferret’.
Any dependencies I’m not aware of?

Ilya

On 9/22/06, Jens K. [email protected] wrote:

Jens

After looking into this myself I think Tim must be right, although for
some reason I’m having trouble replicating the error here, even when I
do install different versions of Ruby. Anyway, I will endeavor to
always build Ferret with the latest stable version of One-Click Ruby.
Currently that is 1.8.4-20 stable. If you are still running into this
problem and you have that version of Ruby installed the let me know.
Make sure you try restarting your computer first though. I think that
may be why I couldn’t replicate the problem.

Cheers,
Dave

Thanks Dave…

I’ve finally managed to find a version of Ruby (1.8.2-15) which passes
the .dump test above. Using:
http://rubyforge.org/frs/?group_id=167

Now, the headache is… I can’t find an RMagick gem to go with it (which
I need for my Rails app) - the rmagick repo only has gems for 1.8.4 and
1.8.5. Sigh. :slight_smile:

I know this won’t be a problem when I deploy my app, but it totally
screws up my ability to development an app on XP.

:slight_smile:

Ilya

On 9/23/06, Ilya G. [email protected] wrote:

overwrote the default .dump method. Hence I assumed that Ferret is doing
the same.

Hi Ilya,

Actually, if you look at that link that Jens posted, RMagick doesn’t
overwrite the String#dump method;

"Of course RMagick doesn't intentionally alter String.dump,
    and your example doesn't even use RMagick for anything."

And neither does Ferret, although I can certainly see why people would
think it did. Believe me, I understand your frustration. If I could
find the problem I would. I’ll give it a try on my laptop and see if I
can reproduce the problem there. Perhaps you could try asking on the
One-Click Ruby list or on the ruby-talk list.

I’ll keep trying to find the problem at this end too.

Cheers,
Dave

On 10/16/06, Brent S. [email protected] wrote:

Any updates?
Thanks
Brent

Afraid not. But it is interesting that the problem is not consistent
across all Windows machines. I still haven’t been able to reproduce
the problem here.

Ok thanks…
On that note, does anyone have a quick method of removing all tabs and
unwelcome characters from a rails app?
David B. wrote:

On 10/16/06, Brent S. [email protected] wrote:

Any updates?
Thanks
Brent

Afraid not. But it is interesting that the problem is not consistent
across all Windows machines. I still haven’t been able to reproduce
the problem here.

Hello Ilya and Dave,
Have you figured out what is causing this issue?
It is happening for me with acts_as_ferret and rmagick.
My rails app works great on some windows boxes, but on my 2003 server it
gives me the nondecript EBADF error whenever I hit any controller
functions that use ferret or rmagick.
Initially it would not load on any of my windows boxes, but the quick
workaround of modifying base.rb to replace tabs with spaces worked.
Unfortunately however the app is still crapping out whenever I hit
rmagick or ferret functions on the 2003 box.
Any updates?
Thanks
Brent

Steven H. wrote:

Can you post your changes to base.rb? I’d like to give that a try.

Thanks,
Steve

sure:
actionpack-1.12.1/lib/action_view/base.rb
modify compile_template to begin with

template=template.gsub(/\t/," ")

It completely fixed the issue on one of my win systems,
but on another one of them (both 2003), it doesnt work.

This may cause many other issues than it fixes however so I would label
it a hack for now. I found this fix online somewhere, but I can’t find
it anymore.

Good luck.
Brent

Interesting solution Brent…

I actually just ended up installing VMWare / Fedora Core 5 and doing my
development from there. No problems on *nix distributions. :slight_smile:

It would be really nice if someone could resolve this problem though!
(Once and for all)

Cheers,
Ilya

P.S. Running ferret on http://www.graphics-world.com - loving it! :slight_smile:

Thanks, I’ll report back success or failure with this.

Steve

Can you post your changes to base.rb? I’d like to give that a try.

Thanks,
Steve

Steven H. wrote:

Thanks, I’ll report back success or failure with this.

Steve

All,

Is the hack proposed in the thread above is the only solution ? Or do we
have had any public fixes available? Please revert if there are

Thanks
Amit