rack-1.2.1 breaks with ruby 1.8.6

2 views
Skip to first unread message

candlerb

unread,
Jul 14, 2010, 10:01:01 AM7/14/10
to Rack Development
I started getting this error after upgrading from rack-1.1.0 to
rack-1.2.1:

/usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138:in
`union': can't convert Array into String (TypeError)
from /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138

It turns out to be easily fixed. ruby-1.8.7 allows two different
formats of Regexp.union:

>> Regexp.union("a","b","c")
=> /a|b|c/
>> Regexp.union(["a","b","c"])
=> /a|b|c/

but ruby-1.8.6 only allows one of these:

>> Regexp.union("a","b","c")
=> /a|b|c/
>> Regexp.union(["a","b","c"])
TypeError: can't convert Array into String
from (irb):4:in `union'
from (irb):4
from :0

So the solution is to add an "*" here in rack/utils.rb line 138:

ESCAPE_HTML_PATTERN = Regexp.union(*ESCAPE_HTML.keys)

Incidentally, I also get the following warning with -w:

/usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/server.rb:228:
warning: parenthesize argument(s) for future version

The solution is to change that line from
options.merge! opt_parser.parse! args
to
options.merge! opt_parser.parse!(args)

Regards, Brian.

candlerb

unread,
Jul 14, 2010, 10:05:53 AM7/14/10
to Rack Development
Oops, I checked in git, and the ESCAPE_HTML fix is already in there.
Sorry for the noise.

The parenthesize warning still is present though, now at lib/rack/
server.rb line 233.

James Tucker

unread,
Jul 14, 2010, 11:56:58 AM7/14/10
to rack-...@googlegroups.com

Yeah, chris2, I know it's rapid, but can we roll a new release soon, pretty please? <3

Christian Neukirchen

unread,
Jul 14, 2010, 12:39:57 PM7/14/10
to rack-...@googlegroups.com
James Tucker <jftu...@gmail.com> writes:

I have zilch time before mid August.

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

James Tucker

unread,
Jul 14, 2010, 1:00:58 PM7/14/10
to rack-...@googlegroups.com

On 14 Jul 2010, at 17:39, Christian Neukirchen wrote:

> James Tucker <jftu...@gmail.com> writes:
>
>> On 14 Jul 2010, at 15:05, candlerb wrote:
>>
>>> Oops, I checked in git, and the ESCAPE_HTML fix is already in there.
>>> Sorry for the noise.
>>>
>>> The parenthesize warning still is present though, now at lib/rack/
>>> server.rb line 233.
>>
>> Yeah, chris2, I know it's rapid, but can we roll a new release soon, pretty please? <3
>
> I have zilch time before mid August.

Ok, I shall try to get everything together by then to save you any time, and in the meantime, may I use "mid August" as the loosely expected time for next release?

Reply all
Reply to author
Forward
0 new messages