On Mon, Jul 28, 2025 at 03:34:06PM +0300, Nazir Bilal Yavuz wrote:
> I wanted to show what is in my mind, v4 is attached. Summary is:
> 
> - 0001 introduces the read_file_ends() function, which reads lines
> from either the beginning or end of a given file. It includes a
> force_line_count argument that, when set to true, ensures that the
> specified number of lines is read from the file regardless of whether
> the PG_TEST_FILE_READ_LINES environment variable is set.

Hmm.  I am really wondering if 'head' and 'tail' should just be
shortcuts of some regexp patterns based on ^ and $, and that we could
allow the subroutine to use a regexp for the pattern matching.  I'll
look at that in details, but it may take me a couple of days before
getting down to it.

> - 0002 is the actual patch that improves error reporting in the
> 027_stream_regress test by using the read_file_ends() function. It
> adds a regression_log_helper() function, which reads the
> PG_TEST_FILE_READ_LINES environment variable and then calls
> read_file_ends() with force_line_count set to true. This approach
> avoids any potential race condition where the environment variable
> might be modified after being read in the regression_log_helper() and
> before used in the read_file_ends().

Why do you think the environment variable could be changed mid-flight
in the context of a single test run?
--
Michael

Attachment: signature.asc
Description: PGP signature

Reply via email to