[PATCH] Basic Ruby 1.9 Compatibility

2 views
Skip to first unread message

Ryan Tomayko

unread,
Feb 3, 2009, 7:12:23 PM2/3/09
to rack-...@googlegroups.com
I have a ruby19 branch that passes all Rack specs in the basic test
suite and most in the fulltest suite without adding anything to core
ruby objects (e.g., String#each):

http://github.com/rtomayko/rack/commits/ruby19
git://github.com/rtomayko/rack.git

Please review. I'd very much like to merge.

HOWTO RUN SPECS UNDER 1.9

Mongrel, thin, and fcgi all fail to compile/install under 1.9. The
fulltest suite relies on these libraries being present so I'm not yet
able to establish how much additional work is hiding in those specs.

Running the specs under 1.9 took a bit of fiddling in general:

* The most recent version of the test-spec gem is required.
* The test-unit gem is required (test-spec will not run on miniunit).

Once those pieces are in place, you should be able to run the basic test
suite with: `rake`; or, run a specific set of specs with:

$ RUBYOPT=rubygems specrb -Ilib:test test/spec_rack_lint.rb

OTHER ISSUES WITH RUBY 1.9

When I started in on this, I assumed that String#each was going to be
the big killer but it turns out we have a bunch of other issues to
consider.

* String#length is used throughout specs and code to determine the
length of response bodies. String#bytesize should be used instead. I've
fixed all spec failures but there may be other places where #length is
used that have not yet surfaced.

* Array#to_s is used in various specs to turn Array response bodies into
Strings. In Ruby 1.8, Array#to_s works like Array#join; in Ruby 1.9,
Array#to_s acts like Array#inspect. Breakage ensues. I've converted all
cases surfaced by specs to use #join but I wouldn't be surprised if
there were additional bugs of this sort hiding elsewhere.

* File.read assumes the default external encoding. This causes binary
data to be treated as UTF-8 in some cases but usually doesn't surface
until a Regexp match or some similar operation is performed. I've
changed most cases surfaced by specs to instead use:
File.open(fn, 'rb') { |f| f.read }

I plan on spending some serious time with ack trying to root out any
remaining issues that aren't being surfaced by specs but I feel what's
on the branch now is a good start.

Thanks
--
Ryan http://tomayko.com/about

Christian Neukirchen

unread,
Feb 6, 2009, 9:34:38 AM2/6/09
to rack-...@googlegroups.com
Ryan Tomayko <r...@tomayko.com> writes:

> I have a ruby19 branch that passes all Rack specs in the basic test
> suite and most in the fulltest suite without adding anything to core
> ruby objects (e.g., String#each):
>
> http://github.com/rtomayko/rack/commits/ruby19
> git://github.com/rtomayko/rack.git
>
> Please review. I'd very much like to merge.

+1, thanks a lot for your efforts.

--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org

James Tucker

unread,
Feb 6, 2009, 10:31:16 AM2/6/09
to rack-...@googlegroups.com

On 6 Feb 2009, at 14:34, Christian Neukirchen wrote:

>
> Ryan Tomayko <r...@tomayko.com> writes:
>
>> I have a ruby19 branch that passes all Rack specs in the basic test
>> suite and most in the fulltest suite without adding anything to core
>> ruby objects (e.g., String#each):
>>
>> http://github.com/rtomayko/rack/commits/ruby19
>> git://github.com/rtomayko/rack.git
>>
>> Please review. I'd very much like to merge.
>
> +1, thanks a lot for your efforts.

Did a quick merge of master, then a diff, summary of changes is here: http://pastie.textmate.org/private/0bmxewr9c2wfv2nkferyda

+1, well done

Christian Neukirchen

unread,
Feb 6, 2009, 11:59:20 AM2/6/09
to rack-...@googlegroups.com
James Tucker <jftu...@gmail.com> writes:

> Did a quick merge of master, then a diff, summary of changes is here: http://pastie.textmate.org/private/0bmxewr9c2wfv2nkferyda

I use my alternative git viewer for reviewing biggish changes:
http://vuxu.org/git2/rack-github/(master)rtomayko--ruby19

Scytrin dai Kinthra

unread,
Feb 6, 2009, 12:47:25 PM2/6/09
to rack-...@googlegroups.com
This patchset includes the Strings for header values patch also up for
review, for which I have comments that belong in that context.
Beyond that LGTM. Good works!

--
stadik.net

Ryan Tomayko

unread,
Feb 6, 2009, 3:54:12 PM2/6/09
to rack-...@googlegroups.com
Merged to rack/master with Scytrin's suggested SPEC changes.

Yay!

Thanks everyone,
Ryan

Reply all
Reply to author
Forward
0 new messages