Simon Josefsson wrote: > Right now, the gnulib modules that fail to build under mingw32 are (see > log): savewd, sigpipe-die, getugroups, idcache, and userspec.
Interesting... 'glob' was also in this list, but was ported to mingw by Yoann. 'sigpipe-die' is new, however. Native Windows does not have SIGPIPE. What happens when writing a pipe with no readers? $ msgcat de.po | head -1 # German translations for GNU gettext-runtime package msgcat.exe: error while writing "standard output" file: Invalid argument The desired behaviour, as on Unix, is that the msgcat program terminates without an error message. In such a situation, the write() call fails with errno = EINVAL, GetLastError() = ERROR_NO_DATA. This is quite pervasive. Obviously we don't want to hack every write() or fwrite() calls in all programs to get this behaviour right. The following functions all need to be extended in gnulib. - <signal.h>: define SIGPIPE - signal, sigprocmask, sigaction: support SIGPIPE - raise: support SIGPIPE - write: check for ERROR_NO_DATA and potentially raise SIGPIPE - fwrite, fputs, puts, fputc, putc, putchar, [v]fprintf, [v]printf: likewise I'm applying this in 7 commits. Bruno 2008-09-26 Bruno Haible <[EMAIL PROTECTED]> * modules/sigpipe-die (Depends-on): Add sigpipe. * lib/stdio.in.h (fprintf, vfprintf, printf, vprintf, fputc, putc, putchar, fputs, puts, fwrite): Replace when REPLACE_STDIO_WRITE_FUNCS and GNULIB_STDIO_H_SIGPIPE are set. * lib/stdio-write.c: New file. * m4/stdio_h.m4 (gl_STDIO_H): Set GNULIB_FPRINTF, GNULIB_PRINTF, GNULIB_VFPRINTF, GNULIB_VPRINTF, GNULIB_FPUTC, GNULIB_PUTC, GNULIB_PUTCHAR, GNULIB_FPUTS, GNULIB_PUTS, GNULIB_FWRITE, REPLACE_STDIO_WRITE_FUNCS. (gl_STDIO_H_DEFAULTS): Initialize GNULIB_FPRINTF, GNULIB_PRINTF, GNULIB_VFPRINTF, GNULIB_VPRINTF, GNULIB_FPUTC, GNULIB_PUTC, GNULIB_PUTCHAR, GNULIB_FPUTS, GNULIB_PUTS, GNULIB_FWRITE, GNULIB_STDIO_H_SIGPIPE, REPLACE_STDIO_WRITE_FUNCS. * modules/stdio (Files): Add lib/stdio-write.c. (Makefile.am): Substitute GNULIB_FPRINTF, GNULIB_PRINTF, GNULIB_VFPRINTF, GNULIB_VPRINTF, GNULIB_FPUTC, GNULIB_PUTC, GNULIB_PUTCHAR, GNULIB_FPUTS, GNULIB_PUTS, GNULIB_FWRITE, GNULIB_STDIO_H_SIGPIPE, REPLACE_STDIO_WRITE_FUNCS. * m4/fprintf-posix.m4 (gl_REPLACE_FPRINTF): Define REPLACE_FPRINTF_POSIX. * m4/printf-posix-rpl.m4 (gl_REPLACE_PRINTF): Define REPLACE_PRINTF_POSIX. * m4/vfprintf-posix.m4 (gl_REPLACE_VFPRINTF): Define REPLACE_VFPRINTF_POSIX. * m4/vprintf-posix.m4 (gl_REPLACE_VPRINTF): Define REPLACE_VPRINTF_POSIX. * doc/posix-functions/fprintf.texi: Mention the sigpipe module and the SIGPIPE issue. * doc/posix-functions/fputc.texi: Likewise. * doc/posix-functions/fputs.texi: Likewise. * doc/posix-functions/fwrite.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/putc.texi: Likewise. * doc/posix-functions/putchar.texi: Likewise. * doc/posix-functions/puts.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * modules/safe-write (Depends-on): Add write. * modules/sigpipe-tests: New file. * tests/test-sigpipe.c: New file. * tests/test-sigpipe.sh: New file. * modules/write: New file. * lib/unistd.in.h: Include <sys/types.h>. (write): New declaration. * lib/write.c: New file. * m4/write.m4: New file. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_UNISTD_H_SIGPIPE, GNULIB_WRITE, REPLACE_WRITE. * modules/unistd (Makefile.am): Substitute GNULIB_UNISTD_H_SIGPIPE, GNULIB_WRITE, REPLACE_WRITE. * doc/posix-functions/write.texi: Mention the write, sigpipe modules and the SIGPIPE issue. * lib/signal.in.h (SIGPIPE): Define to a replacement value. (raise): New declaration. * lib/sigprocmask.c (SIGPIPE_handler): New variable. (ext_signal): New function. (rpl_raise): New function. * m4/signal_h.m4 (gl_SIGNAL_H_DEFAULTS): Initialize GNULIB_SIGNAL_H_SIGPIPE. * modules/signal (Makefile.am): Substitute GNULIB_SIGNAL_H_SIGPIPE. * doc/posix-headers/signal.texi: Mention the SIGPIPE issue. * modules/sigpipe: New file. * m4/sigpipe.m4: New file.