This is the mail archive of the
cygwin
mailing list for the Cygwin project.
cygwin 1.7.0-28: Broken pipe signal broken?
- From: "Christian Franke" <Christian dot Franke at t-online dot de>
- To: cygwin at cygwin dot com
- Date: Mon, 18 Aug 2008 13:55:20 +0200
- Subject: cygwin 1.7.0-28: Broken pipe signal broken?
- Reply-to: "Christian Franke" <Christian dot Franke at t-online dot de>
During testing of my packages on 1.7, I got the following error message
from the grub-mkrescue script from package grub:
$ cat boot.img /dev/zero | dd bs=1024 count=1440 > floppy.img
cat: write error: No space left on device
But due to a hack in coreutils*/lib/full_write.c, the error message is
misleading.
The following test program demonstrates the root of the problem:
===== testpipe.c =====
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
void sigpipe_handler()
{
write(2, "[SIGPIPE!]", 10);
}
int main()
{
static char buf[1024*1024];
signal(SIGPIPE, sigpipe_handler);
errno = 0;
int n = write(1, buf, sizeof(buf));
fprintf(stderr, "write = %d, errno = %d\n", n, errno);
return 0;
}
======================
Result on 1.5.25-15:
$ ./testpipe | dd bs=1 count=1 >/dev/null 2>/dev/null
[SIGPIPE!]write = -1, errno = 32
Result on 1.7.0-28:
$ ./testpipe | dd bs=1 count=1 >/dev/null 2>/dev/null
write = 0, errno = 32
According to strace, errno=EPIPE is set in
fhandler_base::wait_overlapped() due to a failing GetOverlappedResult().
Missing raise(SIGPIPE) call in fhandler_base::write_overlapped() ?
Hope this helps,
Christian
PS: No other issues found so far - nice work!
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/