From: Johan Holmberg Date: 2003-06-17T01:13:45+09:00 Subject: File.link error messages ? 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