From: nobu.nokada@... Date: 2003-06-22T10:49:48+09:00 Subject: Re: DATA object and processes; unexpected problem Hi, At Fri, 13 Jun 2003 20:30:48 +0900, Andrew Walrond wrote: > So as you suggested, the first part works fine with the sync > I'll leave it with you then :) It was normal. As I wrote at [ruby-talk:73295], > Shared file descriptors share the position even between > processes. Therefore, when first fd reached EOF, second fd points at EOF too. This is UNIX I/O model. At least, however, seek before dup probably should be done automatically. Index: io.c =================================================================== RCS file: /cvs/ruby/src/ruby/io.c,v retrieving revision 1.213 diff -u -2 -p -r1.213 io.c --- io.c 7 Jun 2003 15:33:40 -0000 1.213 +++ io.c 22 Jun 2003 01:07:46 -0000 @@ -2491,8 +2491,12 @@ rb_io_init_copy(dest, io) if (orig->f2) { io_fflush(orig->f2, orig); + fseeko(orig->f, 0L, SEEK_CUR); } else if (orig->mode & FMODE_WRITABLE) { io_fflush(orig->f, orig); } + else { + fseeko(orig->f, 0L, SEEK_CUR); + } /* copy OpenFile structure */ -- Nobu Nakada