Skip to content

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

@vadviktor

Description

@vadviktor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions