From owner-freebsd-bugs@FreeBSD.ORG Sat Dec 17 22:40:02 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C960A16A41F for ; Sat, 17 Dec 2005 22:40:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EFA7F43D45 for ; Sat, 17 Dec 2005 22:40:01 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id jBHMe1DB085267 for ; Sat, 17 Dec 2005 22:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id jBHMe1hj085266; Sat, 17 Dec 2005 22:40:01 GMT (envelope-from gnats) Resent-Date: Sat, 17 Dec 2005 22:40:01 GMT Resent-Message-Id: <200512172240.jBHMe1hj085266@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Florian Westphal Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1A8FC16A41F for ; Sat, 17 Dec 2005 22:38:58 +0000 (GMT) (envelope-from fw@abraxis.ask.fh-furtwangen.de) Received: from ohjemine.ask.rz-int.fh-furtwangen.de (Ohjemine.ASK.rz-int.FH-Furtwangen.DE [141.28.15.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id A28A543D58 for ; Sat, 17 Dec 2005 22:38:57 +0000 (GMT) (envelope-from fw@abraxis.ask.fh-furtwangen.de) Received: from abraxis.ask.fh-furtwangen.de (abraxis.ASK.FH-Furtwangen.DE [141.28.225.143]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by weltmacht.ask.fh-furtwangen.de (Postfix) with ESMTP id E52F578C96 for ; Sat, 17 Dec 2005 23:38:55 +0100 (CET) Received: by abraxis.ask.fh-furtwangen.de (Postfix, from userid 1001) id B65E4242; Sat, 17 Dec 2005 23:42:27 +0100 (CET) Message-Id: <20051217224227.B65E4242@abraxis.ask.fh-furtwangen.de> Date: Sat, 17 Dec 2005 23:42:27 +0100 (CET) From: Florian Westphal To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/90580: wordexp(3) fails to check for EINTR X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Dec 2005 22:40:03 -0000 >Number: 90580 >Category: bin >Synopsis: wordexp(3) fails to check for EINTR >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Dec 17 22:40:01 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Florian Westphal >Release: FreeBSD 5.4-RELEASE-p6 i386 >Organization: >Environment: System: FreeBSD abraxis.ask.fh-furtwangen.de 5.4-RELEASE-p6 FreeBSD 5.4-RELEASE-p6 #12: Wed Aug 17 09:26:21 CEST 2005 root@abraxis.ask.fh-furtwangen.de:/usr/obj/usr/src/sys/ABRAXIS i386 AMD k6/233 mhz, 32meg ram >Description: wordexp() fails if a syscall fails; no check for errno == EINTR is performed. Applications that install signal handlers for SIGCHLD will be in a race with wordexp. The program below often fails on my box. >How-To-Repeat: /* This sample program MAY work or not work, depending on timing */ #include #include #include #include #include static void handler(int x) { (void)x; } int main(void) { struct sigaction sa; const char * expand = "*"; wordexp_t p; int ret; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sa.sa_handler = handler; if (sigaction(SIGCHLD,&sa, NULL) != 0) return 111; errno = 0; ret = wordexp(expand, &p, WRDE_SHOWERR|WRDE_UNDEF); if (ret == 0) { unsigned int i; char **w = p.we_wordv; for (i=0; iFix: Have wordexp() check for errno == EINTR >Release-Note: >Audit-Trail: >Unformatted: