From: ts Date: 2001-07-25T16:02:52+09:00 Subject: [ruby-talk:18514] Re: File.expand_path is buggy? (PR#158) >>>>> "Y" == Yukihiro Matsumoto writes: Y> --- file.c 2001/07/24 09:02:49 1.41.2.17 Y> +++ file.c 2001/07/25 06:50:05 Y> @@ -1310,2 +1310,7 @@ Y> for ( ; *s; s++) { Y> + while (*s && !isdirsep(*s)) { Y> + *++p = *s++; Y> + if (p >= bend) goto toolong; Y> + } Y> + if (!*s) break; Y> switch (*s) { You have this case no ? pigeon% diff -u file.c.old file.c --- file.c.old Wed Jul 25 07:51:23 2001 +++ file.c Wed Jul 25 08:56:19 2001 @@ -1308,6 +1308,11 @@ *p = '/'; for ( ; *s; s++) { + while (*s && !isdirsep(*s)) { + *++p = *s++; + if (p >= bend) goto toolong; + } + if (!*s) break; switch (*s) { case '.': if (*(s+1)) { pigeon% pigeon% ruby -e 'p File.expand_path ".."' "/h/nblg/ts/ruby/ts/r16/ruby/.." pigeon% pigeon% ruby -e 'p File.expand_path "../.."' "/h/nblg/ts/ruby/ts/r16/ruby/../.." pigeon% Guy Decoux