ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:83202] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
@ 2017-10-10 22:54 ` hone02
  2017-10-11  9:07 ` [ruby-core:83204] " eregontp
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: hone02 @ 2017-10-10 22:54 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been reported by hone (Terence Lee).

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997

* Author: hone (Terence Lee)
* Status: Open
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83204] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
  2017-10-10 22:54 ` [ruby-core:83202] [Ruby trunk Bug#13997] Bundler gem binstub broken hone02
@ 2017-10-11  9:07 ` eregontp
  2017-10-11 10:40 ` [ruby-core:83206] [Ruby trunk Bug#13997][Feedback] " hsbt
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: eregontp @ 2017-10-11  9:07 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by Eregon (Benoit Daloze).


That binstub looks wrong, I would guess it's Bundler's bug.
After /bin/sh should be shell code, and after the # ruby comment Ruby code.


----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-67151

* Author: hone (Terence Lee)
* Status: Open
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83206] [Ruby trunk Bug#13997][Feedback] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
  2017-10-10 22:54 ` [ruby-core:83202] [Ruby trunk Bug#13997] Bundler gem binstub broken hone02
  2017-10-11  9:07 ` [ruby-core:83204] " eregontp
@ 2017-10-11 10:40 ` hsbt
  2017-10-11 20:09 ` [ruby-core:83218] [Ruby trunk Bug#13997] " hone02
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: hsbt @ 2017-10-11 10:40 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hsbt (Hiroshi SHIBATA).

Status changed from Open to Feedback

Thanks, Terence.

```/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle``` is not default gem environment on Ruby 2.5.0preview1.

Can you show reproduce instructions for this issue?



----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-67153

* Author: hone (Terence Lee)
* Status: Feedback
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83218] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2017-10-11 10:40 ` [ruby-core:83206] [Ruby trunk Bug#13997][Feedback] " hsbt
@ 2017-10-11 20:09 ` hone02
  2017-10-11 22:29 ` [ruby-core:83220] " hone02
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: hone02 @ 2017-10-11 20:09 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hone (Terence Lee).


Eregon (Benoit Daloze) wrote:
> That binstub looks wrong, I would guess it's Bundler's bug.
> After /bin/sh should be shell code, and after the # ruby comment Ruby code.

This is the binstub generated from Ruby's vendored bundler (in the exe folder)

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
#!/usr/bin/env ruby
# frozen_string_literal: true

# Exit cleanly from an early interrupt
Signal.trap("INT") do
  Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler)
  exit 1
end

require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
  next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
  err = String.new
  err << "Looks like you have a version of bundler that's older than 0.9.\n"
  err << "Please remove your old versions.\n"
  err << "An easy way to do this is by running `gem cleanup bundler`."
  abort(err)
end

require "bundler/friendly_errors"
Bundler.with_friendly_errors do
  require "bundler/cli"

  # Allow any command to use --help flag to show help for that command
  help_flags = %w(--help -h)
  help_flag_used = ARGV.any? {|a| help_flags.include? a }
  args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV

  Bundler::CLI.start(args, :debug => true)
end
~~~

Bundler's binstub normally looks like this:

~~~
#!/usr/bin/env ruby
# frozen_string_literal: true

# Exit cleanly from an early interrupt
Signal.trap("INT") { exit 1 }

update = "update".start_with?(ARGV.first || " ") && ARGV.find {|a| a.start_with?("--bundler") }
update &&= update =~ /--bundler(?:=(.+))?/ && $1 || "> 0.a"
ENV["BUNDLER_VERSION"] = update if update
require "bundler/postit_trampoline"

require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
  next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
  err = String.new
  err << "Looks like you have a version of bundler that's older than 0.9.\n"
  err << "Please remove your old versions.\n"
  err << "An easy way to do this is by running `gem cleanup bundler`."
  abort(err)
end

require "bundler/friendly_errors"
Bundler.with_friendly_errors do
  require "bundler/cli"

  # Allow any command to use --help flag to show help for that command
  help_flags = %w(--help -h)
  help_flag_used = ARGV.any? {|a| help_flags.include? a }
  args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV

  Bundler::CLI.start(args, :debug => true)
end
~~~

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-67169

* Author: hone (Terence Lee)
* Status: Feedback
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83220] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2017-10-11 20:09 ` [ruby-core:83218] [Ruby trunk Bug#13997] " hone02
@ 2017-10-11 22:29 ` hone02
  2017-10-12  9:27 ` [ruby-core:83233] " eregontp
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: hone02 @ 2017-10-11 22:29 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hone (Terence Lee).


hsbt (Hiroshi SHIBATA) wrote:
> Thanks, Terence.
> 
> ```/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle``` is not default gem environment on Ruby 2.5.0preview1.
> 
> Can you show reproduce instructions for this issue?

```/tmp/bundler/``` is just the directory where I unpacked Ruby 2.5.0.

I investigated some more and it looks like Benoit is partially right. Thanks for pointing me in the right direction! On Heroku we use ```--enable-load-relative``` configure option for compiling ruby, which adds the shell portion to the ```bundle``` file.

Without ```--enable-load-relative```, the binstub looks like this:

```ruby
#!/tmp/rubytest2/bin/ruby
# frozen_string_literal: true

