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

Please upgrade Ruby build to get latest security fix versions #2832

Closed
vadviktor opened this issue Mar 31, 2023 · 1 comment · Fixed by #2846
Closed

Please upgrade Ruby build to get latest security fix versions #2832

vadviktor opened this issue Mar 31, 2023 · 1 comment · Fixed by #2846

Comments

@vadviktor
Copy link

search you tried in the issue tracker

Ruby upgrade in the past day

describe your issue

On 30th March 2023 new minor versions of Ruby were released, fixing security bugs https://www.ruby-lang.org/en/news/

Companies that can upgrade fast and their developers use pre-commit, will experience that their hooks won't run, because of the self contained ruby-build does not have the latest information on how to build it.

I myself don't really grok how pre-commit works, just guessing this is the issue :( Sorry.

pre-commit --version

pre-commit 3.2.1

.pre-commit-config.yaml

default_language_version:
  ruby: 2.7.8
repos:
  - repo: local
    hooks:
      - id: brakeman
        stages: [ commit ]
        name: Scan for security vulnerabilities
        language: ruby
        language_version: 2.7.8
        additional_dependencies:
          - brakeman
        entry: brakeman -5 --no-pager --skip-files bin/local/ --force
        types:
          - ruby

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 3.2.1
git --version: git version 2.39.2
sys.version:
    3.11.2 (main, Feb  7 2023, 13:52:42) [GCC 11.3.0]
sys.executable: /home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/bin/python3.11
os.name: posix
sys.platform: linux

error information

An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/bash', '/home/ikon/.cache/pre-commit/repojsg3zf75/rbenv-2.7.8/bin/rbenv', 'install', '2.7.8')
return code: 2
stdout: (none)
stderr:
    ruby-build: definition not found: 2.7.8
    
    See all available versions with `rbenv install --list'.
    
    If the version you need is missing, try upgrading ruby-build.
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/languages/ruby.py", line 108, in _install_ruby
    lang_base.setup_cmd(prefix, ('rbenv', 'download', version))
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/lang_base.py", line 87, in setup_cmd
    cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs)
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/util.py", line 110, in cmd_output_b
    raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/bash', '/home/ikon/.cache/pre-commit/repojsg3zf75/rbenv-2.7.8/bin/rbenv', 'download', '2.7.8')
return code: 1
stdout:
    Download and extract ruby 2.7.8 from the RVM repository
stderr:
    https://rvm.io/binaries/ubuntu/22.04/x86_64/ruby-2.7.8.tar.bz2 cannot be reached
    Cannot find a built version of  '2.7.8' compiled for your current system: Ubuntu x86_64 (22.04)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/main.py", line 409, in main
    return run(args.config, store, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/commands/run.py", line 442, in run
    install_hook_envs(to_install, store)
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/repository.py", line 248, in install_hook_envs
    _hook_install(hook)
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/repository.py", line 95, in _hook_install
    lang.install_environment(
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/languages/ruby.py", line 124, in install_environment
    _install_ruby(prefix, version)
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/languages/ruby.py", line 111, in _install_ruby
    lang_base.setup_cmd(prefix, ('rbenv', 'install', version))
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/lang_base.py", line 87, in setup_cmd
    cmd_output_b(*cmd, cwd=prefix.prefix_dir, **kwargs)
  File "/home/linuxbrew/.linuxbrew/Cellar/pre-commit/3.2.1/libexec/lib/python3.11/site-packages/pre_commit/util.py", line 110, in cmd_output_b
    raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/bash', '/home/ikon/.cache/pre-commit/repojsg3zf75/rbenv-2.7.8/bin/rbenv', 'install', '2.7.8')
return code: 2
stdout: (none)
stderr:
    ruby-build: definition not found: 2.7.8
    
    See all available versions with `rbenv install --list'.
    
    If the version you need is missing, try upgrading ruby-build.
@jalessio
Copy link
Contributor

@vadviktor PR #2846 should address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants