Joaquin Diez’s Weblog

Small notes…thoughts… etc..

Problems with Ec2 tools and Ruby 1.8.6

When you try to bundle and Ec2 image using the next command,

ec2-bundle-image -i /mnt/image/$IMAGE_NAME -k $EC2_PRIVATE_KEY -c $EC2_CERT -u $AWS_ACCOUNT_NUMBER

and you have just installed the last version of Ruby 1.8.6, is possible you get the next error:


Creating bundle manifest...
Error: private method `gsub' called for 51:Fixnum
ec2-bundle-image failed.

This error can be fixed in this way,

go to the instalation of ruby in your system and open /usr/lib/ruby/1.8/rexml/text.rb

This could have been fixed at the rcov side, but since it *did* used to work
with rexml, I consider this a backwards-compatibility failure. The fix is
trivial:

--- rexml/text.rb.orig 2007-10-22 08:00:04.000000000 +0100
+++ rexml/text.rb 2007-10-22 08:00:33.000000000 +0100
@@ -286,7 +286,7 @@
EREFERENCE = /&(?!#{Entity::NAME};)/
# Escapes all possible entities
def Text::normalize( input, doctype=nil, entity_filter=nil )
- copy = input
+ copy = input.to_s
# Doing it like this rather than in a loop improves the speed
#copy = copy.gsub( EREFERENCE, '&' )
copy = copy.gsub( "&", "&" )

(Note that there are other places in this file which might benefit from a
to_s as well)

The second is almost certainly a bug in REXML: it’s a misnamed local
variable.

--- rexml/document.rb.orig 2007-10-22 08:02:36.000000000 +0100
+++ rexml/document.rb 2007-10-22 08:03:01.000000000 +0100
@@ -183,7 +183,7 @@
output = Output.new( output, xml_decl.encoding )
end
formatter = if indent > -1
- if transitive
+ if trans
REXML::Formatters::Transitive.new( indent, ie_hack )
else
REXML::Formatters::Pretty.new( indent, ie_hack )

Noviembre 29, 2007 Publicado por Joaquin Diez | desarrollo, ec2, linux, ruby | , , | Aún no hay comentarios