From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51DF5C433E0 for ; Mon, 15 Jun 2020 11:54:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38B3A20707 for ; Mon, 15 Jun 2020 11:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729745AbgFOLyb (ORCPT ); Mon, 15 Jun 2020 07:54:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729691AbgFOLya (ORCPT ); Mon, 15 Jun 2020 07:54:30 -0400 Received: from orbyte.nwl.cc (orbyte.nwl.cc [IPv6:2001:41d0:e:133a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52CB0C061A0E for ; Mon, 15 Jun 2020 04:54:30 -0700 (PDT) Received: from n0-1 by orbyte.nwl.cc with local (Exim 4.94) (envelope-from ) id 1jknh2-000677-KT; Mon, 15 Jun 2020 13:54:24 +0200 Date: Mon, 15 Jun 2020 13:54:24 +0200 From: Phil Sutter To: Stefano Brivio Cc: Pablo Neira Ayuso , Laura =?utf-8?Q?Garc=C3=ADa_Li=C3=A9bana?= , netfilter-devel@vger.kernel.org Subject: Re: [PATCH nft] tests: shell: Drop redefinition of DIFF variable Message-ID: <20200615115424.GJ23632@orbyte.nwl.cc> Mail-Followup-To: Phil Sutter , Stefano Brivio , Pablo Neira Ayuso , Laura =?utf-8?Q?Garc=C3=ADa_Li=C3=A9bana?= , netfilter-devel@vger.kernel.org References: <20200615090044.GH23632@orbyte.nwl.cc> <20200615121811.08c347e2@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200615121811.08c347e2@redhat.com> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Hi Stefano, On Mon, Jun 15, 2020 at 12:18:11PM +0200, Stefano Brivio wrote: > On Mon, 15 Jun 2020 11:00:44 +0200 > Phil Sutter wrote: > > > Hi Stefano, > > > > On Sun, Jun 14, 2020 at 11:41:49PM +0200, Stefano Brivio wrote: > > > Commit 7d93e2c2fbc7 ("tests: shell: autogenerate dump verification") > > > introduced the definition of DIFF at the top of run-tests.sh, to make > > > it visually part of the configuration section. Commit 68310ba0f9c2 > > > ("tests: shell: Search diff tool once and for all") override this > > > definition. > > > > > > Drop the unexpected redefinition of DIFF. > > > > I would fix it the other way round, dropping the first definition. > > Then it's not visibly configurable anymore. It was in 2018, so it > looks like a regression to me. Hmm? Commit 68310ba0f9c2 is from January this year?! > > It's likely a missing bit from commit 68310ba0f9c20, the second > > definition is in line with FIND and MODPROBE definitions immediately > > preceding it. > > I see a few issues with those blocks: > > - that should be a single function called (once or multiple times) for > nft, find, modprobe, diff, anything else we'll need in the future. > It would avoid any oversight of this kind and keep the script > cleaner. For example, what makes sort(1) special here? It is simply grown and therefore a bit inconsistent. > - quotes are applied inconsistently. If you expect multiple words from > which(1), then variables should also be quoted when used, otherwise > the check might go through, and we fail later There are needless quotes around $(...) but within single brackets we need them if we expect empty or multi-word strings. Typical output would be 'diff not found' and using '[ ! -x "$DIFF" ]' we check if which returned diff's path or said error message. We don't expect diff's path to contain spaces, hence no quoting afterwards. Cheers, Phil