Tabs and parse errors with Ruby 1.8.4 and Windows

This is a cross-post from the Rails list in hopes of getting some
information from people who know more about the Ruby side of things.

I get compile errors from ERB in my Rails views when I load the ferret C
extension. Apparently this also happens with RMagick. The most common
response I've seen is to replace all tabs with spaces, and the problem
will go away. I would like to know why that works, what the problem is,
and if there's anything I can do to fix it. Making sure none of my views
contain tab characters is not a solution I'm comfortable with for a
production environment. This is what the errors look like:

compile error
./script/../config/../app/views/search/query.rhtml:5: Invalid char
`\002' in expression
./script/../config/../app/views/search/query.rhtml:6: parse error,
unexpected tIDENTIFIER, expecting kEND
_erbout.concat " <strong>"xP; _erbout.concat(( "%d%%" % (result.RANK /
1000.0 * 100) ).to_s); _erbout.concat "</strong>\n"
                               ^
./script/../config/../app/views/search/query.rhtml:7: parse error,
unexpected $, expecting kEND

I have tried recompiling everything (Ruby, extensions, zlib, and ferret)
myself, and only using the precompiled binaries for readline.dll and
iconv.dll because I can't find the source for the Windows ports
anywhere. That made no difference, so I was thinking it was a Ruby bug
(since it happened with two different extensions), but I guess it could
be something odd both extensions are doing, too. Other people reporting
this problem have indicated it started with Ruby 1.8.4.

See the Rails thread for more details:
http://www.ruby-forum.com/topic/82955#146645

Thanks,

- Will

···

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

Will Rogers wrote:

This is a cross-post from the Rails list in hopes of getting some information from people who know more about the Ruby side of things.

I get compile errors from ERB in my Rails views when I load the ferret C extension. Apparently this also happens with RMagick. The most common response I've seen is to replace all tabs with spaces, and the problem will go away. I would like to know why that works, what the problem is, and if there's anything I can do to fix it. Making sure none of my views contain tab characters is not a solution I'm comfortable with for a production environment. This is what the errors look like:

compile error
./script/../config/../app/views/search/query.rhtml:5: Invalid char
`\002' in expression
./script/../config/../app/views/search/query.rhtml:6: parse error,
unexpected tIDENTIFIER, expecting kEND
_erbout.concat " <strong>"xP; _erbout.concat(( "%d%%" % (result.RANK /
1000.0 * 100) ).to_s); _erbout.concat "</strong>\n"
                               ^
./script/../config/../app/views/search/query.rhtml:7: parse error,
unexpected $, expecting kEND

I have tried recompiling everything (Ruby, extensions, zlib, and ferret) myself, and only using the precompiled binaries for readline.dll and iconv.dll because I can't find the source for the Windows ports anywhere. That made no difference, so I was thinking it was a Ruby bug (since it happened with two different extensions), but I guess it could be something odd both extensions are doing, too. Other people reporting this problem have indicated it started with Ruby 1.8.4.

See the Rails thread for more details:
Tabs and parse errors with Ruby 1.8.4 and Windows - Rails - Ruby-Forum

Thanks,

- Will

You don't say what version of RMagick you're using but I'm assuming it's 1.9.2. There was a problem having this symptom when using RMagick 1.9.2 with Ruby 1.8.4 because RMagick was compiled using a different compiler than Ruby. The rmagick-win32 gem, version 1.13.0, is compatible with Ruby 1.8.4. There is also a version of the rmagick-win32 gem for Ruby 1.8.5. Both are available from RubyForge: http://rmagick.rubyforge.org.

Just chiming in to say that I get these as well. I've just been
search-and-replacing tabs with spaces, rather than bothering to get to
the bottom of it.

···

On 10/6/06, Will Rogers <wjrogers@terpalum.umd.edu> wrote:

This is a cross-post from the Rails list in hopes of getting some
information from people who know more about the Ruby side of things.