# Exit cleanly from an early interrupt
Signal.trap("INT") do
  Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler)
  exit 1
end

require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
  next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
  err = String.new
  err << "Looks like you have a version of bundler that's older than 0.9.\n"
  err << "Please remove your old versions.\n"
  err << "An easy way to do this is by running `gem cleanup bundler`."
  abort(err)
end

require "bundler/friendly_errors"
Bundler.with_friendly_errors do
  require "bundler/cli"

  # Allow any command to use --help flag to show help for that command
  help_flags = %w(--help -h)
  help_flag_used = ARGV.any? {|a| help_flags.include? a }
  args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV

  Bundler::CLI.start(args, :debug => true)
end

```

With `--enable-load-relative` set:

```ruby
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
#!/usr/bin/env ruby
# frozen_string_literal: true

# Exit cleanly from an early interrupt
Signal.trap("INT") do
  Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler)
  exit 1
end

require "bundler"
# Check if an older version of bundler is installed
$LOAD_PATH.each do |path|
  next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9
  err = String.new
  err << "Looks like you have a version of bundler that's older than 0.9.\n"
  err << "Please remove your old versions.\n"
  err << "An easy way to do this is by running `gem cleanup bundler`."
  abort(err)
end

require "bundler/friendly_errors"
Bundler.with_friendly_errors do
  require "bundler/cli"

  # Allow any command to use --help flag to show help for that command
  help_flags = %w(--help -h)
  help_flag_used = ARGV.any? {|a| help_flags.include? a }
  args = help_flag_used ? Bundler::CLI.reformatted_help_args(ARGV) : ARGV

  Bundler::CLI.start(args, :debug => true)
end
```

As for steps to reproduce:

Install Ruby 2.5.0-preview1

* ```./configure --enable-load-relative --prefix /tmp/rubytest```
* ```make```
* ```make install```

Setup ```$PATH```

Ensure rubygems binstubs is on the ```$PATH``` that precedes ruby's binstubs. We want rubygems binaries to win over ruby's.
For example, assuming the rubygems binstubs live at ```/home/hone/.gems/bin```, ```$PATH``` should be setup like this:

```
export PATH=/home/hone/.gems/bin:/tmp/rubytest/bin:$PATH
```

Run the `bundle` command

```
$ bundle -v
Traceback (most recent call last):
        1: from /home/hone/.gems/bin/bundle:22:in `<main>'
/home/hone/.gems/bin/bundle:22:in `load': /tmp/rubytest/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/rubytest/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
```

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-67170

* Author: hone (Terence Lee)
* Status: Feedback
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83233] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2017-10-11 22:29 ` [ruby-core:83220] " hone02
@ 2017-10-12  9:27 ` eregontp
  2017-10-12 18:34 ` [ruby-core:83240] " hone02
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: eregontp @ 2017-10-12  9:27 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by Eregon (Benoit Daloze).


So #load indeed does not support this skipping-until-ruby-shebang logic that `ruby file` does.

I wonder why Bundle is trying to load a binary.
To save some time over creating another Ruby process?

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-67186

