]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix portability issue in authentication test 003_peer
authorMichael Paquier <michael@paquier.xyz>
Tue, 28 Jul 2026 01:49:26 +0000 (10:49 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 28 Jul 2026 01:49:26 +0000 (10:49 +0900)
The mapped user name is built upon the OS user name of the environment
where the test is run.  Depending on the characters used in the OS user
name, CREATE ROLE may not get parsed (the author has mentioned hyphens
as one case), causing a failure of the test.

Let's use double-quotes around the mapped user name, which should be a
solution good enough for the environments where this test tends to run.
The buildfarm issued no complaint over the years.

Oversight in 3c4e26a62c31, so backpatch down to v19.  Perhaps
3c4e26a62c31 and this commit should be backpatched further down, but
let's leave that for another day, if it proves necessary.

Author: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/20260727133857.fbd23d43d422f10f376a8bee@sraoss.co.jp
Backpatch-through: 19

src/test/authentication/t/003_peer.pl

index 5c774babd3233997eb34b530e81e51071bed5564..686e409ce6a3c08413af186b7d167dca36e7ecec 100644 (file)
@@ -213,7 +213,7 @@ test_role(
 
 # Create target role for \1 tests.
 my $mapped_name = "test${regex_test_string}map${regex_test_string}user";
-$node->safe_psql('postgres', "CREATE ROLE $mapped_name LOGIN");
+$node->safe_psql('postgres', "CREATE ROLE \"$mapped_name\" LOGIN");
 
 # Success as the regular expression matches and \1 is replaced in the given
 # subexpression.