Your message dated Sat, 03 Apr 2004 01:21:20 +0900 with message-id <[EMAIL PROTECTED]> and subject line Bug#159899: libc6: sem_wait is not interrupted by signals, as required by SuS has caused the attached Bug report to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database) -------------------------------------- Received: (at submit) by bugs.debian.org; 6 Sep 2002 21:48:11 +0000 >From [EMAIL PROTECTED] Fri Sep 06 16:48:11 2002 Return-path: <[EMAIL PROTECTED]> Received: from egil.codesourcery.com [66.92.14.122] (mail) by master.debian.org with esmtp (Exim 3.12 1 (Debian)) id 17nQxX-0004c1-00; Fri, 06 Sep 2002 16:48:11 -0500 Received: from zack by egil.codesourcery.com with local (Exim 3.36 #1 (Debian)) id 17nQxV-00087f-00 for <[EMAIL PROTECTED]>; Fri, 06 Sep 2002 14:48:09 -0700 Subject: libc6: sem_wait is not interrupted by signals, as required by SuS From: "Zack Weinberg" <[EMAIL PROTECTED]> To: "Debian Bug Tracking System" <[EMAIL PROTECTED]> X-Mailer: reportbug 1.99.51 Date: Fri, 06 Sep 2002 14:48:09 -0700 Message-Id: <[EMAIL PROTECTED]> Delivered-To: [EMAIL PROTECTED] Package: libc6 Version: 2.2.5-14 Severity: normal Tags: upstream The Single Unix standard requires sem_wait() to be interrupted by a signal delivered to the process - see http://www.opengroup.org/onlinepubs/007908799/xsh/sem_wait.html for details. The glibc implementation of sem_wait(), however, continues to wait on the semaphore after the signal is delivered. To demonstrate this, I have appended a test program. Compile with -pthread and run it; it will block forever, and be unresponsive to ^C (^\ will kill it). On a Solaris machine, by contrast, it exits successfully, printing nothing, after a short delay (due to the nanosleep() call in child_thread). Code inspection suggests this is still a bug in the latest glibc CVS. -- System Information: Debian Release: testing/unstable Architecture: i386 Kernel: Linux egil 2.4.19 #1 Thu Aug 15 11:07:52 PDT 2002 i686 Locale: LANG=en_US, LC_CTYPE=en_US -- test program: #include <sys/types.h> #include <errno.h> #include <pthread.h> #include <semaphore.h> #include <signal.h> #include <stdio.h> #include <string.h> #include <time.h> #include <unistd.h> static pid_t me; static sem_t sema; static volatile sig_atomic_t sigint_caught = 0; static void * child_thread(void *unused) { sigset_t all; struct timespec ts; /* Block all signals in this thread. */ sigfillset(&all); sigprocmask(SIG_SETMASK, &all, 0); /* Wait a moment to be sure the main thread is blocked on the semaphore. */ ts.tv_sec = 1; ts.tv_nsec = 0; nanosleep(&ts, 0); /* Now feed the main thread a signal. This should interrupt execution of sem_wait(). */ kill(me, SIGINT); return 0; } static void sigint_handler(int unused) { sigint_caught = 1; } int main(void) { sigset_t none; pthread_t child; struct sigaction sa; int status; int semv; /* Initialize... */ me = getpid(); sem_init(&sema, 0, 0); /* semaphore starts out locked */ sigemptyset(&none); sigprocmask(SIG_SETMASK, &none, 0); sa.sa_handler = sigint_handler; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigaction(SIGINT, &sa, 0); /* Spawn child thread. */ pthread_create(&child, 0, child_thread, 0); /* Block on semaphore. This should be interrupted by the child sending us a signal. */ status = sem_wait(&sema); /* status should be -1, errno should be EINTR, sigint_caught should be 1, and the semaphore value should still be zero. */ if(status != -1) printf("status = %d != -1\n", status); if(errno != EINTR) printf("errno = %s != EINTR\n", strerror(errno)); if(sigint_caught != 1) printf("sigint_caught = %d != 1\n", sigint_caught); sem_getvalue (&sema, &semv); if(semv != 0) printf("semv = %d != 0\n", semv); /* cleanup */ pthread_join(child, 0); sem_destroy(&sema); return 0; } --------------------------------------- Received: (at 159899-done) by bugs.debian.org; 2 Apr 2004 16:21:21 +0000 >From [EMAIL PROTECTED] Fri Apr 02 08:21:21 2004 Return-path: <[EMAIL PROTECTED]> Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [218.44.239.78] by spohr.debian.org with esmtp (Exim 3.35 1 (Debian)) id 1B9RQ1-0006I4-00; Fri, 02 Apr 2004 08:21:21 -0800 Received: from omega.webmasters.gr.jp (localhost [127.0.0.1]) by webmasters.gr.jp (Postfix) with ESMTP id 586A0DEB58; Sat, 3 Apr 2004 01:21:20 +0900 (JST) Date: Sat, 03 Apr 2004 01:21:20 +0900 Message-ID: <[EMAIL PROTECTED]> From: GOTO Masanori <[EMAIL PROTECTED]> To: Glenn Maynard <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject: Re: Bug#159899: libc6: sem_wait is not interrupted by signals, as required by SuS In-Reply-To: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII Delivered-To: [EMAIL PROTECTED] X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 (1.212-2003-09-23-exp) on spohr.debian.org X-Spam-Status: No, hits=-5.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER autolearn=no version=2.60-bugs.debian.org_2004_03_25 X-Spam-Level: At Fri, 26 Mar 2004 01:37:33 -0500, Glenn Maynard wrote: > This problem seems to be fixed in NPTL. The test program exits > properly. It hangs if run with "LD_ASSUME_KERNEL=2.2.0". Glenn, thanks for your checking. Exactly this is already fixed with the latest glibc under NPTL. To be clear, I close this bug. Regards, -- gotom -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]