-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Facing `compile_file': "\\xE2" on US-ASCII (Encoding::InvalidByteSequenceError) error when trying to run any rails command #444
Comments
I'm not convinced this is a bootsnap error. Have you tried disabling it to confirm it's not just a syntax error with Ruby itself? |
yes i tried disabling it and it works as per normal |
Hum, ok. So:
It's really unclear what's going on, I tried a few local repros but no luck. So I prepared a branch for you to try, which should tell us which file is causing this: Please try it: gem "bootsnap", github: "Shopify/bootsnap", branch: "debug-encoding" It should print |
I'm facing a different error now with the branch whereby i cant load bootsnap at all. Am I missing out something?
|
This suggest the extension wasn't compiled. Not sure how you got into such a state, but clearly the way you build your application is not good. But whatever, let's try another strategy. Back on the regular gem, please insert this in your module DebugIseqCompile
def compile_file(path, *args)
super
rescue Encoding::InvalidByteSequenceError
p [:compile_file, path]
raise
end
end
RubyVM::InstructionSequence.singleton_class.prepend(DebugIseqCompile) The effect should be the same, it should print the path of the file causing the issue. |
Thank you so much for doing this. This is what is being logged:
|
Ok, so looking at that file:
>> puts File.binread("/tmp/methods.rb").slice(7420..7460)
gsub(/\b(?<!\w['’`])[a-z]/) do |match| So it's choking on that regexp. I only had Ruby While I'm digging more, You mention Docker, can you give me more info? Which base image are you using, is it |
>> "’".b
=> "\xE2\x80\x99" Here's our |
Ok, I can repro with: >> Encoding.default_internal = Encoding::US_ASCII
=> #<Encoding:US-ASCII>
>> RubyVM::InstructionSequence.compile_file("/tmp/methods.rb")
Traceback (most recent call last):
5: from /opt/rubies/2.7.8/bin/irb:23:in `<main>'
4: from /opt/rubies/2.7.8/bin/irb:23:in `load'
3: from /opt/rubies/2.7.8/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
2: from (irb):4
1: from (irb):4:in `compile_file'
Encoding::UndefinedConversionError (U+2019 from UTF-8 to US-ASCII) This generally means Setting |
my base image is an CentOS7 image where ruby is installed with rbenv. Is there a reason why this is happening now? I'm assuming something change in ruby 2.7.8? |
It's possible that between |
Also could be a problem with CentOS, given the Fedora maintainer had a similar issue a while ago: https://bugs.ruby-lang.org/issues/12127#note-3 |
Nonetheless, appreciate your effort! This is probably the first time I receive response on an opensource issue that quick. |
o7 |
So I recently upgrade my project from Ruby 2.5 to 2.7.8 because obviously its been out of date for the longest time. After the upgrade I'm faced with the following error for bootsnap while trying to deploy it as a docker container.
I'm currently on:
rails (6.0.6.1)
ruby (2.7.8) previously 2.5.0
bundler (2.1.4) previouly 1.17.3
bootsnap 1.16.0
are there some sort of changes as to how higher ruby version works with bootsnap?
Also i notice that when i run
rails db:migrate
for e.g. thebundle exec rails ...
would then work... not sure whats going on.Would appreciate if anyone can shine some light.
The text was updated successfully, but these errors were encountered: