Repository: pre-commit/pre-commit
Issue: /dev/null not found with pre-commit 3.0.2

### search you tried in the issue tracker

/dev/null

### describe your issue

After upgrading to pre-commit 3.0.2, one of my users (on up-to-date macos) is reporting that invoking ruby actions fails with `/dev/null` not found.

Relevant output:

```
rubocop..................................................................Failed
- hook id: rubocop
- exit code: 2

/dev/null not found
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler/definition.rb:36:in `build'
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler.rb:207:in `definition'
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/bundler.rb:190:in `load'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:270:in `gem_config_path'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:65:in `block (2 levels) in resolve_inheritance_from_gems'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:63:in `reverse_each'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:63:in `block in resolve_inheritance_from_gems'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:57:in `each_pair'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader_resolver.rb:57:in `resolve_inheritance_from_gems'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader.rb:49:in `load_file'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_loader.rb:104:in `configuration_from_file'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_store.rb:68:in `for_dir'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/config_store.rb:47:in `for_pwd'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/cli.rb:147:in `apply_default_formatter'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/lib/rubocop/cli.rb:47:in `run'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/exe/rubocop:19:in `block in <top (required)>'
/Users/user/.rvm/rubies/ruby-3.1.3/lib/ruby/3.1.0/benchmark.rb:311:in `realtime'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/gems/rubocop-1.42.0/exe/rubocop:19:in `<top (required)>'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/rubocop:25:in `load'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/rubocop:25:in `<main>'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/ruby_executable_hooks:22:in `eval'
/Users/user/.cache/pre-commit/repojquw8lys/rbenv-default/gems/bin/ruby_executable_hooks:22:in `<main>'
```

This looks closely related to #2727.

For what it's worth, I did confirm that the user actually has a working `/dev/null` on their system.

### pre-commit --version

pre-commit 3.0.2

### .pre-commit-config.yaml

```yaml
repos:
- repo: https://github.com/rubocop/rubocop.git
  rev: '0f7416a0b3ea4a3d4edb1f2091ce8706ea3e6640'
  hooks:
    - id: rubocop
      additional_dependencies: ["standard:1.22.1"]
```


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

_No response_

Changed files:
tests/languages/ruby_test.py, pre_commit/languages/ruby.py

diff --git a/pre_commit/languages/ruby.py b/pre_commit/languages/ruby.py
index b4d4b45..4416f72 100644
--- a/pre_commit/languages/ruby.py
+++ b/pre_commit/languages/ruby.py
@@ -39,7 +39,6 @@ def get_env_patch(
         ('GEM_HOME', os.path.join(venv, 'gems')),
         ('GEM_PATH', UNSET),
         ('BUNDLE_IGNORE_CONFIG', '1'),
-        ('BUNDLE_GEMFILE', os.devnull),
     )
     if language_version == 'system':
         patches += (
diff --git a/tests/languages/ruby_test.py b/tests/languages/ruby_test.py
index b312c7f..9cfaad5 100644
--- a/tests/languages/ruby_test.py
+++ b/tests/languages/ruby_test.py
@@ -123,8 +123,9 @@ def test_ruby_hook_language_version(tmp_path):
 def test_ruby_with_bundle_disable_shared_gems(tmp_path):
     workdir = tmp_path.joinpath('workdir')
     workdir.mkdir()
-    # this Gemfile is missing `source`
-    workdir.joinpath('Gemfile').write_text('gem "lol_hai"\\n')
+    # this needs a `source` or there's a deprecation warning
+    # silencing this with `BUNDLE_GEMFILE` breaks some tools (#2739)
+    workdir.joinpath('Gemfile').write_text('source ""\\ngem "lol_hai"\\n')
     # this bundle config causes things to be written elsewhere
     bundle = workdir.joinpath('.bundle')
     bundle.mkdir()
@@ -134,5 +135,5 @@ def test_ruby_with_bundle_disable_shared_gems(tmp_path):
     )
 
     with cwd(workdir):
-        # `3.2.0` has new enough `gem` requiring `source` and reading `.bundle`
+        # `3.2.0` has new enough `gem` reading `.bundle`
         test_ruby_hook_language_version(tmp_path)