[MacRuby] #905: Can't install the rubygems that create a file in "/usr/bin/".
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- {{{ $ sudo rm -rf /Library/Frameworks/MacRuby.framework/ $ git pull $ rake clean $ RC_ARCHS=x86_64 rake jobs=2 $ sudo rake install $ sudo macgem install hotcocoa ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - open() failed $ sudo macgem install nokogiri unknown: warning: ignoring alias unknown: warning: ignoring alias unknown: warning: ignoring alias unknown: warning: ignoring alias unknown: warning: ignoring alias unknown: warning: ignoring alias ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - open() failed $ sudo macgem install json ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - open() failed $ sudo macgem install sqlite3-ruby unknown: warning: ignoring alias unknown: warning: ignoring alias unknown: warning: ignoring alias Building native extensions. This could take a while... Successfully installed sqlite3-ruby-1.3.1 1 gem installed }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/905> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): The value of the variable in rb_file_open when an error occurs is as follows. {{{ $ sudo macgem install hotcocoa filepath = "/usr/bin/hotcocoa" flags = 2 perm = 493 }}} I reinstall the Mac OS 10.6 just recently, and there is not "/usr/bin/hotcocoa". -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:1> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): Can't install the rubygems since r4489. With r4488: {{{ $ git log | head -7 commit 70eb20b9d10f372209cf3fa8f1b701b6dcd2cc3b Author: lsansonetti@apple.com <lsansonetti@apple.com@23306eb0-4c56-4727 -a40e-e92c0eb68959> Date: Wed Sep 1 23:21:37 2010 +0000 Sandbox.new can now accept a custom profile string (as a scheme expression) git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4488 23306eb0-4c56-4727-a40e-e92c0eb68959 $ sudo rm /usr/bin/hotcocoa $ sudo macgem install hotcocoa Successfully installed hotcocoa-0.5.1 1 gem installed }}} With r4489: {{{ $ git log | head -11 commit 0d8fb3861c474c9306758fbe521c8c3c04260464 Author: martinlagardette@apple.com <martinlagardette@apple.com@23306eb0-4c56-4727-a40e-e92c0eb68959> Date: Thu Sep 2 02:16:14 2010 +0000 macgem asks confirmation before overriding binaries w/ different shebang - Fixes #766 git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4489 23306eb0-4c56-4727-a40e-e92c0eb68959 $ sudo rm /usr/bin/hotcocoa $ sudo macgem install hotcocoa ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - open() failed }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:2> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): Can install the rubygems with r4489 only when the file to which shebang is written exists. {{{ $ sudo rm /usr/bin/hotcocoa $ /Users/watson/src/MacRuby% sudo macgem install hotcocoa ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - open() failed $ sudo touch /usr/bin/hotcocoa $ sudo macgem install hotcocoa ERROR: While executing gem ... (EOFError) end of file reached $ echo '#!ruby' | sudo tee -i /usr/bin/hotcocoa #!ruby $ sudo macgem install hotcocoa WARNING: You are installing a new version of /usr/bin/hotcocoa. This file already exists with a different shebang, possibly from a different ruby implementation or version. This operation may break the script. Do you still wish to continue? [yn] y Successfully installed hotcocoa-0.5.1 1 gem installed }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:3> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: 0.7-blocker ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * keywords: => 0.7-blocker Comment: It looks like a bug in thibault's change indeed. It must be fixed for 0.7. Thanks for finding it! -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:4> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: 0.7-blocker ----------------------------------+----------------------------------------- Comment(by watson1978@…): I atach a pach. {{{ #!diff diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 999a1be..7c1b28e 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -325,13 +325,21 @@ class Gem::Installer # FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers bin_script_exists = File.exists?(bin_script_path) + mode = 'w' unless(bin_script_exists) + mode ||= 'r+' new_shebang = shebang(filename) - File.open bin_script_path, 'r+', 0755 do |file| + File.open bin_script_path, mode, 0755 do |file| if bin_script_exists # If the first line is different than the shebang we want to insert # we are probably overwriting a script installed by another ruby # implementation / version - if file.readline.chomp != new_shebang + begin + old_shebang = file.readline.chomp + rescue + old_shebang = "" + end + + if old_shebang != new_shebang warn = <<-WARN_MESSAGE You are installing a new version of #{bin_script_path}. This file already exists with a different shebang, possibly from a different }}} Result: {{{ $ sudo rm /usr/bin/hotcocoa $ sudo macgem install hotcocoaSuccessfully installed hotcocoa-0.5.1 1 gem installed $ sudo rm /usr/bin/hotcocoa $ sudo touch /usr/bin/hotcocoa $ sudo macgem install hotcocoa WARNING: You are installing a new version of /usr/bin/hotcocoa. This file already exists with a different shebang, possibly from a different ruby implementation or version. This operation may break the script. Do you still wish to continue? [yn] y Successfully installed hotcocoa-0.5.1 1 gem installed $ sudo rm /usr/bin/hotcocoa $ echo '#!ruby' | sudo tee -i /usr/bin/hotcocoa#!ruby $ sudo macgem install hotcocoa WARNING: You are installing a new version of /usr/bin/hotcocoa. This file already exists with a different shebang, possibly from a different ruby implementation or version. This operation may break the script. Do you still wish to continue? [yn] y Successfully installed hotcocoa-0.5.1 1 gem installed }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:5> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: 0.7-blocker ----------------------------------+----------------------------------------- Comment(by lsansonetti@…): Thanks, please commit :) -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:6> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: fixed Keywords: 0.7-blocker | ----------------------------------+----------------------------------------- Changes (by watson1978@…): * status: new => closed * resolution: => fixed Comment: Thank you! Should be fixed in r4521. -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:7> MacRuby <http://macruby.org/>
#905: Can't install the rubygems that create a file in "/usr/bin/". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.7 Component: MacRuby | Resolution: fixed Keywords: 0.7-blocker | ----------------------------------+----------------------------------------- Changes (by watson1978@…): * milestone: => MacRuby 0.7 -- Ticket URL: <http://www.macruby.org/trac/ticket/905#comment:8> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby