[sr #107481] Missing output from gnutls-cli on Solaris

Knut Anders Hatlen INVALID.NOREPLY at gnu.org
Thu Sep 23 09:56:23 CEST 2010


                 Summary: Missing output from gnutls-cli on Solaris
                 Project: GnuTLS
            Submitted by: kah
            Submitted on: Thu 23 Sep 2010 07:56:22 AM GMT
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None



I've seen the following problem with GnuTLS 2.8.6 and 2.10.1 on Solaris 10
and Solaris 11 Express:

When I execute gnutls-cli in a terminal, for example "gnutls-cli -p 993
imap.gmail.com", I see the following lines at the end of the output:

- MAC: MD5
- Compression: NULL
- Handshake was completed

- Simple Client Mode:

* OK Gimap ready for requests from X.Y.Z.W x31if2123995weq.86

However, if I redirect the output to a file, or pipe it to another process, I
only see this output at the end:

$ gnutls-cli -p 993 imap.gmail.com < /dev/null | cat
- MAC: MD5
- Compression: NULL
* OK Gimap ready for requests from X.Y.Z.W m37if2142737wej.5

Note that the "Handshake was completed" line and "Simple Client Mode" have
disappeared. This causes problems for programs that look for these lines to
verify that the handshake was successful. For example, the open-tls-stream
function in Emacs hangs because of it.

I think this is caused by these lines in src/cli.c:

  /* do not buffer */
#if !(defined _WIN32 || defined __WIN32__)
  setbuf (stdin, NULL);
  setbuf (stdout, NULL);
  setbuf (stderr, NULL);

Apparently, this will remove buffered contents that haven't been flushed yet.
If I add


before the calls to setbuf(), the output becomes the expected one even in the
case where the output is redirected/piped.


Reply to this item at:


  Message sent via/by Savannah

More information about the Gnutls-devel mailing list