Index: hawk/public/dispatch.fcgi =================================================================== --- hawk/public/dispatch.fcgi.orig +++ hawk/public/dispatch.fcgi @@ -23,6 +23,42 @@ # we can pull rubygems from there $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../vendor") +# Workaround for bnc#579874 (ruby: String#unpack("V") does not work correctly on s390x) +if [1].pack('V').unpack('V')[0] != 1 + class String + alias_method :broken_unpack, :unpack + def unpack(spec) + # use regular unpack first... + unpacked = broken_unpack(spec) + if spec.include? 'V' + # ...then, if there's a 'V' anywhere, expand the spec + # (need this to handle numeric and '*' parts of spec)... + parts = spec.scan(/[0-9]+|[^0-9]/) + spec = '' + final = '' + parts.each_with_index do |x,i| + n = x.to_i + if n > 0 + (n-1).times { spec += parts[i-1] } + else + spec += x + final = x unless x == '*' + end + end + # ...and match the expanded spec against the unpacked array... + unpacked = unpacked.each_with_index.map do |x,i| + # cope with '*' at end of spec + format = (i >= spec.length || spec[i] == ?*) ? final[0] : spec[i] + # if we've hit a 'V', shift it right 32 bits to get the correct value + x >>= 32 if format == ?V + x + end + end + unpacked + end + end +end + require File.dirname(__FILE__) + "/../config/environment" require 'fcgi_handler'