Re: Possible race in pserver leading to broken pipe error?

2004-02-11 Thread Larry Jones
Steve McIntyre writes: fsync() or fdatasync() should do what you want here. Although you _should_ be able to mix stream and fd operations normally - stdio is meant to do the right thing AFAIK. But now I can't find the reference I had that said so, of course. On the contrary, stdio expects

Re: Possible race in pserver leading to broken pipe error?

2004-02-11 Thread Larry Jones
Derek Robert Price writes: It's been awhile since I played concurrently with descriptors and streams, but I thought I recalled that the only real issue was that they were using the same descriptor, so operations on one affected the other, as opposed to a dup() of a file descriptor, which

Re: Possible race in pserver leading to broken pipe error?

2004-02-11 Thread Larry Jones
Derek Robert Price writes: Okay... I had just made the assumption that all the descriptors would need to be flushed before close if one had, but I see what you are getting at now. The stdout stream had been used and has its own buffer so I needed to flush the stdout buf, and similarly the

Re: Possible race in pserver leading to broken pipe error?

2004-02-11 Thread Derek Robert Price
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Larry Jones wrote: http://www.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_05.html Thanks. That was interesting. Derek - -- *8^) Email: [EMAIL PROTECTED] Get CVS support at http://ximbiot.com! -BEGIN PGP

Re: Possible race in pserver leading to broken pipe error?

2004-02-11 Thread Derek Robert Price
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Larry Jones wrote: On the contrary, dup() just gives you another handle to the same open file description -- the modes, pointers, etc. are *shared* by both fds. To get independence, you have to open the file again. Except the close-on-exec flag

Re: Possible race in pserver leading to broken pipe error?

2004-02-11 Thread Derek Robert Price
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Larry Jones wrote: Just to reinforce the concept one more time (at the risk of beating a dead horse), descriptors don't have buffers and thus don't need to be flushed; *streams* have buffers and need to be flushed; closing a stream also flushes it.

Re: Possible race in pserver leading to broken pipe error?

2004-02-11 Thread Larry Jones
Derek Robert Price writes: Except the close-on-exec flag isn't shared. And closing one dup'd file descriptor does not close the other. My man pages and what I could find via the recent opengroup link you sent, only list the close-on-exec flag as being maintained separately. Is there

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Derek Robert Price
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Steve McIntyre wrote: On Mon, Feb 09, 2004 at 05:31:07PM -0500, Larry Jones wrote: Steve McIntyre writes: http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=24253 They had a similar problem with the Debian package, and the patch listed on

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Derek Robert Price
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Derek Robert Price wrote: I've attempted to rewrite this patch, and attached it, still broken, only because I may have to leave the office in a few minutes. remotecheck is curerntly failing with this patch because STDOUT isn't flushing, it looks

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Larry Jones
Derek Robert Price writes: Yep, it just needed fflushes. Working patch attached. Comments before I commit? fflush()/close() is a no-no -- you want fclose() instead. Once you've attached a stream to a file descriptor, you have to be very careful about what you do to the file descriptor --

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Derek Robert Price
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Larry Jones wrote: Derek Robert Price writes: Yep, it just needed fflushes. Working patch attached. Comments before I commit? fflush()/close() is a no-no -- you want fclose() instead. Once you've attached a stream to a file descriptor, you have

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Steve McIntyre
On Tue, Feb 10, 2004 at 07:23:43PM -0500, Derek Robert Price wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Larry Jones wrote: Derek Robert Price writes: Yep, it just needed fflushes. Working patch attached. Comments before I commit? fflush()/close() is a no-no -- you want fclose()

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Derek Robert Price
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Steve McIntyre wrote: On Tue, Feb 10, 2004 at 07:23:43PM -0500, Derek Robert Price wrote: Larry Jones wrote: Derek Robert Price writes: Yep, it just needed fflushes. Working patch attached. Comments before I commit? fflush()/close() is a no-no

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Steve McIntyre
On Tue, Feb 10, 2004 at 07:46:01PM -0500, Derek Robert Price wrote: I tired fsync() and sync() originally and they didn't work. I just tried fdatasync() and it doesn't work either. Keep in mind that these are pipes and not files. Of course, yes. Doh! -- Steve McIntyre, Cambridge, UK.

Re: Possible race in pserver leading to broken pipe error?

2004-02-10 Thread Eric Siegerman
On Tue, Feb 10, 2004 at 07:23:43PM -0500, Derek Robert Price wrote: Larry Jones wrote: fflush()/close() is a no-no -- you want fclose() instead. I couldn't find a man page for a file descriptor flush - There isn't one, especially not for pipes. AFAIK, as soon as you've written data into a

Possible race in pserver leading to broken pipe error?

2004-02-09 Thread Steve McIntyre
[ Initially sent to bug-cvs, but as other people have said, that seems to be dead atm... ] I've had this pointed out to me by a Debian user: http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=24253 They had a similar problem with the Debian package, and the patch listed on that page

Re: Possible race in pserver leading to broken pipe error?

2004-02-09 Thread Larry Jones
Steve McIntyre writes: http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=24253 They had a similar problem with the Debian package, and the patch listed on that page seems to fix it for them. Thoughts? My first impression is that it seems reasonable, but I'll have to give it some

Re: Possible race in pserver leading to broken pipe error?

2004-02-09 Thread Steve McIntyre
On Mon, Feb 09, 2004 at 05:31:07PM -0500, Larry Jones wrote: Steve McIntyre writes: http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=24253 They had a similar problem with the Debian package, and the patch listed on that page seems to fix it for them. Thoughts? My first impression