Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t5Lbd-005Vk5-Be for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 09:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t5Lbb-004zj7-IS for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Oct 2024 09:00:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t5Lbb-004zip-6g for pgsql-hackers@lists.postgresql.org; Mon, 28 Oct 2024 09:00:07 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t5LbZ-003O0d-2P for pgsql-hackers@lists.postgresql.org; Mon, 28 Oct 2024 09:00:06 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-539f7606199so4376312e87.0 for ; Mon, 28 Oct 2024 02:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730106004; x=1730710804; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=2ffzN/c3fAgluwk45d+5Xdhhph1gyGGlJErw0a+yUhI=; b=ZKu9UpnmyPe+dfyelzCpsABpN8+cab6RwAQQoXWGjOlbz7nGHQEUrGthfwov0cos0M 1Mew+wRPLxImXtSCcZk6PybNUJfyhAMroQJxXdG/+YARjhtLHOomLm0iMEUq1axfhrI7 jUoW15WJSpyaVLFP87ihpPNSX362/LA2z9kuevAX/gn5OHZu9eAvDU/kNbSR2SH7JSZj aEkynWcCSz7cOMWO68kXdjr3aOtCoQgAFr3K4a02/YSaczNNVCFBy5R2c0xcCY8ytXxO +aGxln0BmB2coX4vvnfuOMqwTb2rNn0oIISYFyHJZur0cdiWm0QHk9v1mYsIURHf7mDn l8jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730106004; x=1730710804; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2ffzN/c3fAgluwk45d+5Xdhhph1gyGGlJErw0a+yUhI=; b=CeE5Y7eo+q5BDIOU9d0OyHAFEE2vH2UBWfDtfQqnCuyfrJsJFoLRSdCALwHIm1v64M LuvAbBKHwYadCAk24Q/oJXTmhkiCO0x3Nrs/vdKPOMTAWbY6vsUwVvU09pCW6qxG2GPA WalPUA/xHlYppaQKlDL/Cf/xDVQx2GqakOPyTNeAeUHYkhLaBzdroSN+qQd4l6Hte85i sKK9jPKldkBAQzUPGEb71sRCIrTnCOSWPlBFI9Jf/SmI3AnTG1cgp8zc6hI4oOtyuqCs fdCOnWHWnQ2A999JgnNxyPQb12LyMN34SKQbeLCG9u9sVr09R95laNITTnCj0We+UyWE mGdQ== X-Forwarded-Encrypted: i=1; AJvYcCWla0txa+4z0f+rxkEPM8gkIR0gs8DEIus9ZsUNUq0pbSRloFphPYDqrpbP4Z0YeoMJY6nC4Q0p7ZQX7GCh@lists.postgresql.org X-Gm-Message-State: AOJu0YyYWvf/8PoZE0p899hAsEV2H7adqjr77qeGchGoooniyjEDKvkh JIjEzmmte1RqMKa8BJi93+Xfxm7zvHLLLQWQketfHd24hU2c/Qow X-Google-Smtp-Source: AGHT+IG+f+54C1ve1bEiMMOLLNcKV+L/s96+4HZ47Lu07suJm0gEl4LImR66cFG8EDsxJoiF1yElmA== X-Received: by 2002:a05:6512:1585:b0:539:8c02:64d5 with SMTP id 2adb3069b0e04-53b348da77amr2583146e87.27.1730106002272; Mon, 28 Oct 2024 02:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.24.36]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53b2e1c873csm1029707e87.198.2024.10.28.02.00.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Oct 2024 02:00:01 -0700 (PDT) Message-ID: <79284195-4993-7b00-f6df-8db28ca60fa3@gmail.com> Date: Mon, 28 Oct 2024 12:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Better error reporting from extension scripts (Was: Extend ALTER OPERATOR) Content-Language: en-US To: Tom Lane Cc: Andrew Dunstan , buildfarm@sraoss.co.jp, Pavel Stehule , Christoph Berg , Michael Banck , Tommy Pavlicek , =?UTF-8?Q?Dagfinn_Ilmari_Manns=c3=a5ker?= , pgsql-hackers@lists.postgresql.org, jian.universality@gmail.com References: <560086.1698160614@sss.pgh.pa.us> <570833.1698162135@sss.pgh.pa.us> <66f33840.050a0220.1f9e60.7fb9@mx.google.com> <325394.1727365907@sss.pgh.pa.us> <571930.1727454668@sss.pgh.pa.us> <621972.1727459684@sss.pgh.pa.us> <1092841.1727552736@sss.pgh.pa.us> <2245576.1728418678@sss.pgh.pa.us> <2864637.1728662904@sss.pgh.pa.us> <1967263.1729611423@sss.pgh.pa.us> <2480333.1729784872@sss.pgh.pa.us> <3792414.1730050914@sss.pgh.pa.us> From: Alexander Lakhin In-Reply-To: <3792414.1730050914@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Tom, 27.10.2024 20:41, Tom Lane wrote: > I wrote: >> In the no-good-deed-goes-unpunished department: buildfarm member >> hamerkop doesn't like this patch [1]. The diffs look like >> ... >> So what I'd like to do to fix this is to change >> - if ((file = AllocateFile(filename, PG_BINARY_R)) == NULL) >> + if ((file = AllocateFile(filename, "r")) == NULL) > Well, that didn't fix it :-(. I went so far as to extract the raw log > files from the buildfarm database, and what they show is that there is > absolutely no difference between the lines diff is claiming are > different: > > -QUERY: CREATE FUNCTIN my_erroneous_func(int) RETURNS int LANGUAGE SQL\r\n > +QUERY: CREATE FUNCTIN my_erroneous_func(int) RETURNS int LANGUAGE SQL\r\n > > It's the same both before and after 924e03917, which made the code > change depicted above, so that didn't help. > > So I'm pretty baffled. I suppose the expected and result files must > actually be different, and something in subsequent processing is > losing the difference before it gets to the buildfarm database. > But I don't have the ability to debug that from here. Does anyone > with access to hamerkop want to poke into this? > > Without additional information, the only thing I can think of that > I have any confidence will eliminate these failures is to reformat > the affected test cases so that they produce just a single line of > output. That's kind of annoying from a functionality-coverage point > of view, but I'm not sure avoiding it is worth moving mountains for. > I've managed to reproduce the issue with the core.autocrlf=true git setting (which sets CR+LF line ending in test_ext7--2.0--2.1bad.sql) and with diff from msys: C:\msys64\usr\bin\diff.exe --version diff (GNU diffutils) 3.8 (Gnu/Win32 Diff [1] doesn't detect those EOL differences and thus the test doesn't fail.) I can really see different line endings with hexdump: hexdump -C ...testrun\test_extensions\regress\regression.diffs 00000230  20 20 20 20 20 20 20 20  5e 0a 2d 51 55 45 52 59  | ^.-QUERY| 00000240  3a 20 20 43 52 45 41 54  45 20 46 55 4e 43 54 49  |: CREATE FUNCTI| 00000250  4e 20 6d 79 5f 65 72 72  6f 6e 65 6f 75 73 5f 66  |N my_erroneous_f| 00000260  75 6e 63 28 69 6e 74 29  20 52 45 54 55 52 4e 53 |unc(int) RETURNS| 00000270  20 69 6e 74 20 4c 41 4e  47 55 41 47 45 20 53 51  | int LANGUAGE SQ| 00000280  4c 0a 2b 51 55 45 52 59  3a 20 20 43 52 45 41 54 |L.+QUERY:  CREAT| 00000290  45 20 46 55 4e 43 54 49  4e 20 6d 79 5f 65 72 72  |E FUNCTIN my_err| 000002a0  6f 6e 65 6f 75 73 5f 66  75 6e 63 28 69 6e 74 29 |oneous_func(int)| 000002b0  20 52 45 54 55 52 4e 53  20 69 6e 74 20 4c 41 4e  | RETURNS int LAN| 000002c0  47 55 41 47 45 20 53 51  4c 0d 0a 20 41 53 20 24  |GUAGE SQL.. AS $| hexdump -C .../testrun/test_extensions/regress/results/test_extensions.out | grep -C5 FUNCTIN 00000b80  20 5e 0d 0a 51 55 45 52  59 3a 20 20 43 52 45 41  | ^..QUERY:  CREA| 00000b90  54 45 20 46 55 4e 43 54  49 4e 20 6d 79 5f 65 72  |TE FUNCTIN my_er| 00000ba0  72 6f 6e 65 6f 75 73 5f  66 75 6e 63 28 69 6e 74 |roneous_func(int| 00000bb0  29 20 52 45 54 55 52 4e  53 20 69 6e 74 20 4c 41  |) RETURNS int LA| 00000bc0  4e 47 55 41 47 45 20 53  51 4c 0d 0d 0a 41 53 20  |NGUAGE SQL...AS | whilst hexdump -C .../src/test/modules/test_extensions/expected/test_extensions.out | grep -C5 FUNCTIN 00000b80  20 5e 0d 0a 51 55 45 52  59 3a 20 20 43 52 45 41  | ^..QUERY:  CREA| 00000b90  54 45 20 46 55 4e 43 54  49 4e 20 6d 79 5f 65 72  |TE FUNCTIN my_er| 00000ba0  72 6f 6e 65 6f 75 73 5f  66 75 6e 63 28 69 6e 74 |roneous_func(int| 00000bb0  29 20 52 45 54 55 52 4e  53 20 69 6e 74 20 4c 41  |) RETURNS int LA| 00000bc0  4e 47 55 41 47 45 20 53  51 4c 0d 0a 41 53 20 24  |NGUAGE SQL..AS $| It looks like --strip-trailing-cr doesn't work as desired for this diff version. I've also dumped buf in read_whole_file() and found that in both PG_BINARY_R and "r" modes the 0d 0a ending is preserved. But it changed to 0a with the "rt" mode (see [1]), and it makes the test (and the whole `meson test`) pass for me. [1] https://gnuwin32.sourceforge.net/packages/diffutils.htm [2] https://learn.microsoft.com/en-us/cpp/c-runtime-library/file-translation-constants?view=msvc-170 Best regards, Alexander