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 1jiWtn-0006H5-Vl for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jun 2020 05:34:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jiWtm-0001nh-MP for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Jun 2020 05:34:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiWtk-0001na-Tb for pgsql-bugs@lists.postgresql.org; Tue, 09 Jun 2020 05:34:10 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jiWtf-0007QY-OX for pgsql-bugs@lists.postgresql.org; Tue, 09 Jun 2020 05:34:08 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 12B045C008D; Tue, 9 Jun 2020 01:34:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 09 Jun 2020 01:34:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=u5uG2dz8y1KZZMC7DW+GUF6URK+ h52x6mNKjOfDuX4c=; b=SA7VGTFnpCbU/ljupqGi4OwBeHSMRIz6L4+o07J1XYO 9vWM5Su4Wndlq6YrmJw8eYqb19T3o0D9pFUR9O+Ch802wka8dC45N7a8ryKSIHJ0 RwTt+0u2dQvHqjCYVXiVcMhpgF185pma2ZltAMALZVxMTaTWKJNfpBRblMJWgytH M3fjcSEHgDOHggEdoN1hXtuBEWbp/ImgOR0ZTgG39vk4hJaUv6979LZMnFJMdRiX QOPP/tDKMpctOkv3Saoym+e+WoLsm9L3nJcgj0zDe0ePwmWrixc5+V42JttPolDD GUwuGf5X+uo4j4tOLrLd+ckYCfUBL5CssnvvPA/w81Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=u5uG2d z8y1KZZMC7DW+GUF6URK+h52x6mNKjOfDuX4c=; b=H3unNex2rAdFWh/2/1HJTv Y2EMg+yQZdEFXpeJk1TrKhk2DwedgdFEunBYTPtbDDY+SmptiQQWGGj5rcZwkelx UmU1QVdQ6C4qK/0w9U/FaqkozemMbkdYI0MPHxssswNGiTOlgAHyx1TjMuttGmhM q1o7aNyXSdvl6ztKtlzziseug3Oaq2tCYErPyophqa6l+ia9mKxrtysSrkfOutVo /TEqrtOTQgjUqgJuO+wH5Vt74oG6wUZKVFu0JwtMwTvgwDmmCWL4xG+iBwZ/KZG4 AvcXouoVjGcGtfm3eI2LR+Gm9xuz5MazjIwKo/cOCii5yFoUGhBVu/Ewh7VCqm3Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehfedgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvgeduuefhtdeuleettdevjeeh heeiveeuieegleetgeeljeelieeuieehgeevhfenucfkphepudduuddruddtvddrudektd drudekheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 43D1E3280064; Tue, 9 Jun 2020 01:33:59 -0400 (EDT) Date: Tue, 9 Jun 2020 14:33:56 +0900 From: Michael Paquier To: Daniel Gustafsson Cc: r.zharkov@postgrespro.ru, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16484: pg_regress fails with --outputdir parameter Message-ID: <20200609053356.GC38342@paquier.xyz> References: <16484-4d89e9cc11241996@postgresql.org> <153B2C23-E972-4D2B-BBD3-EA77AEB79329@yesql.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="J5MfuwkIyy7RmF4Q" Content-Disposition: inline In-Reply-To: <153B2C23-E972-4D2B-BBD3-EA77AEB79329@yesql.se> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --J5MfuwkIyy7RmF4Q Content-Type: multipart/mixed; boundary="p2kqVDKq5asng8Dg" Content-Disposition: inline --p2kqVDKq5asng8Dg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jun 08, 2020 at 11:09:42AM +0200, Daniel Gustafsson wrote: > Nice catch, testing the attached patch does indeed make pg_regress run without > errors if outputdir doesn't exist. No objections to that. That seems more useful than having to recreate them before running any custom script specifying --outputdir. > While looking at it though, I noticed that we nearby use stat() in a single > place while the rest use check_directory(). Is there a reason to not use > check_directory consistently as per the attached diff? Indeed. And two extra things are that you can just simplify src/bin/pg_upgrade/test.sh and src/tools/msvc/vcregress.pl so as they don't create manually those repositories. This report is not really annoying for the average user in my opinion, so there may be little point in backpatching this stuff. And this leads me to the attached. -- Michael --p2kqVDKq5asng8Dg Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="pg_regress_stat_v3.diff" Content-Transfer-Encoding: quoted-printable diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh index 10a28d8133..7ff06de6d1 100644 --- a/src/bin/pg_upgrade/test.sh +++ b/src/bin/pg_upgrade/test.sh @@ -106,8 +106,6 @@ outputdir=3D"$temp_root/regress" EXTRA_REGRESS_OPTS=3D"$EXTRA_REGRESS_OPTS --outputdir=3D$outputdir" export EXTRA_REGRESS_OPTS mkdir "$outputdir" -mkdir "$outputdir"/sql -mkdir "$outputdir"/expected mkdir "$outputdir"/testtablespace =20 logdir=3D`pwd`/log diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 38b2b1e8e1..b29de5edd3 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -465,17 +465,20 @@ convert_sourcefiles_in(const char *source_subdir, con= st char *dest_dir, const ch { char testtablespace[MAXPGPATH]; char indir[MAXPGPATH]; - struct stat st; - int ret; + char test_subdir[MAXPGPATH]; char **name; char **names; int count =3D 0; =20 snprintf(indir, MAXPGPATH, "%s/%s", inputdir, source_subdir); =20 + /* Create dest_subdir directory if it not exists */ + snprintf(test_subdir, MAXPGPATH, "%s/%s", dest_dir, dest_subdir); + if (!directory_exists(test_subdir)) + make_directory(test_subdir); + /* Check that indir actually exists and is a directory */ - ret =3D stat(indir, &st); - if (ret !=3D 0 || !S_ISDIR(st.st_mode)) + if (!directory_exists(indir)) { /* * No warning, to avoid noise in tests that do not have these diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 4a53a004b7..3365ee578c 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -571,8 +571,6 @@ sub upgradecheck my $outputdir =3D "$tmp_root/regress"; my @EXTRA_REGRESS_OPTS =3D ("--outputdir=3D$outputdir"); mkdir "$outputdir" || die $!; - mkdir "$outputdir/sql" || die $!; - mkdir "$outputdir/expected" || die $!; mkdir "$outputdir/testtablespace" || die $!; =20 my $logdir =3D "$topdir/src/bin/pg_upgrade/log"; --p2kqVDKq5asng8Dg-- --J5MfuwkIyy7RmF4Q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl7fH0QACgkQnvQgOdby QH1Jxg/+PLtHoKvmTre6jrdiblqiiYZ0uCdqlAWO1V8K/4CwQcI+Jd2nKumI21cH 51RqS+yUe4Akma2Q4SCPJrVM4oxnYj1InD+E13GLGcgwktoJaVxd+JE50kdaHoju wu56SZ4nvngmv601bzNyUYAsbmsehUpAwjFhIbstHIVAQ3gtngZhv3IhX8Kslt4b ZvNcrC6RBiw+2ldAOCkzfZoWGzL0JqFXGVKn+Lv8EQdGRGaGYq9sCnXBaJFb8GKU drOc6/eK6B/f09wSKNavMljTQeC4JSxvmBmqt2rlvDCWokQdOEyRDuZJcXc8gYZy DStyCUMGvaYFWYMgS0DvdPluqINulN887DwI8u8nA+zi4Fdx/t5s031oT8lyi7iq C7QvTKiSQIOD2RlWislSbnvh7YBIdYa0MTtKR+EnrfCQtAzKgmjifqhszOqH7vuq CazYJZveHTG7ZIEf8Hd9aOd8XCFYRW1Svp8cFugFGkQWKFnIjdTsP3xVJqgUyoX3 TOJyDvPgT0hXMmQwjCYUrVRpjJzhcXrELWPWTMEF7uOMCpY1eLqbQC77BwyVB78E SNJ9RAICUckHc33nQXBAIx0AYQ0nP/1JJ54ph+HNxmNKwIcjbWTdQrPIEDytAuIG qbe85aN/FWnPkz5xyFVS2N/QnENo1TbxyjF56Nj1BAVxtJ3ylLE= =e4/Y -----END PGP SIGNATURE----- --J5MfuwkIyy7RmF4Q--