Skip to content
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

invalid byte sequence in US-ASCII error when running bump #462

Closed
JamieMagee opened this issue Sep 12, 2023 · 2 comments
Closed

invalid byte sequence in US-ASCII error when running bump #462

JamieMagee opened this issue Sep 12, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@JamieMagee
Copy link

Describe the bug
When running spoom bump for a file that contains non-US-ASCII characters I receive an error invalid byte sequence in US-ASCII (ArgumentError)

Details
$ bundle exec spoom bump npm_and_yarn/spec/dependabot/npm_and_yarn/package_name_spec.rb
Checking files...

bundler: failed to load command: spoom (/usr/local/rvm/gems/ruby-3.1.4/bin/spoom)
/usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:52:in `match?': invalid byte sequence in US-ASCII (ArgumentError)
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:52:in `block in parse'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:51:in `each_line'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:51:in `parse'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `bind_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `validate_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/sorbet/errors.rb:38:in `parse_string'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `bind_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `validate_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/lib/spoom/cli/bump.rb:144:in `bump'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `bind_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/call_validation.rb:256:in `validate_call'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/sorbet-runtime-0.5.11012/lib/types/private/methods/_methods.rb:275:in `block in _on_method_added'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/invocation.rb:116:in `invoke'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor.rb:243:in `block in subcommand'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/spoom-1.2.3/exe/spoom:7:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/spoom:25:in `load'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/spoom:25:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `load'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:58:in `kernel_load'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli/exec.rb:23:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli.rb:492:in `exec'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli.rb:34:in `dispatch'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/cli.rb:28:in `start'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/exe/bundle:37:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
        from /usr/local/rvm/gems/ruby-3.1.4/gems/bundler-2.4.19/exe/bundle:29:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/bundle:25:in `load'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/bundle:25:in `<main>'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/ruby_executable_hooks:22:in `eval'
        from /usr/local/rvm/gems/ruby-3.1.4/bin/ruby_executable_hooks:22:in `<main>'

The specific sequence is the emoji here:

https://github.com/dependabot/dependabot-core/blob/bf037aa4c891c6d5801211dfb9c76a643f4d05d8/npm_and_yarn/spec/dependabot/npm_and_yarn/package_name_spec.rb#L28

To Reproduce
Spoom version: 1.2.3

Steps to reproduce the behavior:

  1. Checkout dependabot-core
  2. bundle install
  3. bundle exec spoom bump npm_and_yarn/spec/dependabot/npm_and_yarn/package_name_spec.rb

Expected behavior
No error

I've tried various ways of specifying the file encoding using magic comments:

# encoding: UTF-8
# coding: UTF-8
# -*- coding: UTF-8 -*-

But none of them work. What does work is adding a UTF-8 BOM.

@JamieMagee JamieMagee added the bug Something isn't working label Sep 12, 2023
JamieMagee added a commit to dependabot/dependabot-core that referenced this issue Sep 15, 2023
@Morriar
Copy link
Collaborator

Morriar commented Nov 29, 2023

👋 Hey @JamieMagee,

I wasn't able to reproduce this on Spoom 1.2.4 with the steps you provided even when using commit 185e1e189 so the files are still the old encoding.

I'm going to close this for now. Feel free to reopen if you can come up with a small repro script.

Thanks for the bug report.

@Morriar Morriar closed this as completed Nov 29, 2023
@JamieMagee
Copy link
Author

Thanks for taking the time to look into this. I also haven't been able to reproduce the error since upgrading to v1.2.4 either. I assume some commit or dependency upgrade between v1.2.3 and v1.2.4 fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants