Ruby: undefined method `>> 'for" \ x0F ": String (NoMethodError)

I am getting this error when accessing my Redmine installation using Apache with FastCGI. What could be causing this?

/usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:454:in `read_length': undefined method `>>' for "\x0F":String (NoMethodError)
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:448:in `read_pair'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:441:in `parse_values'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:435:in `parse'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:195:in `read_record'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:126:in `next_request'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:116:in `session'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:104:in `each_request'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/fcgi-0.8.8/lib/fcgi.rb:36:in `each'
        from /usr/local/rvm/rubies/ruby-1.9.3-p374/lib/ruby/gems/1.9.1/gems/rack-1.4.4/lib/rack/handler/fastcgi.rb:27:in `run'
        from /var/www/redmine/public/dispatch.fcgi:21:in `<main>'

      

the line indicated in the error looks like this (with line numbers), this is a fragment of the fcgi.rg file:

453   def self::read_length(buf)
454     if buf[0] >> 7 == 0
455     then buf.slice!(0,1)[0]
456     else buf.slice!(0,4).unpack('N')[0] & ((1<<31) - 1)
457     end
458   end

      

Thanks Mark

+3


source to share


1 answer


Well, I don't know exactly what's going on, but the error itself tells you that buf [0] is a string and does not respond to the bitwise shift operator (→).

I'm not sure if this is the 100% correct way to debug this, but if you try to unpack this line, you get its decimal value:

irb(main):053:0> "\x0F".unpack "c"
=> [15]

      



And if you look at http://www.asciitable.com/ , apparently it's a "shift in" character. So somehow the "shift" character is read by the buffer, and when it tries to bitwise shift on that character, ruby ​​complains.

I would check the file it was processing and see if there are any suspicious or illegal characters in there.

+1


source







All Articles