I get compile errors from ERB in my Rails views when I load the ferret C
extension. Apparently this also happens with RMagick. The most common
response I've seen is to replace all tabs with spaces, and the problem
will go away. I would like to know why that works, what the problem is,
and if there's anything I can do to fix it. Making sure none of my views
contain tab characters is not a solution I'm comfortable with for a
production environment. This is what the errors look like:

Timothy Hunter wrote:

You don't say what version of RMagick you're using but I'm assuming it's

Timothy,

I didn't say what version of RMagick I'm using because I'm not using
RMagick. Also, I recompiled everything involved from scratch, so there
is no issue of differing Ruby versions.

- Will

···

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

can you elaborate tim?

-a

···

On Fri, 6 Oct 2006, Timothy Hunter wrote:

You don't say what version of RMagick you're using but I'm assuming it's 1.9.2. There was a problem having this symptom when using RMagick 1.9.2 with Ruby 1.8.4 because RMagick was compiled using a different compiler than Ruby. The rmagick-win32 gem, version 1.13.0, is compatible with Ruby 1.8.4. There is also a version of the rmagick-win32 gem for Ruby 1.8.5. Both are available from RubyForge: http://rmagick.rubyforge.org.

--
in order to be effective truth must penetrate like an arrow - and that is
likely to hurt. -- wei wu wei

I'd love to know what is causing this problem. I tried reproducing it
here but I couldn't. Even installing an older version of the one-click
installer didn't help. Ferret still ran fine and tabs didn't seem to
do anything. What is is about tab characters anyway?

Anyway, I'm still looking into it. I might try and get my hands on a
few other systems to test on.

Cheers,
Dave

···

On 10/7/06, Wilson Bilkovich <wilsonb@gmail.com> wrote:

On 10/6/06, Will Rogers <wjrogers@terpalum.umd.edu> wrote:
> This is a cross-post from the Rails list in hopes of getting some
> information from people who know more about the Ruby side of things.
>
> I get compile errors from ERB in my Rails views when I load the ferret C
> extension. Apparently this also happens with RMagick. The most common
> response I've seen is to replace all tabs with spaces, and the problem
> will go away. I would like to know why that works, what the problem is,
> and if there's anything I can do to fix it. Making sure none of my views
> contain tab characters is not a solution I'm comfortable with for a
> production environment. This is what the errors look like:
>

Just chiming in to say that I get these as well. I've just been
search-and-replacing tabs with spaces, rather than bothering to get to
the bottom of it.

Of course, Ara.

