libassuan fails pipeconnect test on W32

LRN lrn1986 at
Thu Jun 6 10:18:06 CEST 2013

Hash: SHA1

The test runs pipeconnect in client mode,
then the client spawns a pipeconnect instance with a --server argument.

The server tries to write "OK pleased to meet you" back to the client,
but fails, because it's trying to write into CRT file descriptor using
WriteFile(). Apparently, there needs to be some code to convert
fileno(stdout) into handle that WriteFile() understands. Or

A backtrace to WriteFile() is attached.

I suspect that the code that needs modification is
parse_std_file_handles(). It has some W32CE-only code that appears to be
doing the right thing (that is, if the spawn function (or whatever calls
the spawn function) does pass the fd via command line), i wonder why
it's CE-only...That said, converting fileno(stdout) to HANDLE is
trivial, so there's no need to use that CE code. Just a few
_get_osfhandle() calls with an #ifdef _WIN32.

I've also spotted a comment about handle inheritance that piqued my
curiosity, but that's off-topic.

- -- 
O< ascii ribbon - stop html email! -
Version: GnuPG v1.4.11 (MingW32)

-------------- next part --------------
#0  __assuan_write (ctx=0x753ed8, fd=0x1, buffer=0x65892156, size=22) at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/src/system-w32.c:258
#1  0x658899d9 in _assuan_simple_write (ctx=0x753ed8, buffer=0x65892156, size=22) at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/src/assuan-io.c:60
#2  0x6588386e in writen (ctx=ctx at entry=0x753ed8, buffer=buffer at entry=0x65892156 "OK Pleased to meet you", length=length at entry=22) at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/src/assuan-buffer.c:48
#3  0x65883eb1 in _assuan_write_line (ctx=ctx at entry=0x753ed8, prefix=prefix at entry=0x0, line=line at entry=0x65892156 "OK Pleased to meet you", len=len at entry=22)
    at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/src/assuan-buffer.c:302
#4  0x6588407a in assuan_write_line (ctx=ctx at entry=0x753ed8, line=line at entry=0x65892156 "OK Pleased to meet you") at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/src/assuan-buffer.c:335
#5  0x65886ab6 in assuan_accept (ctx=0x753ed8) at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/src/assuan-listen.c:127
#6  0x00408420 in run_server (enable_debug=0) at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/tests/pipeconnect.c:157
#7  main (argc=<optimized out>, argv=<optimized out>) at /src/mingw/libassuan-2.1.0-1/libassuan-2.1.0/tests/pipeconnect.c:383

More information about the Gnupg-devel mailing list