* Author: hone (Terence Lee)
* Status: Feedback
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83240] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2017-10-12  9:27 ` [ruby-core:83233] " eregontp
@ 2017-10-12 18:34 ` hone02
  2017-11-28  1:26 ` [ruby-core:83898] " mail
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: hone02 @ 2017-10-12 18:34 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hone (Terence Lee).


Eregon (Benoit Daloze) wrote:
> So #load indeed does not support this skipping-until-ruby-shebang logic that `ruby file` does.
> 
> I wonder why Bundle is trying to load a binary.
> To save some time over creating another Ruby process?

Ah, I see what you're saying.

After some more inspection, it looks like there's something weird going on with how bundler's files in ```exe/``` are generated. This is bundler's file:

```ruby
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
#!/usr/bin/env ruby
# frozen_string_literal: true

load File.expand_path("../bundle", __FILE__)

```

This is rake's file:

```ruby
$ cat /tmp/rubytest/lib/ruby/gems/2.5.0/gems/rake-12.1.0/exe/rake 
#!/usr/bin/env ruby

#--
# Copyright (c) 2003, 2004, 2005, 2006, 2007  Jim Weirich
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#++

require "rake"

Rake.application.run
```

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-67191

* Author: hone (Terence Lee)
* Status: Feedback
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83898] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (6 preceding siblings ...)
  2017-10-12 18:34 ` [ruby-core:83240] " hone02