Kaspar Schiess, the RMagick Win32 guru, compiled RMagick 1.9.2 for Ruby 1.8.2 using mingw. This worked fine since the 1-click installer for Ruby 1.8.2 was compiled with VC++2003 (iirc, I don't know much about MS compiler versions). Curt switched to VC6 (VC++2005?) for the Ruby 1.8.4 1-click installer. The binaries produced by mingw are not compatible with the VC6 binaries, so as soon as RMagick users (mostly Rails folks) switched to Ruby 1.8.4 they started having problems. Usually the problems had the symptom described in this thread.

Brett DiFrischia, RMagick's new Win32 ninja, compiled the RMagick 1.13.0 gem for Windows using a compiler that is compatible with the 1.8.4 1-click installer. I think he posted the details on this list, if not I'm sure he'd be happy to explain.

There was a lot of discussion on this list about which compiler to use for the 1-click installer a couple of months ago. The decision directly affects all binary extensions for Windows. I'm pulling for mingw since it's free (as in FOSS). There are also good arguments for an MS compiler. I don't think Curt's made a decision yet.

···

ara.t.howard@noaa.gov wrote:

On Fri, 6 Oct 2006, Timothy Hunter wrote:

You don't say what version of RMagick you're using but I'm assuming it's 1.9.2. There was a problem having this symptom when using RMagick 1.9.2 with Ruby 1.8.4 because RMagick was compiled using a different compiler than Ruby. The rmagick-win32 gem, version 1.13.0, is compatible with Ruby 1.8.4. There is also a version of the rmagick-win32 gem for Ruby 1.8.5. Both are available from RubyForge: http://rmagick.rubyforge.org.

can you elaborate tim?

-a

i'm guessing a different def if isspace or issacii - i've seen issues with
those before with mingw vs ms compilers...

-a

···

On Sat, 7 Oct 2006, David Balmain wrote:

On 10/7/06, Wilson Bilkovich <wilsonb@gmail.com> wrote:

On 10/6/06, Will Rogers <wjrogers@terpalum.umd.edu> wrote:
> This is a cross-post from the Rails list in hopes of getting some
> information from people who know more about the Ruby side of things.
>
> I get compile errors from ERB in my Rails views when I load the ferret C
> extension. Apparently this also happens with RMagick. The most common
> response I've seen is to replace all tabs with spaces, and the problem
> will go away. I would like to know why that works, what the problem is,
> and if there's anything I can do to fix it. Making sure none of my views
> contain tab characters is not a solution I'm comfortable with for a
> production environment. This is what the errors look like:
>

Just chiming in to say that I get these as well. I've just been
search-and-replacing tabs with spaces, rather than bothering to get to
the bottom of it.

I'd love to know what is causing this problem. I tried reproducing it
here but I couldn't. Even installing an older version of the one-click
installer didn't help. Ferret still ran fine and tabs didn't seem to
do anything. What is is about tab characters anyway?

Anyway, I'm still looking into it. I might try and get my hands on a
few other systems to test on.

Cheers,
Dave

--
in order to be effective truth must penetrate like an arrow - and that is
likely to hurt. -- wei wu wei

David Balmain wrote:

I'd love to know what is causing this problem. I tried reproducing it
here but I couldn't. Even installing an older version of the one-click

Are you using a Rails application to test? It only happens for me in
Rails views, not in irb or regular Ruby scripts.

Anyway, I'm still looking into it. I might try and get my hands on a
few other systems to test on.

I just installed the Cygwin version of Ruby to test that combination,
and it works fine running WEBrick from Cygwin's Ruby. No compile errors.
So it's apparently a problem with Microsoft compilers only. At this
point, I'm considering building Ruby using mingw just to get this
working.

That doesn't address the problem of it not working in the official
mswin32 binary release of Ruby. From a maintenance standpoint, it's
pretty important to me that this get cleared up :slight_smile:

Thanks for looking into it, David.

- Will

···

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

thanks alot tim. i for one, am also pulling for an mingw compiler.

kind regards.

-a

···

On Sat, 7 Oct 2006, Tim Hunter wrote:

Of course, Ara.

Kaspar Schiess, the RMagick Win32 guru, compiled RMagick 1.9.2 for Ruby
1.8.2 using mingw. This worked fine since the 1-click installer for Ruby
1.8.2 was compiled with VC++2003 (iirc, I don't know much about MS compiler
versions). Curt switched to VC6 (VC++2005?) for the Ruby 1.8.4 1-click
installer. The binaries produced by mingw are not compatible with the VC6
binaries, so as soon as RMagick users (mostly Rails folks) switched to Ruby
1.8.4 they started having problems. Usually the problems had the symptom
described in this thread.

Brett DiFrischia, RMagick's new Win32 ninja, compiled the RMagick 1.13.0 gem
for Windows using a compiler that is compatible with the 1.8.4 1-click
installer. I think he posted the details on this list, if not I'm sure he'd
be happy to explain.

There was a lot of discussion on this list about which compiler to use for
the 1-click installer a couple of months ago. The decision directly affects
all binary extensions for Windows. I'm pulling for mingw since it's free (as
in FOSS). There are also good arguments for an MS compiler. I don't think
Curt's made a decision yet.

--
in order to be effective truth must penetrate like an arrow - and that is
likely to hurt. -- wei wu wei

You are correct, no decision has been made yet. We just began talks
with Microsoft developers who are on the Visual Studio team. We need
to see what comes out of that before making any decisions.

Curt

···

On 10/6/06, Tim Hunter <sastph@sas.com> wrote:

ara.t.howard@noaa.gov wrote:
> On Fri, 6 Oct 2006, Timothy Hunter wrote:
>
>> You don't say what version of RMagick you're using but I'm assuming
>> it's 1.9.2. There was a problem having this symptom when using RMagick
>> 1.9.2 with Ruby 1.8.4 because RMagick was compiled using a different
>> compiler than Ruby. The rmagick-win32 gem, version 1.13.0, is
>> compatible with Ruby 1.8.4. There is also a version of the
>> rmagick-win32 gem for Ruby 1.8.5. Both are available from RubyForge:
>> http://rmagick.rubyforge.org.
>
> can you elaborate tim?
>
> -a

Of course, Ara.

Kaspar Schiess, the RMagick Win32 guru, compiled RMagick 1.9.2 for Ruby
1.8.2 using mingw. This worked fine since the 1-click installer for Ruby
1.8.2 was compiled with VC++2003 (iirc, I don't know much about MS
compiler versions). Curt switched to VC6 (VC++2005?) for the Ruby 1.8.4
1-click installer. The binaries produced by mingw are not compatible
with the VC6 binaries, so as soon as RMagick users (mostly Rails folks)
switched to Ruby 1.8.4 they started having problems. Usually the
problems had the symptom described in this thread.

Brett DiFrischia, RMagick's new Win32 ninja, compiled the RMagick 1.13.0
gem for Windows using a compiler that is compatible with the 1.8.4
1-click installer. I think he posted the details on this list, if not
I'm sure he'd be happy to explain.

There was a lot of discussion on this list about which compiler to use
for the 1-click installer a couple of months ago. The decision directly
affects all binary extensions for Windows. I'm pulling for mingw since
it's free (as in FOSS). There are also good arguments for an MS
compiler. I don't think Curt's made a decision yet.

Yeah. I'm not using the one-click installer here, but rather the
mswin32 build it is based on. Good times.. good times..

···

On 10/6/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:

On Sat, 7 Oct 2006, David Balmain wrote:

> On 10/7/06, Wilson Bilkovich <wilsonb@gmail.com> wrote:
>> On 10/6/06, Will Rogers <wjrogers@terpalum.umd.edu> wrote:
>> > This is a cross-post from the Rails list in hopes of getting some
>> > information from people who know more about the Ruby side of things.
>> >
>> > I get compile errors from ERB in my Rails views when I load the ferret C
>> > extension. Apparently this also happens with RMagick. The most common
>> > response I've seen is to replace all tabs with spaces, and the problem
>> > will go away. I would like to know why that works, what the problem is,
>> > and if there's anything I can do to fix it. Making sure none of my views
>> > contain tab characters is not a solution I'm comfortable with for a
>> > production environment. This is what the errors look like:
>> >
>>
>> Just chiming in to say that I get these as well. I've just been
>> search-and-replacing tabs with spaces, rather than bothering to get to
>> the bottom of it.
>>
>
> I'd love to know what is causing this problem. I tried reproducing it
> here but I couldn't. Even installing an older version of the one-click
> installer didn't help. Ferret still ran fine and tabs didn't seem to
> do anything. What is is about tab characters anyway?
>
> Anyway, I'm still looking into it. I might try and get my hands on a
> few other systems to test on.
>
> Cheers,
> Dave

i'm guessing a different def if isspace or issacii - i've seen issues with
those before with mingw vs ms compilers...

No, I wasn't. I'll try that.

···

On 10/7/06, Will Rogers <wjrogers@terpalum.umd.edu> wrote:

David Balmain wrote:
> I'd love to know what is causing this problem. I tried reproducing it
> here but I couldn't. Even installing an older version of the one-click

Are you using a Rails application to test? It only happens for me in
Rails views, not in irb or regular Ruby scripts.