"Richard M. Stallman" <[EMAIL PROTECTED]> writes: > I am not sure what job that program does. The program is too long for > me to read it just to try to figure that out.
The program arranges for fflush to have a nontrivial amount of buffered data to flush. It then calls fflush, so the buffer is then flushed into a pipe that is in O_NONBLOCK mode. If the fflush fails with errno == EAGAIN, the program retries the fflush. The program then checks that the appropriate amount of data was actually written. > However, if it is impossible to do this job reliably for fflush, > we can still adapt the solution to that fact, by using > #define fflush undefined_fflush > so that people can modify the relevant apps not to use fflush. If the problem occurs with fflush, most likely it will also occur with fwrite, fclose, etc. fflush is merely the guinea pig here. You suggested an alternative approach to this problem three years ago, here: http://lists.gnu.org/archive/html/bug-cvs/2002-07/msg00162.html The basic idea is to use a pipe and an intervening subprocess to work around the problem. That is, if the application detects that a file is in O_NOBLOCK mode, it forks a subprocess to talk to that file directly, and the parent process replaces O_NONBLOCKed file descriptor with a pipe to the subprocess. The pipe will not be in O_NONBLOCK mode, so it will work reliably with the parent process's stdio code. The child process will run code taken from the blocking-io module that uses low-level read, write, and select (or poll) calls to do the I/O reliably. I have implemented a quick shell-script approximation to this suggestion, in which the child process is simply "cat -u". This script is called "ssh4cvs". You can find ssh4cvs here: http://lists.gnu.org/archive/html/bug-gnulib/2004-09/msg00003.html I've been using ssh4cvs with GNU Emacs 21.4 and a recent CVS version (currently 1.12.9 as patched by Debian) since September 2004. It works for me. More details about this suggestion are here: http://lists.gnu.org/archive/html/bug-cvs/2002-08/msg00032.html There were some objections at the time to the overhead of the extra process, but I agree with what you wrote in July 2002: Please don't dismiss that simple idea because it is "inefficient"; the inefficiency of this will usually be insignificant compared with the slowness of the network, and this needs to be solved somehow. <http://lists.gnu.org/archive/html/bug-cvs/2002-07/msg00162.html> > Isn't that a bug in FreeBSD? Possibly, but appears that the same bug is in Solaris 10 and in Debian GNU/Linux 3.1. If the bug is that widespread, we have to deal with it somehow. _______________________________________________ Bug-cvs mailing list Bug-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/bug-cvs