Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Arch Linux 3.10.18 ARM V7 -- command Bundle init crash #6219

Closed
aperfeito opened this issue Dec 21, 2017 · 10 comments
Closed

Arch Linux 3.10.18 ARM V7 -- command Bundle init crash #6219

aperfeito opened this issue Dec 21, 2017 · 10 comments

Comments

@aperfeito
Copy link

[aperfeito@alarm /]$ ./home/aperfeito/.gem/bin/bundle init
--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error Report

Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

  • What did you do?

    I ran the command ./home/aperfeito/.gem/bin/bundle init

  • What did you expect to happen?

    I expected Bundler to...

  • What happened instead?

    Instead, what happened was...

  • Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?

    I tried...

  • Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?

    ...

Backtrace

Errno::EACCES: Permission denied @ rb_sysopen - Gemfile
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1290:in `initialize'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1290:in `open'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1290:in `block in copy_file'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1289:in `open'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1289:in `copy_file'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:430:in `copy_file'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:357:in `block in cp'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1461:in `block in fu_each_src_dest'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1477:in `fu_each_src_dest0'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:1459:in `fu_each_src_dest'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/fileutils/lib/fileutils.rb:356:in `cp'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/cli/init.rb:30:in `run'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/cli.rb:148:in `init'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/cli.rb:27:in `dispatch'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/cli.rb:18:in `start'
  /home/aperfeito/.gem/gems/bundler-1.16.1/exe/bundle:30:in `block in <top (required)>'
  /home/aperfeito/.gem/gems/bundler-1.16.1/lib/bundler/friendly_errors.rb:122:in `with_friendly_errors'
  /home/aperfeito/.gem/gems/bundler-1.16.1/exe/bundle:22:in `<top (required)>'
  ./home/aperfeito/.gem/bin/bundle:23:in `load'
  ./home/aperfeito/.gem/bin/bundle:23:in `<main>'

Environment

Bundler       1.16.1
  Platforms   ruby, armv7l-linux
Ruby          2.4.3p205 (2017-12-14 revision 61247) [armv7l-linux-eabihf]
  Full Path   /usr/bin/ruby
  Config Dir  /etc
RubyGems      2.6.14
  Gem Home    /home/aperfeito/.gem
  Gem Path    /home/aperfeito/.gem/ruby/2.4.0:/usr/lib/ruby/gems/2.4.0:/home/aperfeito/.gem
  User Path   /home/aperfeito/.gem/ruby/2.4.0
  Bin Dir     /home/aperfeito/.gem/bin
Tools         
  Git         2.15.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Built At          2017-12-21
Git SHA           0034ef341
Released Version  true

--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=Permission+denied+%40+rb_sysopen+-+Gemfile&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data!

@aperfeito aperfeito changed the title Arch Linux 3.10.18 ARM V7 -- commnad Bundle init crash Arch Linux 3.10.18 ARM V7 -- command Bundle init crash Dec 21, 2017
@colby-swandale
Copy link
Member

It looks like you don't have permission to read the Gemfile template inside the Bundler gem. I suggest checking the user permissions inside the gem and set them appropriately

@segiddins
Copy link
Member

We should probably be printing a better error here, though

@aperfeito
Copy link
Author

aperfeito commented Dec 26, 2017 via email

@nilsding
Copy link
Contributor

From what I see here, the problem is that he tried running bundle init inside the root directory /; which in most (if not all) Unices leads to permission problems since it's only writable by the root user.

Have you tried to run this command inside a directory in your home directory, e.g. /home/aperfeito/mygem?

@colby-swandale
Copy link
Member

oh nice catch @nilsding! Looking intolib/bundler/vendor/fileutils/lib/fileutils.rb:1290, FileUtils is trying to open a new file and write to it.

@aperfeito
Copy link
Author

aperfeito commented Jan 20, 2018

Colby ,
Good Morning ! I follow this steps below

https://wiki.archlinux.org/index.php/ruby#Installing_gems_per-user_or_system-wide

and I stuck in this step:
To start a new bundle:

$ bundle init
Crash report above

Directory structure:

[aperfeito@alarm ~]$ cd .gem
[aperfeito@alarm .gem]$ ls
bin build_info cache doc extensions gems specifications specs
[aperfeito@alarm .gem]$ cd bin
[aperfeito@alarm bin]$ ls
bundle bundler
[aperfeito@alarm bin]$

@nilsding
Copy link
Contributor

@aperfeito in which directory are you trying to run bundle init?

What is the output of the following commands:

pwd; ls -ld $(pwd)

@aperfeito
Copy link
Author

/home/aperfeito/.gem
drwxr-xr-x 10 aperfeito users 4096 Dec 21 13:22 /home/aperfeito/.gem

@aperfeito
Copy link
Author

/home/aperfeito/.gem/bin
drwxr-xr-x 2 aperfeito users 4096 Dec 21 13:22 /home/aperfeito/.gem/bin

bundlerbot added a commit that referenced this issue Jan 30, 2018
[Init] Check if the current directory is writeable

### What was the end-user problem that led to this PR?

The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace.  In the mentioned PR @segiddins suggested to print out a better error message.  This PR addresses that.

### What was your diagnosis of the problem?

See [this comment on said PR](#6219 (comment)).

### What is your fix for the problem, implemented in this PR?

My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`.  If that's not the case, print out an error and exit.

