ci: Skip minfree file in the cores_backtrace.sh

Started by Nazir Bilal Yavuz3 months ago7 messages
#1Nazir Bilal Yavuz
byavuz81@gmail.com
1 attachment(s)

Hi,

Melanie mentioned on the Postgres Discord channel that the OpenBSD CI
task’s 'Run cores' script fails [1]https://cirrus-ci.com/task/6309105838587904 because it tries to process a file
named minfree, which is not a valid core file.

This patch updates the cores_backtrace.sh script to skip the minfree
file across all CI operating systems, since it is not expected to be a
valid core file on any of them.

The fix was proposed by Christoph Berg, I created the patch and
verified that it works.

[1]: https://cirrus-ci.com/task/6309105838587904

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachments:

v1-0001-ci-skip-minfree-file-in-the-cores_backtrace.sh.patchtext/x-patch; charset=US-ASCII; name=v1-0001-ci-skip-minfree-file-in-the-cores_backtrace.sh.patchDownload
From adaaf0ee12a16ab944ed288b05e2d7636ae1cbaa Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Fri, 17 Oct 2025 10:39:34 +0300
Subject: [PATCH v1] ci: skip minfree file in the cores_backtrace.sh

The crash directory may contain a file named "minfree" which is not
a core dump. When the script attempts to process this file, it fails
because "minfree" is not a valid core file.

Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Author: Christoph Berg <myon@debian.org>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
---
 src/tools/ci/cores_backtrace.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/tools/ci/cores_backtrace.sh b/src/tools/ci/cores_backtrace.sh
index 54607415258..89d08fd253a 100755
--- a/src/tools/ci/cores_backtrace.sh
+++ b/src/tools/ci/cores_backtrace.sh
@@ -18,7 +18,8 @@ case $os in
 esac
 
 first=1
-for corefile in $(find "$directory" -type f) ; do
+# minfree is not a core file but may exists in the crash directory, skip it
+for corefile in $(find "$directory" -type f -not -name "minfree") ; do
     if [ "$first" -eq 1 ]; then
         first=0
     else
-- 
2.51.0

#2Daniel Gustafsson
daniel@yesql.se
In reply to: Nazir Bilal Yavuz (#1)
Re: ci: Skip minfree file in the cores_backtrace.sh

On 17 Oct 2025, at 10:26, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:

This patch updates the cores_backtrace.sh script to skip the minfree
file across all CI operating systems, since it is not expected to be a
valid core file on any of them.

+1, seems correct from a read through.

--
Daniel Gustafsson

#3Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Daniel Gustafsson (#2)
Re: ci: Skip minfree file in the cores_backtrace.sh

Hi,

On Fri, 17 Oct 2025 at 12:15, Daniel Gustafsson <daniel@yesql.se> wrote:

On 17 Oct 2025, at 10:26, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:

This patch updates the cores_backtrace.sh script to skip the minfree
file across all CI operating systems, since it is not expected to be a
valid core file on any of them.

+1, seems correct from a read through.

Thanks for looking into it!

Here is an example CI run [1]https://cirrus-ci.com/build/4950636673892352. I broke the CI on purpose, so you can
see that the 'Run cores' script finished successfully in all CI
operating systems that run cores_backtrace.sh.

[1]: https://cirrus-ci.com/build/4950636673892352

--
Regards,
Nazir Bilal Yavuz
Microsoft

#4Álvaro Herrera
alvherre@kurilemu.de
In reply to: Nazir Bilal Yavuz (#1)
Re: ci: Skip minfree file in the cores_backtrace.sh

On 2025-Oct-17, Nazir Bilal Yavuz wrote:

first=1
-for corefile in $(find "$directory" -type f) ; do
+# minfree is not a core file but may exists in the crash directory, skip it
+for corefile in $(find "$directory" -type f -not -name "minfree") ; do
if [ "$first" -eq 1 ]; then
first=0
else

This looks quite random. Why not do "find ... -name '*core*'" instead?
I mean, if we have minfree there today, we could have maxbusy tomorrow
or whatever.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"We’ve narrowed the problem down to the customer’s pants being in a situation
of vigorous combustion" (Robert Haas, Postgres expert extraordinaire)

#5Daniel Gustafsson
daniel@yesql.se
In reply to: Álvaro Herrera (#4)
Re: ci: Skip minfree file in the cores_backtrace.sh

On 17 Oct 2025, at 14:25, Álvaro Herrera <alvherre@kurilemu.de> wrote:

On 2025-Oct-17, Nazir Bilal Yavuz wrote:

first=1
-for corefile in $(find "$directory" -type f) ; do
+# minfree is not a core file but may exists in the crash directory, skip it
+for corefile in $(find "$directory" -type f -not -name "minfree") ; do
if [ "$first" -eq 1 ]; then
first=0
else

This looks quite random. Why not do "find ... -name '*core*'" instead?
I mean, if we have minfree there today, we could have maxbusy tomorrow
or whatever.

I think we should be able to count of the core directory on controlled CI
instances not being cluttered with random files - if it is we probably want a
test failure logged so we can look at it - but minfree is a special file for
core dump handling on some platforms so skipping that make sense I think.

--
Daniel Gustafsson

#6Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Daniel Gustafsson (#5)
Re: ci: Skip minfree file in the cores_backtrace.sh

On Fri, 17 Oct 2025 at 15:31, Daniel Gustafsson <daniel@yesql.se> wrote:

On 17 Oct 2025, at 14:25, Álvaro Herrera <alvherre@kurilemu.de> wrote:

On 2025-Oct-17, Nazir Bilal Yavuz wrote:

first=1
-for corefile in $(find "$directory" -type f) ; do
+# minfree is not a core file but may exists in the crash directory, skip it
+for corefile in $(find "$directory" -type f -not -name "minfree") ; do
if [ "$first" -eq 1 ]; then
first=0
else

This looks quite random. Why not do "find ... -name '*core*'" instead?
I mean, if we have minfree there today, we could have maxbusy tomorrow
or whatever.

I think we should be able to count of the core directory on controlled CI
instances not being cluttered with random files - if it is we probably want a
test failure logged so we can look at it - but minfree is a special file for
core dump handling on some platforms so skipping that make sense I think.

I agree with both. How about moving "minfree" to a variable
(presumably an array); instead of having a hard coded string? So that
we can exclude all files in this variable.

--
Regards,
Nazir Bilal Yavuz
Microsoft

#7Álvaro Herrera
alvherre@kurilemu.de
In reply to: Daniel Gustafsson (#5)
Re: ci: Skip minfree file in the cores_backtrace.sh

On 2025-Oct-17, Daniel Gustafsson wrote:

I think we should be able to count of the core directory on controlled CI
instances not being cluttered with random files - if it is we probably want a
test failure logged so we can look at it - but minfree is a special file for
core dump handling on some platforms so skipping that make sense I think.

Well, did you look at the rest of the CI file? It has to copy files
from here and there into the common directory. Within each system the
directory it uses is always the same, sure, but otherwise the whole
thing is pretty haphazard.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Entristecido, Wutra (canción de Las Barreras)
echa a Freyr a rodar
y a nosotros al mar"