From patchwork Wed Apr 12 12:35:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 750000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w33LF4C8Dz9sNJ for ; Wed, 12 Apr 2017 22:35:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="JlTJWCyn"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=fZdlyqwiWp/rSOrz dRVTeox+Oh5yNWNQIzPjMUS/gNBxOEtRqj8JlqdyrpaeDbFBnjw0nBNRz7G5Upxa 0eV1UF9rBKJgIH6gFjFbFFN64PpDW/jODGDiGEQq3z9cQNwl4/0BFsr6XgOPdJf/ fw+fnk3uJtenN+HCiZYVCzDvl4Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=NRmi0W80t49IDiFKB86Rck jNIhI=; b=JlTJWCynud+vGaFQB5jiZyVcRdtkPijsCaNFh/suNqzWtDK0UV9Wxh GR8/dJ8tpw21kkow/Fj7L13OXoARHutHGVhrLY6A+cPYOcRHCGmJOZc3prsPsHsX 1yC8bY5CsbMUgqGnN8EB0WiieeaT9hqUaH6XRj6ARGH/2smx/Xnn8= Received: (qmail 17176 invoked by alias); 12 Apr 2017 12:35:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 17153 invoked by uid 89); 12 Apr 2017 12:35:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=8118, act X-HELO: mail-qk0-f169.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=oGNfByw92W8biQMU4xldxDi7WiqXsr390UYKOtO0d88=; b=AHKWH6gRPItK7zwvpbDI/nvbe4BpNtmFRlbJRfrQPCx7+AZeAeM4kcwzteKGU2QjKF 51IwO5VW/D7u1qJBJ7nUfKCfN1sYBNIKuZn6f3GJL/4tkX/o5W37SBS74ICS8YlRzB4h KCZSNXZwrUEYoWkCdLxoMA6gF5kks6IM+pDbi9hmGsOA5xFKbtdsHjykRz0fHprl1HVZ Rp9stdV60YvCZpo9xenGXIjxtLQOt5TJ5Jx5ldKmEuml3pkPlGMhnJxo4ouoU6IYn+TA 9BNvGV5XHa9Bgg3LS44/YiA1HhX8sySQbq4wZ+ZZOtutk3Thkkegnpb96sF9P/sywWMD 9n5w== X-Gm-Message-State: AFeK/H12sggLzx1KvKmb23Cyq5RnHJYQzbuOLx4QWJtJZ9SsGl9OHNNuH5VXtP/DM62eeVg/ X-Received: by 10.55.60.196 with SMTP id j187mr67883825qka.93.1492000534186; Wed, 12 Apr 2017 05:35:34 -0700 (PDT) Subject: Re: [PATCH] posix: Add SIGSEGV on the trap list for globtest.sh To: Florian Weimer References: <1491934157-30940-1-git-send-email-adhemerval.zanella@linaro.org> <0694ea29-dfed-5105-e288-4a0a5037ea51@redhat.com> Cc: libc-alpha@sourceware.org From: Adhemerval Zanella Message-ID: <11eed88b-109b-bfb3-4e5c-be086aa87689@linaro.org> Date: Wed, 12 Apr 2017 09:35:29 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <0694ea29-dfed-5105-e288-4a0a5037ea51@redhat.com> On 11/04/2017 18:12, Florian Weimer wrote: > On 04/11/2017 09:59 PM, Adhemerval Zanella wrote: >> >> >> On 11/04/2017 15:22, Florian Weimer wrote: >>> On 04/11/2017 08:09 PM, Adhemerval Zanella wrote: >>>> -trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15 >>>> +trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' HUP INT QUIT SEGV TERM >>> >>> Does the shell really receive the signal? Why not use “0”? >> >> It does not off course since it is not the shell that is actually generating >> the segfault. > > Well, the shell uses globbing, too, so who knows. :) > >> I will rewrite the patch. > > Thanks. Using 0 is probably the correct choice, then. > > Florian Ok, here is a version 2. --- This patch prevents lingering files for SIGSEGV failures by adding a cleanup handler on trap handler. Checked on x86_64-linux-gnu. * posix/globtest.sh: Add cleanup for the signal to act on a trap. --- ChangeLog | 4 ++++ posix/globtest.sh | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) index f9cc80b..a764aef 100755 --- a/posix/globtest.sh +++ b/posix/globtest.sh @@ -47,7 +47,13 @@ testout=${common_objpfx}posix/globtest-out rm -rf $testdir $testout mkdir $testdir -trap 'chmod 777 $testdir/noread; rm -fr $testdir $testout' 1 2 3 15 +cleanup() +{ + chmod 777 $testdir/noread + rm -fr $testdir $testout +} + +trap cleanup 0 HUP INT QUIT TERM echo 1 > $testdir/file1 echo 2 > $testdir/file2 @@ -811,8 +817,6 @@ if test $failed -ne 0; then fi if test $result -eq 0; then - chmod 777 $testdir/noread - rm -fr $testdir $testout echo "All OK." > $logfile fi