[#1147] Copying RVALUE — why the lucky stiff <ruby-core@...>

Hello, everyone. Hope you are all doing well.

18 messages 2003/06/17
[#1155] Re: Copying RVALUE — matz@... (Yukihiro Matsumoto) 2003/06/20

Hi,

[#1157] Re: Copying RVALUE — why the lucky stiff <ruby-core@...> 2003/06/20

Yukihiro Matsumoto (matz@ruby-lang.org) wrote:

[#1173] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...>

Hi, I'm new to this mailing list so I don't know the procedure for

15 messages 2003/06/22
[#1174] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1175] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/22

On Sun, 2003-06-22 at 05:36, nobu.nokada@softhome.net wrote:

[#1176] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1193] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/25

On Sun, 2003-06-22 at 07:41, nobu.nokada@softhome.net wrote:

[#1177] Re: In 1.8.0 nil.to_s is not the same as "" — ts <decoux@...>

14 messages 2003/06/22

File.link error messages ?

From: Johan Holmberg <holmberg@...>
Date: 2003-06-16 16:13:45 UTC
List: ruby-core #1146
Hi !

File.link(from,to) can give an error for a number of reasons.

Sometimes the cause is the 'from' parameter, sometimes 'to' and
sometimes any of them (the system call link(2) doesn't tell which).

The Ruby source looks like:

>    if (link(RSTRING(from)->ptr, RSTRING(to)->ptr) < 0)
>        rb_sys_fail(RSTRING(from)->ptr);

so Ruby assumes that the first parameter is to blame.
This is not always true:

    $ touch foo
    $ ruby -e 'File.link("foo", "bar" * 9999)'
    -e:1:in `link': File name too long - foo (Errno::ENAMETOOLONG)
            from -e:1

When I noted this, my first reaction was to try and fix it, but
after a while I realize that it is a bit tricky to present the
right "offending" argument, and sometimes even inpossible (since
the OS doesn't tell which argument to  blame).

How should this be solved ?

One way would of course be to have both filenames as arguments to
the exception. Is this possible ?

Or is there a better way ?

/Johan Holmberg


In This Thread

Prev Next