On Thu, 12 Oct 2000, Yasushi Shoji wrote:

> 1.4.6 doesn't work either.  i think the problem is implicit
> expectation of string when arg = 2.
> 
> this patch works for me but not sure it's the right way.
> --
>             yashi
> 
> Index: file.c > =================================================================== > RCS file: /home/cvsroot/ruby/file.c,v > retrieving revision 1.38 > diff -u -u -r1.38 file.c > --- file.c 2000/10/10 07:03:17 1.38 > +++ file.c 2000/10/11 20:44:28 > @@ -1260,7 +1260,7 @@ > } > #endif > else if (!isdirsep(*s)) { > - if (argc == 2) { > + if (argc == 2 && !NIL_P(dname)) { > dname = rb_file_s_expand_path(1, &dname); > if (OBJ_TAINTED(dname)) tainted = 1; > strcpy(buf, RSTRING(dname)->ptr); > > This patch didn't work for me but my change to the file is below. I'm using the "tarball" off the Ruby home page, and so I have patched file.c like this: neelix hgs 738 %> gdiff -u ruby-1.6.1-orig/file.c ruby-1.6.1/file.c --- ruby-1.6.1-orig/file.c Mon Sep 25 10:14:59 2000 +++ ruby-1.6.1/file.c Thu Oct 12 10:09:11 2000 @@ -1260,7 +1260,7 @@ } #endif else if (!isdirsep(*s)) { - if (argc == 2) { + if (argc == 2 && !NIL_P(dname)) { dname = rb_file_s_expand_path(1, &dname); if (OBJ_TAINTED(dname)) tainted = 1; strcpy(buf, RSTRING(dname)->ptr); neelix hgs 739 %> There's not much difference; maybe patch -l (i.e --ignore-whitespace) would have done the trick. However, I have not built this yet. This is because I wanted to add the test for this to the testing performed by `make test` first. However, I can't find the tests for the File class in the directory structure. In particular I cannot find any tests for the expand_path method, so I can't see where to add any such test so it will remain there for the future. Maybe Dave's new test suite can have the test inside it, if it doesn't belong in the `make test` tests? Hugh hgs / dmu.ac.uk