From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C13FA0471 for ; Tue, 13 Aug 2019 08:38:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 72F808F96; Tue, 13 Aug 2019 08:38:35 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2651C8F96; Tue, 13 Aug 2019 08:38:34 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 58F94C028320; Tue, 13 Aug 2019 06:38:33 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-32.brq.redhat.com [10.40.204.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE1D47BE6C; Tue, 13 Aug 2019 06:38:31 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, stable@dpdk.org Date: Tue, 13 Aug 2019 08:38:22 +0200 Message-Id: <1565678302-20294-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 13 Aug 2019 06:38:33 +0000 (UTC) Subject: [dpdk-stable] [PATCH] devtools: fix cleanup of temp file X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" The regexp part of the cleanup routine was not updated accordingly when a common prefix for temp files was introduced. Set the trap handler only when required. Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files") Cc: stable@dpdk.org Signed-off-by: David Marchand --- devtools/checkpatches.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 8e2beee..b16bace 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -36,14 +36,6 @@ LINE_SPACING,PARENTHESIS_ALIGNMENT,NETWORKING_BLOCK_COMMENT_STYLE,\ NEW_TYPEDEFS,COMPARISON_TO_NULL" options="$options $DPDK_CHECKPATCH_OPTIONS" -clean_tmp_files() { - if echo $tmpinput | grep -q '^checkpatches\.' ; then - rm -f "$tmpinput" - fi -} - -trap "clean_tmp_files" INT - print_usage () { cat <<- END_OF_HELP usage: $(basename $0) [-q] [-v] [-nX|-r range|patch1 [patch2] ...]] @@ -150,13 +142,16 @@ check () { # ! $verbose || print_headline "$3" if [ -n "$1" ] ; then tmpinput=$1 - elif [ -n "$2" ] ; then - tmpinput=$(mktemp -t dpdk.checkpatches.XXXXXX) - git format-patch --find-renames \ - --no-stat --stdout -1 $commit > "$tmpinput" else tmpinput=$(mktemp -t dpdk.checkpatches.XXXXXX) - cat > "$tmpinput" + trap "rm -f '$tmpinput'" INT + + if [ -n "$2" ] ; then + git format-patch --find-renames \ + --no-stat --stdout -1 $commit > "$tmpinput" + else + cat > "$tmpinput" + fi fi ! $verbose || printf 'Running checkpatch.pl:\n' @@ -191,7 +186,10 @@ check () { # <patch> <commit> <title> ret=1 fi - clean_tmp_files + if [ "$tmpinput" != "$1" ]; then + rm -f "$tmpinput" + trap - INT + fi [ $ret -eq 0 ] && return 0 status=$(($status + 1)) -- 1.8.3.1