From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v5] checkpatches.sh: Add checks for ABI symbol addition Date: Tue, 13 Feb 2018 23:57:27 +0100 Message-ID: <2575844.FsKHahjUk7@xps> References: <20180115190545.25687-1-nhorman@tuxdriver.com> <20180209152111.2508-1-nhorman@tuxdriver.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, john.mcnamara@intel.com, bruce.richardson@intel.com, Ferruh Yigit , Stephen Hemminger To: Neil Horman Return-path: Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 9D0AE1E20 for ; Tue, 13 Feb 2018 23:57:37 +0100 (CET) In-Reply-To: <20180209152111.2508-1-nhorman@tuxdriver.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, I wanted to push this patch in 18.02, but when looking more closely, I see few things to improve. As it is a tool, there is no harm to wait one more week and push it early in 18.05. 09/02/2018 16:21, Neil Horman: > check () { # > + local reta > total=$(($total + 1)) > ! $verbose || printf '\n### %s\n\n' "$3" > if [ -n "$1" ] ; then > @@ -96,9 +100,26 @@ check () { # <patch> <commit> <title> > else > report=$($DPDK_CHECKPATCH_PATH $options - 2>/dev/null) > fi > - [ $? -ne 0 ] || return 0 You are removing the return, so the report will be always printed. You must print the report only in case of error. > + reta=$? > + > $verbose || printf '\n### %s\n\n' "$3" > printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p' > + > + ! $verbose || echo > + ! $verbose || echo "Checking API additions/removals:" You can use printf to combine these lines. > + > + if [ -n "$1" ] ; then > + report=$($VALIDATE_NEW_API $1) Beware of spaces in file names: use quoted "$1". > + elif [ -n "$2" ] ; then > + report=$(git format-patch \ > + --find-renames --no-stat --stdout -1 $commit | > + $VALIDATE_NEW_API -) > + else > + report=$($VALIDATE_NEW_API -) So your script supports "-" for stdin? Nice > + fi > + [ $? -ne 0 -o $reta -ne 0 ] || return 0 Suggestion of more explicit variable naming: $reta -> style_result $? -> symbol_result > + printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p' Wrong copy/paste: the sed is useless for the API report.