### Why did you choose this fix out of the possible options?

I chose this fix because... it was really simple to implement.
@segiddins
Copy link
Member

Can we close this as #6266 was merged?

colby-swandale pushed a commit that referenced this issue Apr 11, 2018
[Init] Check if the current directory is writeable

### What was the end-user problem that led to this PR?

The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace.  In the mentioned PR @segiddins suggested to print out a better error message.  This PR addresses that.

### What was your diagnosis of the problem?

See [this comment on said PR](#6219 (comment)).

### What is your fix for the problem, implemented in this PR?

My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`.  If that's not the case, print out an error and exit.

### Why did you choose this fix out of the possible options?

I chose this fix because... it was really simple to implement.

(cherry picked from commit c4b022c)
colby-swandale pushed a commit that referenced this issue Apr 20, 2018
[Init] Check if the current directory is writeable

### What was the end-user problem that led to this PR?

The problem was that when running `bundle init` inside a directory which is not writable by the current user (e.g. `/` as demonstrated in #6219) Bundler prints out an `EACCES` error with a huge backtrace.  In the mentioned PR @segiddins suggested to print out a better error message.  This PR addresses that.

### What was your diagnosis of the problem?

See [this comment on said PR](#6219 (comment)).

### What is your fix for the problem, implemented in this PR?

My fix is simple: adding a check whether the current directory is writeable before trying to create `gems.rb`/`Gemfile`.  If that's not the case, print out an error and exit.

### Why did you choose this fix out of the possible options?

I chose this fix because... it was really simple to implement.

(cherry picked from commit c4b022c)
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Sep 23, 2018
## 1.16.5 (2018-09-18)

Changes:

  - Add support for TruffleRuby (@eregon)

Bugfixes:

  - Avoid printing git errors when checking the version on incorrectly packaged versions of Bundler ([#6453](rubygems/bundler#6453), @greysteil)
  - Fix issue where Bundler does not check the given class when comparing equality in DepProxy (@ChrisBr)
  - Handle `RangeNotSatisfiable` error in Compact Index (@MaxLap)
  - Check for initialized `search` variable in `LazySpecification` (@voxik)
  - Fix LoadError occurring in nested bundle exec calls ([#6537](rubygems/bundler#6537), @colby-swandale)
  - Check that Bundler::Deprecate is not an autoload constant ([#6163](rubygems/bundler#6163), @eregon)
  - Prefer non-pre-release versions when performing a `bundle update --patch` ([#6684](rubygems/bundler#6684), @segiddins)

## 1.16.4 (2017-08-17)

Changes:

  - Welcome new members to the Bundler core team (@indirect)
  - Don't mutate original error trees when determining version_conflict_message (@greysteil)
  - Update vendored Molinillo to 0.6.6 (@segiddins)

Bugfixes:

  - Reword bundle update regression message to be more clear to the user when a gem's version is downgraded ([#6584](rubygems/bundler#6584), @ralphbolo)
  - Respect --conservative flag when updating a dependency group ([#6560](rubygems/bundler#6560), @greysteil)
  - Fix issue where a pre-release version was not being selected when it's specified in the Gemfile ([#6449](rubygems/bundler#6449), @akihiro17)
  - Fix issue where `Etc` was not loaded when getting the user's home dir ([#6640](rubygems/bundler#6640), @colby-swandale)
  - Use UTF-8 for reading files including Gemfile ([#6660](rubygems/bundler#6660), @eregon)
  - Remove unnecessary `while` loop in path resolver helper (@ojab)

Documentation:

  - Document that `bundle show [--paths]` sorts results by name (@kemitchell)

## 1.16.3 (2018-07-17)

Features:

  - Support URI::File of Ruby 2.6 (@hsbt)

Bugfixes:

  - Expand symlinks during setup to allow Bundler to load correctly when using symlinks in $GEM_HOME ([#6465](rubygems/bundler#6465), @ojab, @indirect)
  - Dont let Bundler create temporary folders for gem installs which are owned by root ([#6258](rubygems/bundler#6258), @colby-swandale)
  - Don't fallback to using temporary directories when needed directories already exist ([#6546](rubygems/bundler#6546), @brodock)
  - Use SharedHelpers.filesystem_access when reading a Gemfile so friendly error messages can be given to the user ([#6541](rubygems/bundler#6541), @segiddins)
  - Check if source responds to `#remotes` before printing gem install error message ([#6211](rubygems/bundler#6211), @colby-swandale)
  - Handle Errno::ENOTSUP in the Bundler Process Lock to prevent exceptions when using NFS mounts ([#6566](rubygems/bundler#6566), @colby-swandale)
  - Respect encodings when reading gemspecs ([#6598](rubygems/bundler#6598), @deivid-rodriguez)

Documentation:

  - Fix links between manual pages (@BanzaiMan)
  - Add warning to Gemfile documentation for the use of the `source` option when declaring gems ([#6280](rubygems/bundler#6280), @forestgagnon)

## 1.16.2 (2018-04-20)

Changes:

  - Include the gem's source in the gem install error message when available (@papanikge)
  - Remove unnecessary executable bit from gem template (@voxik)
  - Dont add the timestamp comment with gems added to the Gemfile via `bundle add` ([#6193](rubygems/bundler#6193), @cpgo)
  - Improve yanked gem error message (@alyssais)
  - Use `Bundler.rubygems.inflate` instead of the Gem::Util method directly (@segiddins)
  - Remove unused instance variable (@segiddins)

Bugfixes:

  - Only trap INT signal and have Ruby's signal default handler be invoked (@shayonj)
  - Fix warning about the use of `__FILE__` in RubyGems integration testing (@MSP-Greg)
  - Skip the outdated bundler check when MD5 is not available ([#6032](rubygems/bundler#6032), @segiddins)
  - Fallback to the original error if the friendly message raises (@segiddins)
  - Rename Bundler.frozen? to avoid Object method conflict ([#6252](rubygems/bundler#6252), @segiddins)
  - Ensure the bindir exists before installing gems (@segiddins)
  - Handle gzip corruption errors in the compact index client ([#6261](rubygems/bundler#6261), @colby-swandale)
  - Check if the current directory is writeable when writing files in `bundle gem` ([#6219](rubygems/bundler#6219), @nilsding)
  - Fix hang when gemspec has incompatible encoding (@deivid-rodriguez)
  - Gracefully handle when the lockfile is missing spec entries for the current platform ([#6079](rubygems/bundler#6079), @segiddins)
  - Use Gem::Util.inflate instead of Gem.inflate (@hsbt)
  - Update binstub generator to use new ERB.new arity in Ruby 2.6 (@koic)
  - Fix `source_location` call in rubygems integration (@MSP-Greg)
  - Use `filesystem_access` when copying files in Compact Index Updater ([#6289](rubygems/bundler#6289), @segiddins)
  - Fail gracefully when resetting git gems to the given revision fails ([#6324](rubygems/bundler#6324), @segiddins)
  - Handle exceptions that do not have a backtrace ([#6342](rubygems/bundler#6342), @nesaulov)
  - Check if stderr was closed before writing to it (@shime)
  - Handle updating a specific gem for a non-local platform ([#6350](rubygems/bundler#6350), @greysteil)
  - Bump the `bundle_binstub` check-length to 300 characters (@tduffield)
  - Fix specifying alterntive Lockfile with `bundle lock` when default gemfile is present  ([#6460](rubygems/bundler#6460), @agrim123)
  - Allow installing dependencies when the path is set to `.`  ([#6475](rubygems/bundler#6475), @segiddins)
  - Support Bundler installing on a readonly filesystem without a home directory ([#6461](rubygems/bundler#6461), @grosser)
  - Filter git uri credentials in source description (@segiddins)

Documentation:

  - Correct typos in `bundle binstubs` man page (@erikj, @samueloph)
  - Update links in `bundle gem` command documentation to use https (@KrauseFx)
  - Fix broken links between bundler man pages (@segiddins)
  - Add man page for the `bundle doctor` command ([#6243](rubygems/bundler#6243), @nholden)
  - Document `# frozen_string_literal` in `bundle init` Gemfile (@315tky)
  - Explain the gemspec files attribute in `bundle gem` template and print a link to bundler.io guides when running `bundle gem` ([#6246](rubygems/bundler#6246), @nesaulov)
  - Small copy tweaks & removed redundant phrasing in the bundler man page (@rubymorillo)
  - Improve the documentation of the settings load order in Bundler (@rubymorillo)
  - Added license info to main README (@rubymorillo)
  - Document parameters and return value of Injector#inject (@tobias-grasse)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants