[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby gems install error

Artie Ziff

6/6/2008 6:55:00 AM

Hello,

I am hoping to get some ideas here. Being new to ruby, I am not familiar
enough with all the pieces to know how to diagnose my installation
issue. I am attempting to install rubygems 1.1.1 is on a RHEL4 host.

The following line (#51) was deleted:
require 'rdoc/rdoc'

# ruby -v
ruby 1.8.5 (2006-08-25) [x86_64-linux]

# cd rubygems-1.1.1
# ruby setup.rb --no-ri --no-doc

This is final 30 lines of output from setup.rb:

install -c -m 0644 rubygems/commands/query_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/query_command.rb
install -c -m 0644 rubygems/commands/dependency_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/dependency_command.rb
install -c -m 0644 rubygems/commands/mirror_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/mirror_command.rb
install -c -m 0644 rubygems/commands/unpack_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/unpack_command.rb
install -c -m 0644 rubygems/commands/sources_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/sources_command.rb
install -c -m 0644 rubygems/commands/pristine_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/pristine_command.rb
install -c -m 0644 rubygems/commands/install_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb
install -c -m 0644 rubygems/commands/check_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/check_command.rb
install -c -m 0644 rubygems/commands/help_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/help_command.rb
install -c -m 0644 rubygems/commands/search_command.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/commands/search_command.rb
mkdir -p /usr/lib/ruby/site_ruby/1.8/rubygems/package
install -c -m 0644 rubygems/package/tar_input.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb
install -c -m 0644 rubygems/package/tar_reader.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb
install -c -m 0644 rubygems/package/f_sync_dir.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/package/f_sync_dir.rb
install -c -m 0644 rubygems/package/tar_writer.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_writer.rb
install -c -m 0644 rubygems/package/tar_header.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_header.rb
install -c -m 0644 rubygems/package/tar_output.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_output.rb
mkdir -p /usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader
install -c -m 0644 rubygems/package/tar_reader/entry.rb
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader/entry.rb
cp gem /tmp_dk/rubygems-1.1.1/bin/gem
rm /tmp_dk/rubygems-1.1.1/bin/gem
/usr/lib/ruby/1.8/fileutils.rb:1378:in `fu_each_src_dest': same file:
gem and /tmp_dk/rubygems-1.1.1/bin/gem (ArgumentError)
from /usr/lib/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest0'
from /usr/lib/ruby/1.8/fileutils.rb:1377:in `fu_each_src_dest'
from /usr/lib/ruby/1.8/fileutils.rb:382:in `cp'
from /usr/lib/ruby/1.8/fileutils.rb:1510:in `cp'
from setup.rb:134
from setup.rb:123:in `each'
from setup.rb:123
from setup.rb:118:in `chdir'
from setup.rb:118


##

Any ideas?

Thx!
az

PS: For reasons out of my control, I cannot simply change change the OS,
so moving to a different OS/release is not an option, unfortunately.
Thank you for your understanding.



9 Answers

Eric Hodel

6/8/2008 1:50:00 AM

0

On Jun 5, 2008, at 23:54 PM, Artie Ziff wrote:
> cp gem /tmp_dk/rubygems-1.1.1/bin/gem
> rm /tmp_dk/rubygems-1.1.1/bin/gem
> /usr/lib/ruby/1.8/fileutils.rb:1378:in `fu_each_src_dest': same file:
> gem and /tmp_dk/rubygems-1.1.1/bin/gem (ArgumentError)
> from /usr/lib/ruby/1.8/fileutils.rb:1395:in `fu_each_src_dest0'
> from /usr/lib/ruby/1.8/fileutils.rb:1377:in `fu_each_src_dest'
> from /usr/lib/ruby/1.8/fileutils.rb:382:in `cp'
> from /usr/lib/ruby/1.8/fileutils.rb:1510:in `cp'
> from setup.rb:134
> from setup.rb:123:in `each'
> from setup.rb:123
> from setup.rb:118:in `chdir'
> from setup.rb:118

Did you unpack the tarball in /tmp?

Artie Ziff

6/8/2008 3:31:00 AM

0

Hello,

Thank you for your interest.

> Did you unpack the tarball in /tmp?
>
No. Unpacked in temporary directory that was not "/tmp".
It was very fun to diagnose.
The problem was the following:

The directory "/tmp" was symlink'ed to non-existent directory.

Perhaps the installer should check to see if /tmp actually exists
rather than presuming that it exists, which leads to this failure.

Cheers,
az


David Masover

6/8/2008 5:15:00 AM

0

On Saturday 07 June 2008 22:30:53 Artie Ziff wrote:

> Perhaps the installer should check to see if /tmp actually exists
> rather than presuming that it exists, which leads to this failure.

That's a reasonable assumption, though. It's kind of like saying "Perhaps the
program should check if the home directory actually exists..."

It might be nice to have a user-friendly option about this, but really, if tmp
doesn't exist, you're going to have a lot more problems than that one
installer.

Artie Ziff

6/8/2008 6:42:00 AM

0

Hello,
>
> That's a reasonable assumption, though. It's kind of like saying "Perhaps the
> program should check if the home directory actually exists..."
>

Is it not good programming practice to check if resource exists before
using?

> It might be nice to have a user-friendly option about this,

IMHO, it would be user-friendly if software emits error when required
resource not available (and make program barf).

> but really, if tmp
> doesn't exist, you're going to have a lot more problems than that one
> installer.
>
(Score:5, Insightful) :)

And very much my experience.

This is my first week using Ruby, so please tolerate a newbie question:

Is it general convention/assumption by all Ruby programmers: a Ruby
program always has valid writable Dir.tmpdir defined, without verification?

Cheers,
az





David Masover

6/8/2008 7:13:00 AM

0

On Sunday 08 June 2008 01:41:31 Artie Ziff wrote:

> Is it not good programming practice to check if resource exists before
> using?

Depends. I tend to develop Ruby a bit more optimistically -- I try to use a
resource, assuming that if it doesn't exist, some sort of "NoSuchResource"
exception will be thrown. If it turns out that this is something that will
happen often, and the user might know something about it, I'll catch the
exception and provide a more helpful error message.

I think that's the whole point of exceptions -- most application code should
not be about error handling. We shouldn't have to do this:

if ok_to_do_something?
do_something
return true
else
return nil
end
# Repeat, say, five times in a single function.
# And, of course, in the caller...
if some_function_that_does_something.nil?
error "Can't do something."
exit 1
end
# That's unrealistic. Figure it's more like five levels deep.

> > It might be nice to have a user-friendly option about this,
>
> IMHO, it would be user-friendly if software emits error when required
> resource not available (and make program barf).

Generally, yes, and that's what I meant. It takes a bit more effort to say
something like "Record not found" than to say "You tried to call method :foo
on NilClass", but if it's an error that's likely to happen, it's worth that
effort, and your users will thank you.

But not having a tempdir is just a whole new level of broken-ness. I'm having
trouble coming up with a properly absurd analogy, because of how absurd that
situation is in the first place.

> Is it general convention/assumption by all Ruby programmers: a Ruby
> program always has valid writable Dir.tmpdir defined, without verification?

I can't speak for others, but I certainly would, mostly because I write Ruby
apps that are meant to run on more or less complete Unices. I know of no
modern Unix that lacks a tempdir. Actually, I know of no modern Unix that
lacks a directory called /tmp, with mode 1777. And I know of no modern Win32
implementation that lacks a tempdir of some kind -- I don't know the details
of where that is (maybe a %TEMP% environment variable?), but that's also
something that should be Ruby's responsibility to work out, not my app's.

My comment about "more problems than that one installer" wasn't about Ruby, it
was about the rest of your Unix (Linux?) system. You probably couldn't even
bring up a GUI without it -- I see a socket called /tmp/.X11-unix/X0, and
while I don't know for certain, I strongly suspect that this is needed to
communicate with my X server (as TCP is disabled).

If you're moving beyond Unices (and Windows), you're probably going to have to
make more extensive changes than tempdirs -- and you might not end up using
Ruby at all (though not, I hope, because of a lack of tempdirs).

Eric Hodel

6/8/2008 8:33:00 AM

0

On Jun 7, 2008, at 23:41 PM, Artie Ziff wrote:
>> That's a reasonable assumption, though. It's kind of like saying
>> "Perhaps the
>> program should check if the home directory actually exists..."
>
> Is it not good programming practice to check if resource exists before
> using?

It is a good practice.

>> It might be nice to have a user-friendly option about this,
>
> IMHO, it would be user-friendly if software emits error when required
> resource not available (and make program barf).

Yes.

>> but really, if tmp doesn't exist, you're going to have a lot more
>> problems than that one installer.
> (Score:5, Insightful) :)
>
> And very much my experience.
>
> This is my first week using Ruby, so please tolerate a newbie
> question:
>
> Is it general convention/assumption by all Ruby programmers: a Ruby
> program always has valid writable Dir.tmpdir defined, without
> verification?

RubyGems is using Dir.tmpdir because it is supposed to do the
verification, it checks:

if dir and File.directory?(dir) and File.writable?(dir)

Maybe there is a bug.

I have a symlinked /tmp (OS X), but it goes to a valid place:

$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0]
$ ls -al /tmp
lrwxr-xr-x@ 1 root admin 11 Nov 15 2007 /tmp@ -> private/tmp
$ ruby -e 'p File.directory?("/tmp")'
true
$ ruby -e 'p File.symlink?("/tmp")'
true

But if I create a symlink pointing to a nonexistent place:

$ ln -s /foo baz
$ ls -al baz
lrwxr-xr-x 1 drbrain staff 4 Jun 8 01:08 baz@ -> /foo
$ ls -al /foo
ls: /foo: No such file or directory
$ ruby -e 'p File.directory?("baz")'
false
$ ruby -e 'p File.symlink?("baz")'
true

So maybe some other bug exists?

If you find the bug, can you inform ruby-core?

Dan

8/12/2008 5:09:00 AM

0

William Longyard wrote:
> Is there any more despicable Senator than Carl Levin?


I am more than satisfied with Levin as my Senator and his brother as my
Congressman.


--
Dan




"The means of defense against foreign danger historically have become
the instruments of tyranny at home."

-James Madison

William Longyard

8/12/2008 3:14:00 PM

0

"The War against terrorism will not be finished as long as [Saddam Hussein]
is in power."

Carl Levin
December 16, 2001




"Dan" <Dan@highway29.net> wrote in message
news:QV8ok.25500$1p1.1175@en-nntp-08.dc1.easynews.com...
> William Longyard wrote:
>> Is there any more despicable Senator than Carl Levin?
>
>
> I am more than satisfied with Levin as my Senator and his brother as my
> Congressman.
>
>
> --
> Dan
>
>
>
>
> "The means of defense against foreign danger historically have become the
> instruments of tyranny at home."
>
> -James Madison


gumboman

8/12/2008 11:22:00 PM

0

On Tue, 12 Aug 2008 11:14:15 -0400, "William Longyard"
<longyard@ix.netcom.com> wrote:

>"The War against terrorism will not be finished as long as [Saddam Hussein]
>is in power."
>
>Carl Levin
>December 16, 2001
>


So it's over? Why are the troops still stop-lossed in the Middle east?