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.96) (envelope-from ) id 1wUzzc-001bSH-0Z for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 04:47:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wUzza-004sMe-2W for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 04:47:42 +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.96) (envelope-from ) id 1wUzza-004sMU-1Z for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 04:47:42 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wUzzY-00000001B58-0Z4L for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 04:47:41 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id A72B91D00180; Thu, 4 Jun 2026 00:47:38 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Thu, 04 Jun 2026 00:47:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1780548458; x=1780634858; bh=2HbEKIeFEI Hv0qoUZVnRKU88Uy47Sp/5G3V9PHSF968=; b=TaB5vDHltl8rtQIaPdTPhMh112 b76HnFWH/7D91BFSr5LM2YhiVQ4MqEGY9GzrxMhw50mBGI/d5cZXkFxqiyhlffcH 6nXsXjN9DS8nTM34CH5O0h7j319XpY1iH0LHruVVI4QyiJqAB0yg7qci0btw8osn AWX0sHe6hOIQi5W///Xl3fkucg6MyX8wHUQtmrhkc5ncNMZIx/Axg9nnORvm/qg7 p5BoLOUFPFnCM6MazMRw69ONP88najI3XE+eLyEGZuA7prk6IpLvBZGPyMA1m9ju ZjNCEysDIUSjTyPfsM+++AO9VgzNLaDl1e1/MYn9uj2+rUle8YcOWaYKQ/Sg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1780548458; x=1780634858; bh=2HbEKIeFEIHv0qoUZVnRKU88Uy47Sp/5G3V 9PHSF968=; b=UkjYL564QLNNVX8+jBh7uOKW1yqIJx5m9cdTRksEKminWkO+qnp IvRK7dN0DTGHvR4f2csoDS2MBxVBYQe/25TFsrFayMklPfveymwvp6S173Xr3UQY Zk6hoc6Hgt+xlNsQvRIU/aMRGTb9MUzNDYKXRzlRaisivhintB4DLSNN90iPLYfy 5opdnLAcR1CELcGSpuPzAccaGI8h33pywea2/1xSlJsFODe0vps1LPRSep0rjYi7 gO5FlW8Jk87aAH7gFuMu71Pq6icKUCTxbmMSq/eviSYCbYp7lYyId38yQo39SCvJ tOADh1rdHk7efGbx+tq6/k8tIkH8QlsA37g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGZQZepjz7c9m++i9ySi66mXsgm/HH0Crq/7k0PzgHsFw6LKZ4rULuqjjbx6YCxq9 FJBbhiQzL3WksSG5sJha1gmcUx0WvyJ+uIshAbkkmTDGWDtJvpIHSTYVX8+uyfsz7262jR oQhlmWRZ/d1TuVUo5oCsyZtfxpmLMDfDuUNCWoSHsfd78D6yfXFrz2ZNjwQPxDiZqrkv8G GstYlmOInHa6mFfzlUa/iX6gs7d0Qy86YT4crsE3C+fH9XmQ/0Ra+rJPi0GdVOHGS229Lp B/eMrcYiET1C/tgOo6v1pKjWEREreXmsdiSDObr4KeeS9/ofdwATTbG1LwwgI49UWOigk6 +VhIPNJZZ4oUoxNoUQ494Qc9gEg+bfUa+E7MyZHQzsw4fbG87Gdpn0/UHFEXqxAfujy3TL aDXBgi3a0c+FdrVpbcSZB8kw+QzoGeVucKnuWY6egotzZinhE5pNqGfd2N4sX3PvhEKTno T6oil2UjUYlbK4jFYfqqOd4mbX/wBMnL1V/6xEGKYe2xb510qIfUiyV7Tbz/lnESAwJwaE cPGDCpVF5qa+oEWlExFo//c7cav48Bncf51+ZbhM2a83wD7TsBBZe5iJHKTIT6rv/yDZlZ 5LZxH3Y28XJ5yWI6trIOxFRJP7aBh6iSLJODqnAVFQ8ZWFvt7Zc7TaQLOfKg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 4 Jun 2026 00:47:36 -0400 (EDT) Date: Thu, 4 Jun 2026 13:47:32 +0900 From: Michael Paquier To: Chao Li Cc: Postgres hackers , tfoertsch123@gmail.com, kanbayashi.dev@gmail.com Subject: Re: SERVICEFILE shows wrong file after servicefile fallback Message-ID: References: <59DD1652-4EB5-449B-8DE3-959F06561A96@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IuQ61MXkfUFTutKx" Content-Disposition: inline In-Reply-To: <59DD1652-4EB5-449B-8DE3-959F06561A96@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --IuQ61MXkfUFTutKx Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 02, 2026 at 09:42:23PM +0800, Chao Li wrote: > While testing =E2=80=9Cpsql: Add variable SERVICEFILE=E2=80=9D, I found a= small > issue where SERVICEFILE may show the wrong value. >=20 > While tracing the code, I noticed there is a fallback path. If the > service file specified in the connection string does not contain the > requested service, libpq falls back to pg_service.conf. So I tested > the following case: Right, as of the default file in PGSYSCONFDIR. This qualifies as an open item for v19. > I think the bug was actually introduced by the previous commit > 092f3c63efc6. In parseServiceFile(), if the service file has already > been set in the connection options, it refuses to update the value, > so the fallback service file is not synced to the connection > options. Then SERVICEFILE is read from the connection options, which > still contain the original file specified on the command line. So, > SERVICEFILE just makes the bug visible.=20 Yep, it looks like you are right here. It does not make sense to show in SERVICEFILE the file that has been skipped in favor of the second default in PGSYSCONFDIR. We need to show the latter. An \echo of=20 SERVICEFILE is an interesting way to show your point. Why not. Thanks for the report, will fix. -- Michael --IuQ61MXkfUFTutKx Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmohA2QACgkQnvQgOdby QH1h1g//dfU0fxfs2ltB1F0FXXOiVo7Zao794cRT+PBPp3aUohPGW1f+ckZ9pH9F GOC6qyz6t0ZFxOyIHcCNR8Gedw4DxfmdW3Y2UQ8DryzYuxSOA7JNzScdLIpD8BKY QCNvOBlqCanwNMY2NQqY2UkfwDACgETrYRoRHi9sqhuRgCIiCbbkF016RDeq9UnD Sk0mBA5//CT/wlbooLKeEshVSfrnZ6lY8T7knO1s+0B9SGQ0FZ8a4jbHw4vSmjvG p4vWG1W3/3BynjrZOT4n7U8kSEtY+9WeWgU/4GQ+NrCt+69L4oisCk9bLSjZLW1Q m+CeK+ZAB8F5r8QS1JfFdogyPPZzYjQgP2kDCaW421JQ2V7TcVi9o3D3W7fz6/Rl 3GaIPt0/QDKYL6Fa7todTnzlU9OyeMDRCjychom2MqPOJxN1P1uoufCi+dSnlKm2 8YR+hw8wVO+6LtpZXHLU0tn294TiMVlVRDSfVhmaHzfM+JA4O8kg+FAa9OityNPt Sl+jnMIDdiFfjxdW54zgPk0FjZfUqhEJCKIcI+mO3IdE8zzZ6TD+EWJ4o9WIOlD3 hK3x7KDwJVaafSIS1aFfRbBGXZkPHWz9I015ENmN6dsxaUUAwOVKEPR0iDapkZNY JfVkiCTE+Hs4lMVe1MTJtca4OMgmSgmDCUNPFFGHAZwQvapsADM= =7v36 -----END PGP SIGNATURE----- --IuQ61MXkfUFTutKx--