ruby / ruby/rubygems

Bundler re-exec breaks programs read from standard input

Open
#8,329 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Bundler
Dominant language
Ruby
Stars
4k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
81

Description

This is closely related to #8106.

Since commit https://github.com/rubygems/rubygems/commit/076aba8b1c25291a986f9c233cb80192adbe2fcf it's not possible to reliably feed a program to ruby on standard input.

If:

  • Gemfile.lock was created by a version of bundler which is not in the global gem list; AND
  • bundled gems are installed in a vendored directory; AND
  • program is read from standard input,

Then:

  • the program does not execute.
Files

bug.rb

require 'bundler/setup'
puts Bundler::VERSION

Gemfile

source 'https://rubygems.org'

Gemfile.lock (note: assuming 2.5.22 is not in the global gemset)

GEM
  remote: https://rubygems.org/
  specs:

PLATFORMS
  ruby
  x86_64-linux

DEPENDENCIES

BUNDLED WITH
   2.5.22
Steps to reproduce
$ bundle config set deployment true
$ bundle install
Bundler 2.5.23 is running, but your lockfile was generated with 2.5.22. Installing Bundler 2.5.22 and restarting using that version.
Fetching gem metadata from https://rubygems.org/.
Fetching bundler 2.5.22
Installing bundler 2.5.22
The Gemfile specifies no dependencies
Bundle complete! 0 Gemfile dependencies, 1 gem now installed.
Bundled gems are installed into `./vendor/bundle`

$ ruby bug.rb
2.5.22
$ ruby < bug.rb
$

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with bug.rb, Gemfile, and Gemfile.lock using the deployment install steps, then compare stdin execution with ruby bug.rb. Start by reading the Bundler re-exec behavior introduced in commit 076aba8b1c25291a986f9c233cb80192adbe2fcf. Done means ruby < bug.rb executes and prints Bundler::VERSION under the specified lockfile and vendor conditions.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.