Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gBrQL-0008MH-FP for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 01:11:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gBrQJ-0001Nb-Os for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 01:11:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gBrQJ-0001NG-6h for pgsql-hackers@lists.postgresql.org; Mon, 15 Oct 2018 01:11:55 +0000 Received: from mail-qt1-x82f.google.com ([2607:f8b0:4864:20::82f]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gBrQ8-0000FW-Oe for pgsql-hackers@postgresql.org; Mon, 15 Oct 2018 01:11:53 +0000 Received: by mail-qt1-x82f.google.com with SMTP id q40-v6so19803315qte.0 for ; Sun, 14 Oct 2018 18:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=bFL+dUfFugI71iQpxrGbIaIXWVhwfNXLWe5BpTM2dhk=; b=MVjtrqzebW67qd8qk9DMxfD3HLFx9iwppYhl8apIxS11N0vRfV0kLUdn0ZUh9LElca +lhtx4SUBOgum9+xvMEoSArPSa+A751aAZNAv8kuDRD/2SwjRsXGgCjGZQ1kM2NlcQht sKgPajtwkKLRQRHB1upyAOQc5Xwy8T7Yk9LhDmw19fw766zT6VLtrk577BipBDzU8P9r fMT16s1k96N/88h0hlNb40YWgUvbx9CaoQ6LnKsvSjxa2XRx9Mb1dLGXAdsTBzEgq+Ov IvwTyp3Snc/ZoyhryNl30nshCqPXOpIIL5leqVl+Ek93p7jfgxq1x+IngS4TRK9Hyi3p HIhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=bFL+dUfFugI71iQpxrGbIaIXWVhwfNXLWe5BpTM2dhk=; b=Um2CrJvPHt4fYgcH+ys3Cgr3KHmcPxhTamm6l2uyKwJxws3n9uQs3+xyLmD3gmVEYf WlEu0sZdarFDSrhPuTw3rrAFmKCN/nczFUFAoCIna3tGJTtkIWWHUm4IC2ei2IuG0pxN Dx2uNRiUJdzRwWgSe3qr1yVeNz5/u5WhiuJq3PLvvJ/kzpGob5y09JMSAtk0gNygKC2U fTHAey49j2xu4vHtbtSgHs+j1O7DJAakmAcgB2afQhKhqlYdHzWeMBFls/0cxYa6yBAq jNiHpheQeZxCfROy2tUfibBaJkUMCMA0OcYzRATHjztHhsU0o3lPtEtPhuopvlIothOc TUfg== X-Gm-Message-State: ABuFfog/eK9rZ1cqPsNxnEC29bfXrRj+EXfmrHP5ZohQVypaxfONNAkI JfX0xfWR5y9bx5KV/XkQbypYKxBDlA== X-Google-Smtp-Source: ACcGV60j7i+m4pW1w/rR+Li/U5LPM/AgmhaQjI0/5r54Y2qwRwhyVbuGRejXwHyAh69cWENgSYVkZA== X-Received: by 2002:a0c:86c1:: with SMTP id 1mr14936315qvg.137.1539565903827; Sun, 14 Oct 2018 18:11:43 -0700 (PDT) Received: from [192.168.10.146] ([98.122.175.38]) by smtp.gmail.com with ESMTPSA id v57-v6sm5909334qtk.51.2018.10.14.18.11.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Oct 2018 18:11:43 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: pgsql: Add TAP tests for pg_verify_checksums To: Michael Paquier Cc: Michael Banck , Andres Freund , Postgres hackers , Daniel Gustafsson , Magnus Hagander References: <20181012020758.GB30064@paquier.xyz> <20181012024118.q3jwio7gf52nsrmm@alap3.anarazel.de> <20181012031158.GD30064@paquier.xyz> <20181012060543.GE30064@paquier.xyz> <20181012101447.GA13287@nighthawk.caipicrew.dd-dns.de> <20181013083040.GF30064@paquier.xyz> <1bce17ea-08f7-c480-fe69-a5f6467b461f@2ndQuadrant.com> <20181014015902.GI30064@paquier.xyz> <20181014224138.GA15473@paquier.xyz> Message-ID: Date: Sun, 14 Oct 2018 21:11:42 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20181014224138.GA15473@paquier.xyz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-MW List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/14/2018 06:41 PM, Michael Paquier wrote: > On Sun, Oct 14, 2018 at 10:24:55AM -0400, Andrew Dunstan wrote: >> [snip] > Thanks a lot for the review, Andrew! > >> This code now seems redundant: >> >>      if (strcmp(fn, ".") == 0 || >>          strcmp(fn, "..") == 0) >>          return true; > Indeed. I have renamed skipfile() to isRelFileName on the way, which > looks better in the context. > >> I would probably reverse the order of these two tests. It might not make any >> difference, assuming fn is never an empty string, but it seems more logical >> to me. >> >> +    /* good to go if only digits */ >> +    if (fn[pos] == '\0') >> +        return false; >> +    /* leave if no digits */ >> +    if (pos == 0) >> +        return true; > No objections to that. Done. > >> It also looks to me like the check for a segment number doesn't ensure >> there is at least one digit, so "123." might pass, but I could be >> wrong. In any case, there isn't a test for that, and there probably >> should be. > You are right here. This name pattern has been failing. Fixed in the > attached. I have added "123_" and "123_." as extra patterns to check. > > What do you think about the updated version attached? Looks good to me. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services