@ 2017-11-28  1:26 ` mail
  2017-11-29  8:48 ` [ruby-core:83961] [Ruby trunk Bug#13997][Third Party's Issue] " hsbt
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: mail @ 2017-11-28  1:26 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by indirect (André Arko).


@hsbt do you think the difference between Terence's `rake` and `bundle` files is because one is a default gem and the other is not?

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-67944

* Author: hone (Terence Lee)
* Status: Feedback
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83961] [Ruby trunk Bug#13997][Third Party's Issue] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (7 preceding siblings ...)
  2017-11-28  1:26 ` [ruby-core:83898] " mail
@ 2017-11-29  8:48 ` hsbt
  2017-11-30  6:40 ` [ruby-core:83993] [Ruby trunk Bug#13997] " hone02
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: hsbt @ 2017-11-29  8:48 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hsbt (Hiroshi SHIBATA).

Status changed from Feedback to Third Party's Issue

@hone

Can you reproduce without rvm environment?

I think it's problem for ruby_executable_hooks with rvm. like followings.

* https://stackoverflow.com/questions/32308978/ruby-file-ruby-executable-hooks-syntax-error
* https://stackoverflow.com/questions/32186242/rake-dbmigrate-doesnt-work-after-ruby-2-2-2-to-2-2-3-upgrade-via-rvm



----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-68031

* Author: hone (Terence Lee)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83993] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (8 preceding siblings ...)
  2017-11-29  8:48 ` [ruby-core:83961] [Ruby trunk Bug#13997][Third Party's Issue] " hsbt
@ 2017-11-30  6:40 ` hone02
  2017-11-30  7:32 ` [ruby-core:83995] " hsbt
  2017-12-07 20:51 ` [ruby-core:84125] [Ruby trunk Bug#13997][Closed] " hone02
  11 siblings, 0 replies; 12+ messages in thread
From: hone02 @ 2017-11-30  6:40 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hone (Terence Lee).


hsbt (Hiroshi SHIBATA) wrote:
> @hone
> 
> Can you reproduce without rvm environment?
> 
> I think it's problem for ruby_executable_hooks with rvm. like followings.
> 
> * https://stackoverflow.com/questions/32308978/ruby-file-ruby-executable-hooks-syntax-error
> * https://stackoverflow.com/questions/32186242/rake-dbmigrate-doesnt-work-after-ruby-2-2-2-to-2-2-3-upgrade-via-rvm

Hi @hsbt, we don't use RVM on Heroku at all. This is just my local machine.

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-68072

* Author: hone (Terence Lee)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:83995] [Ruby trunk Bug#13997] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (9 preceding siblings ...)
  2017-11-30  6:40 ` [ruby-core:83993] [Ruby trunk Bug#13997] " hone02
@ 2017-11-30  7:32 ` hsbt
  2017-12-07 20:51 ` [ruby-core:84125] [Ruby trunk Bug#13997][Closed] " hone02
  11 siblings, 0 replies; 12+ messages in thread
From: hsbt @ 2017-11-30  7:32 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hsbt (Hiroshi SHIBATA).


I've confused because your first report says.

```
>/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22...
```

I try your instructions. but I couldn't reproduce it. In current trunk:

```
./configure --with-openssl-dir=/usr/local/opt/openssl --prefix=$HOME/.rbenv/versions/trunk --enable-load-relative
make
make install
```

I got this.

```ruby
~ > cat ~/.rbenv/versions/trunk/bin/bundle
#!/bin/sh
# -*- ruby -*-
_=_\
=begin
bindir="${0%/*}"
exec "$bindir/ruby" "-x" "$0" "$@"
=end
#!/usr/bin/env ruby
# frozen_string_literal: true

# Exit cleanly from an early interrupt
Signal.trap("INT") do
  Bundler.ui.debug("\n#{caller.join("\n")}") if defined?(Bundler)
  exit 1
(snip)
```

It fixed r60174 maybe. Can you try current HEAD(r60928)?


----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-68074

* Author: hone (Terence Lee)
* Status: Third Party's Issue
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [ruby-core:84125] [Ruby trunk Bug#13997][Closed] Bundler gem binstub broken
       [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
                   ` (10 preceding siblings ...)
  2017-11-30  7:32 ` [ruby-core:83995] " hsbt
@ 2017-12-07 20:51 ` hone02
  11 siblings, 0 replies; 12+ messages in thread
From: hone02 @ 2017-12-07 20:51 UTC (permalink / raw
  To: ruby-core

Issue #13997 has been updated by hone (Terence Lee).

Status changed from Assigned to Closed

hsbt (Hiroshi SHIBATA) wrote:
> It fixed r60174 maybe. Can you try current HEAD(r60928)?

Hi @hsbt, thanks for looking into this. It's fixed as far as I can tell. I'm going to close it. I did a git bisect and r60171 fixed it. Thank you @nobu!

----------------------------------------
Bug #13997: Bundler gem binstub broken
https://bugs.ruby-lang.org/issues/13997#change-68225

* Author: hone (Terence Lee)
* Status: Closed
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
* Target version: 2.5
* ruby -v: ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-linux]
* Backport: 
----------------------------------------
Hi,

In Ruby 2.5.0-preview1, I'm seeing the following error if the Rubygems binstub PATH precedes the binstubs from ruby and the Bundler version installed is <= 1.15.4 (what ruby vendors).

~~~
/home/hone/.rvm/gems/ruby-2.4.1@global/bin/bundle:22:in `load': /tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "$0" "$@"
                       ^
/tmp/bundler/lib/ruby/gems/2.5.0/gems/bundler-1.15.4/exe/bundle:9: syntax error, unexpected keyword_do_block, expecting end-of-input
Signal.trap("INT") do
~~~

The reason for this is because the generated bundler binstub by rubygems runs code like this:

~~~
load Gem.bin_path('bundler', 'bundle', '>= 0.a')
~~~

The problem is that the binstub from the vendored bundler in ruby is not pure ruby:

~~~
#!/bin/sh
# -*- ruby -*-
bindir="${0%/*}"
exec "$bindir/ruby" -x "$0" "$@"
~~~

The top of this file is shell and not ruby. Kernel#load chokes on this.

Thanks,
Terence



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-12-07 20:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-13997.20171010225414@ruby-lang.org>
2017-10-10 22:54 ` [ruby-core:83202] [Ruby trunk Bug#13997] Bundler gem binstub broken hone02
2017-10-11  9:07 ` [ruby-core:83204] " eregontp
2017-10-11 10:40 ` [ruby-core:83206] [Ruby trunk Bug#13997][Feedback] " hsbt
2017-10-11 20:09 ` [ruby-core:83218] [Ruby trunk Bug#13997] " hone02
2017-10-11 22:29 ` [ruby-core:83220] " hone02
2017-10-12  9:27 ` [ruby-core:83233] " eregontp
2017-10-12 18:34 ` [ruby-core:83240] " hone02
2017-11-28  1:26 ` [ruby-core:83898] " mail
2017-11-29  8:48 ` [ruby-core:83961] [Ruby trunk Bug#13997][Third Party's Issue] " hsbt
2017-11-30  6:40 ` [ruby-core:83993] [Ruby trunk Bug#13997] " hone02
2017-11-30  7:32 ` [ruby-core:83995] " hsbt
2017-12-07 20:51 ` [ruby-core:84125] [Ruby trunk Bug#13997][Closed] " hone02

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).