Skip to content

Instantly share code, notes, and snippets.

@rsutphin
Created July 17, 2013 20:16
Show Gist options
  • Select an option

  • Save rsutphin/6024046 to your computer and use it in GitHub Desktop.

Select an option

Save rsutphin/6024046 to your computer and use it in GitHub Desktop.
Bizarre Kernel.exec problem caused by "dropbox" gem
require 'bundler/setup'
Bundler.require :default
Kernel.exec ['/bin/ls', '/bin/ls'], '-al'

bundle install, then:

$ ruby the_problem.rb 
the_problem.rb:4:in `exec': No such file or directory - -al (Errno::ENOENT)
  from the_problem.rb:4:in `<main>'

Without dropbox:

$ ruby -e "Kernel.exec ['/bin/ls', '/bin/ls'], '-al'"
total 112
drwxr-xr-x  9 rsutphin  CB\Domain Users    306 Jul 17 14:57 .
drwxr-xr-x  5 rsutphin  CB\Domain Users    170 Jul 17 14:42 ..
-rw-r--r--  1 rsutphin  CB\Domain Users     45 Jul 17 15:09 Gemfile
-rw-r--r--  1 rsutphin  CB\Domain Users    246 Jul 17 14:58 Gemfile.lock
-rw-r--r--  1 rsutphin  CB\Domain Users     92 Jul 17 15:11 the_problem.rb

(i.e., the output from ls -al.)

The ultimate culprit is this code in dropbox/extensions/array.rb:

class Array # :nodoc:
  # [...]

  def to_hash # :nodoc:
    inject({}) { |hsh, (k,v)| hsh[k] = v  ; hsh }
  end unless method_defined?(:to_hash)
end
source 'https://rubygems.org'
gem 'dropbox'
@brettporter

Copy link
Copy Markdown

The 'extlib' gem will cause the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment