[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS problem with ssh

From: Paul Eggert
Subject: Re: CVS problem with ssh
Date: Thu, 14 Jul 2005 14:37:59 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

"Richard M. Stallman" <rms@gnu.org> 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,


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

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:


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:


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.


> 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]