Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l122j-0003c1-3j for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Jan 2021 07:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l122i-0004Ef-28 for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Jan 2021 07:00:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l122h-0004EY-Pc for pgsql-hackers@lists.postgresql.org; Sun, 17 Jan 2021 07:00:07 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l122f-0001cI-Ni for pgsql-hackers@lists.postgresql.org; Sun, 17 Jan 2021 07:00:06 +0000 Received: by mail-lf1-x135.google.com with SMTP id x20so19415491lfe.12 for ; Sat, 16 Jan 2021 23:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=OVIXNVaCWQr87+DDVElnxEfRZ4IA0xklyFj1DzByDZE=; b=kq4nbCB9xHif6nhCxQDI5azYw1OurQuZcFFwHkvM7ctm5fkwXP5xuUUWJjkmqT65YK guDC89zmN6tdtQyRqF8TgXV/kad6pJyUraa8wC6AKzthWtlymTSKdqENxYTKkdGXkir0 Jju010aXzKkw8nCaME3uouFCnVL/saWkGfy30e3g389khB5YMGfsew6uI01cVgbOoLuT 44iLHPSFiXuKR5xXZuncpDIFWUUysM17hnce814E5kWeAID+8yTRJro0K9ndSsoz49Aw eOoHbNFJPDk1MChX4JMsCYrlowyJY6MsE3KAhAOc5BOFeo+a6IsdU4z+MOjatAjia87g M8Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=OVIXNVaCWQr87+DDVElnxEfRZ4IA0xklyFj1DzByDZE=; b=HCotYcCtrSoweZlRl5XukyUO0EIwdF78zSQE0dNt8JE66pxv1TED03/m4DQT5wWuVN M3wf/dL01Qy4oiRoXryYNrqq8nLJt9HEilAXzmd4ZHLsyG4bnCqnvBTKv80xrl8SmiI+ Aclg1nFH/KqS7Wl56YQeVB76QvQwgXEUuWYAAjZchWzGF9HKc/WEOrTNpTq7ll8gELye OxK5J5lw4afPTouearmkm30/w+lasGNZvKv4W1bsd8ctiXtYe2uSg6RNKJtXtgPQo7Fp nFHGSWghzZRFL+A2X3HlkZbR9NthET04+3aWpj6h4X/MExdb3cAkKEAJg00BPHFnO3TN dt5A== X-Gm-Message-State: AOAM53006aklOM9REcXgYb3BzLGPgMkpWfJ+G/6vrCjkXGzlHNlcSJNO 1QRwrMO6/mkjGa2vbLHd1WteUtxru/A= X-Google-Smtp-Source: ABdhPJxFRSIkapqhMMpKOEPETPuev5OKuthAEyVllcUfrAPDMG3mIXq/QXXr+CYlnU0Zez2RaCVq0Q== X-Received: by 2002:a19:f617:: with SMTP id x23mr8776207lfe.428.1610866803057; Sat, 16 Jan 2021 23:00:03 -0800 (PST) Received: from [1.0.0.7] ([178.155.6.30]) by smtp.gmail.com with ESMTPSA id s1sm1341113ljs.0.2021.01.16.23.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Jan 2021 23:00:02 -0800 (PST) Subject: Re: Test harness for regex code (to allow importing Tcl's test suite) To: Tom Lane , Mark Dilger Cc: "pgsql-hackers@postgresql.org" References: <2873268.1609732164@sss.pgh.pa.us> <00A426B2-983A-4996-AF66-C9511B88FFC3@enterprisedb.com> <2878372.1609739236@sss.pgh.pa.us> From: Alexander Lakhin Message-ID: <3206aace-50db-e02a-bbea-76d5cdaa2cb6@gmail.com> Date: Sun, 17 Jan 2021 10:00:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <2878372.1609739236@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello Tom, 04.01.2021 08:47, Tom Lane wrote: > Hm. There isn't anything about test_regex()'s API that I would want > to expose to end users ;-) ... it's just designed to replicate the > test API that Henry Spencer designed a couple decades ago, which IMO > was not too clean even by the standards of the time. As test_regex() is not meant to be public, maybe this is of little importance, but I've found another bug when exploiting the new test module: select * from test_regex(repeat('(x)', 32), 'a', 'c'); leads to ==00:00:00:05.736 2605072== Invalid write of size 4 ==00:00:00:05.736 2605072==    at 0x4866D09: setup_test_matches (test_regex.c:564) ==00:00:00:05.736 2605072==    by 0x4867276: test_regex (test_regex.c:105) ==00:00:00:05.736 2605072==    by 0x37B10C: ExecMakeTableFunctionResult (execSRF.c:234) ==00:00:00:05.736 2605072==    by 0x38AAA4: FunctionNext (nodeFunctionscan.c:95) ==00:00:00:05.736 2605072==    by 0x37BA68: ExecScanFetch (execScan.c:133) ==00:00:00:05.736 2605072==    by 0x37BB05: ExecScan (execScan.c:182) ==00:00:00:05.736 2605072==    by 0x38A9CE: ExecFunctionScan (nodeFunctionscan.c:270) ==00:00:00:05.736 2605072==    by 0x378E5D: ExecProcNodeFirst (execProcnode.c:450) ==00:00:00:05.736 2605072==    by 0x372CBC: ExecProcNode (executor.h:247) ==00:00:00:05.736 2605072==    by 0x372CBC: ExecutePlan (execMain.c:1542) ==00:00:00:05.736 2605072==    by 0x372E22: standard_ExecutorRun (execMain.c:364) ==00:00:00:05.736 2605072==    by 0x372EF2: ExecutorRun (execMain.c:308) ==00:00:00:05.736 2605072==    by 0x4E2B77: PortalRunSelect (pquery.c:912) ==00:00:00:05.736 2605072==  Address 0xee4d5ec is 908 bytes inside a block of size 1,024 alloc'd ==00:00:00:05.736 2605072==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==00:00:00:05.736 2605072==    by 0x62239C: AllocSetAlloc (aset.c:919) ==00:00:00:05.736 2605072==    by 0x629656: palloc0 (mcxt.c:995) ==00:00:00:05.736 2605072==    by 0x4866A06: setup_test_matches (test_regex.c:450) ==00:00:00:05.736 2605072==    by 0x4867276: test_regex (test_regex.c:105) ==00:00:00:05.736 2605072==    by 0x37B10C: ExecMakeTableFunctionResult (execSRF.c:234) ==00:00:00:05.736 2605072==    by 0x38AAA4: FunctionNext (nodeFunctionscan.c:95) ==00:00:00:05.736 2605072==    by 0x37BA68: ExecScanFetch (execScan.c:133) ==00:00:00:05.736 2605072==    by 0x37BB05: ExecScan (execScan.c:182) ==00:00:00:05.736 2605072==    by 0x38A9CE: ExecFunctionScan (nodeFunctionscan.c:270) ==00:00:00:05.736 2605072==    by 0x378E5D: ExecProcNodeFirst (execProcnode.c:450) ==00:00:00:05.736 2605072==    by 0x372CBC: ExecProcNode (executor.h:247) ==00:00:00:05.736 2605072==    by 0x372CBC: ExecutePlan (execMain.c:1542) ==00:00:00:05.736 2605072== Best regards, Alexander