From 49691072e220f240f392d9bc6863469f846a09b7 Mon Sep 17 00:00:00 2001 From: Jacob Champion Date: Tue, 7 Oct 2025 10:54:29 -0700 Subject: [PATCH 1/6] libpq: Simplify newline handling in t/006_service CRLF translation will already be handled by text mode; we don't need to add our own. --- src/interfaces/libpq/t/006_service.pl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/interfaces/libpq/t/006_service.pl b/src/interfaces/libpq/t/006_service.pl index 797e6232b8f..432a7290c65 100644 --- a/src/interfaces/libpq/t/006_service.pl +++ b/src/interfaces/libpq/t/006_service.pl @@ -22,18 +22,14 @@ $dummy_node->init; my $td = PostgreSQL::Test::Utils::tempdir; -# Windows vs non-Windows: CRLF vs LF for the file's newline, relying on -# the fact that libpq uses fgets() when reading the lines of a service file. -my $newline = $windows_os ? "\r\n" : "\n"; - # Create the set of service files used in the tests. # File that includes a valid service name, and uses a decomposed connection # string for its contents, split on spaces. my $srvfile_valid = "$td/pg_service_valid.conf"; -append_to_file($srvfile_valid, "[my_srv]" . $newline); +append_to_file($srvfile_valid, "[my_srv]\n"); foreach my $param (split(/\s+/, $node->connstr)) { - append_to_file($srvfile_valid, $param . $newline); + append_to_file($srvfile_valid, $param . "\n"); } # File defined with no contents, used as default value for PGSERVICEFILE, @@ -51,14 +47,13 @@ my $srvfile_missing = "$td/pg_service_missing.conf"; my $srvfile_nested = "$td/pg_service_nested.conf"; copy($srvfile_valid, $srvfile_nested) or die "Could not copy $srvfile_valid to $srvfile_nested: $!"; -append_to_file($srvfile_nested, 'service=invalid_srv' . $newline); +append_to_file($srvfile_nested, "service=invalid_srv\n"); # Service file with nested "servicefile" defined. my $srvfile_nested_2 = "$td/pg_service_nested_2.conf"; copy($srvfile_valid, $srvfile_nested_2) or die "Could not copy $srvfile_valid to $srvfile_nested_2: $!"; -append_to_file($srvfile_nested_2, - 'servicefile=' . $srvfile_default . $newline); +append_to_file($srvfile_nested_2, "servicefile=$srvfile_default\n"); # Set the fallback directory lookup of the service file to the temporary # directory of this test. PGSYSCONFDIR is used if the service file -- 2.34.1