pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15006: "make check" error if current user is "user"
11+ messages / 8 participants
[nested] [flat]
* BUG #15006: "make check" error if current user is "user"
@ 2018-01-11 12:53 PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
0 siblings, 1 reply; 11+ messages in thread
From: PG Bug reporting form @ 2018-01-11 12:53 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: eshkinkot@gmail.com
The following bug has been logged on the website:
Bug reference: 15006
Logged by: Sergey Burladyan
Email address: eshkinkot@gmail.com
PostgreSQL version: 10.1
Operating system: Debian GNU/Linux 9 (stretch) in docker
Description:
I run tests in docker with current system user "user" and "make check" stop
with error:
...
updatable_views ... ok
rolenames ... FAILED
roleattributes ... ok
...
==== /home/user/postgresql-10.1/src/test/regress/regression.diffs ====
*** /home/user/postgresql-10.1/src/test/regress/expected/rolenames.out Tue
Nov 7 00:46:52 2017
--- /home/user/postgresql-10.1/src/test/regress/results/rolenames.out Thu
Jan 11 12:51:19 2018
***************
*** 42,47 ****
--- 42,48 ----
CREATE ROLE "current_user";
CREATE ROLE "session_user";
CREATE ROLE "user";
+ ERROR: role "user" already exists
CREATE ROLE current_user; -- error
ERROR: CURRENT_USER cannot be used as a role name here
LINE 1: CREATE ROLE current_user;
***************
*** 950,952 ****
--- 951,954 ----
DROP OWNED BY regress_testrol0, "Public", "current_user",
regress_testrol1, regress_testrol2, regress_testrolx CASCADE;
DROP ROLE regress_testrol0, regress_testrol1, regress_testrol2,
regress_testrolx;
DROP ROLE "Public", "None", "current_user", "session_user", "user";
+ ERROR: current user cannot be dropped
======================================================================
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
@ 2018-01-17 21:58 ` Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
2018-01-19 14:18 ` Re: BUG #15006: "make check" error if current user is "user" Sergey Burladyan <eshkinkot@gmail.com>
0 siblings, 2 replies; 11+ messages in thread
From: Tomas Vondra @ 2018-01-17 21:58 UTC (permalink / raw)
To: eshkinkot@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form <noreply@postgresql.org>
On 01/11/2018 01:53 PM, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 15006
> Logged by: Sergey Burladyan
> Email address: eshkinkot@gmail.com
> PostgreSQL version: 10.1
> Operating system: Debian GNU/Linux 9 (stretch) in docker
> Description:
>
> I run tests in docker with current system user "user" and "make check" stop
> with error:
> ...
> updatable_views ... ok
> rolenames ... FAILED
> roleattributes ... ok
> ...
>
Hmmm ... I'm having this issue too (my distribution uses "user"
internally for the default user). Over time I managed to convince myself
it's not really a PostgreSQL bug, but rather a strange choice of OS user
name. And I've been simply ignoring this particular regression failure
on my laptop.
But maybe we could/should fix it anyway? Most regression tests switched
to roles prefixed with regress_* so why not to do the same here?
Of course, a particularly strange distribution could still pick a
conflicting OS name, but that seems rather unlikely, I guess.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
@ 2018-01-17 22:11 ` David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 11+ messages in thread
From: David G. Johnston @ 2018-01-17 22:11 UTC (permalink / raw)
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>; +Cc: eshkinkot@gmail.com, pgsql-bugs@lists.postgresql.org, PG Bug reporting form <noreply@postgresql.org>
On Wed, Jan 17, 2018 at 2:58 PM, Tomas Vondra <tomas.vondra@2ndquadrant.com>
wrote:
>
> On 01/11/2018 01:53 PM, PG Bug reporting form wrote:
> > The following bug has been logged on the website:
> >
> > Bug reference: 15006
> > Logged by: Sergey Burladyan
> > Email address: eshkinkot@gmail.com
> > PostgreSQL version: 10.1
> > Operating system: Debian GNU/Linux 9 (stretch) in docker
> > Description:
> >
> > I run tests in docker with current system user "user" and "make check"
> stop
> > with error:
> > ...
> > updatable_views ... ok
> > rolenames ... FAILED
> > roleattributes ... ok
> > ...
> >
>
> But maybe we could/should fix it anyway? Most regression tests switched
> to roles prefixed with regress_* so why not to do the same here?
>
>
The point of the test seems to be to ensure that the special system
keywords, when quoted, are allowed to be used for role names. So the
choice is to make the test conditional (if the role previously exists
neither create or drop it - and since it existed it doesn't seem like its a
problem to create it anyway) or to simply not bother testing "user"
figuring that the other two roles suffice for testing this behavior.
Changing it to a unlikely-to-conflict name doesn't help since that, I'd
presume, is already being covered by some either sequence of statements.
If these tests can use pl/pgsql and DO-blocks the conditional execution of
this one should be straight-forward to incorporate...
David J.
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
@ 2018-01-18 00:21 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 01:35 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Tom Lane @ 2018-01-18 00:21 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>; eshkinkot@gmail.com; pgsql-bugs@lists.postgresql.org
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wed, Jan 17, 2018 at 2:58 PM, Tomas Vondra <tomas.vondra@2ndquadrant.com>
> wrote:
>> But maybe we could/should fix it anyway? Most regression tests switched
>> to roles prefixed with regress_* so why not to do the same here?
> The point of the test seems to be to ensure that the special system
> keywords, when quoted, are allowed to be used for role names.
Exactly. Changing the names ruins the point of the test.
> So the
> choice is to make the test conditional (if the role previously exists
> neither create or drop it - and since it existed it doesn't seem like its a
> problem to create it anyway) or to simply not bother testing "user"
> figuring that the other two roles suffice for testing this behavior.
I wouldn't have a big problem with just dropping this whole test stanza.
It's an out-and-out violation of our rule against not creating rolenames
not starting with "regress_", and it's not testing anything that seems
especially likely to break.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-18 01:35 ` Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:15 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2018-01-18 01:35 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Tomas Vondra <tomas.vondra@2ndquadrant.com>; eshkinkot@gmail.com; pgsql-bugs@lists.postgresql.org
On Wed, Jan 17, 2018 at 07:21:03PM -0500, Tom Lane wrote:
> I wouldn't have a big problem with just dropping this whole test stanza.
> It's an out-and-out violation of our rule against not creating rolenames
> not starting with "regress_", and it's not testing anything that seems
> especially likely to break.
Perhaps a stupid question. What's the point behind the logic to forbid a
double-quoted "public" but to authorize a double-quoted "user"? The
whole thing looks inconsistent to me.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 01:35 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
@ 2018-01-18 02:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 02:27 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 11+ messages in thread
From: Tom Lane @ 2018-01-18 02:15 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Tomas Vondra <tomas.vondra@2ndquadrant.com>; eshkinkot@gmail.com; pgsql-bugs@lists.postgresql.org
Michael Paquier <michael.paquier@gmail.com> writes:
> Perhaps a stupid question. What's the point behind the logic to forbid a
> double-quoted "public" but to authorize a double-quoted "user"? The
> whole thing looks inconsistent to me.
Good question. There may be some backwards-compatibility considerations
here, but still this is just plain inconsistent:
regression=# create user public;
ERROR: role name "public" is reserved
LINE 1: create user public;
^
regression=# create user "public";
ERROR: role name "public" is reserved
LINE 1: create user "public";
^
regression=# create user user;
ERROR: syntax error at or near "user"
LINE 1: create user user;
^
regression=# create user "user";
CREATE ROLE
regression=# create user current_user;
ERROR: CURRENT_USER cannot be used as a role name here
LINE 1: create user current_user;
^
regression=# create user "current_user";
CREATE ROLE
I can see the point of disallowing a user named "public", because
otherwise syntax like GRANT some-privilege TO PUBLIC is just a trap
for the unwary DBA, one that could have bad security consequences.
But it's not clear to me why the same logic doesn't apply to "user",
"current_user", or "session_user", all of which are equally conflatable
with a built-in meaning in some security-relevant contexts.
BTW, you might think that those wildly different phrasings of essentially
the same error come from different places in the code, but no, they are
from adjacent lines in gram.y. WTF? This seems to be deliberately
anti-consistent.
And, to return to the original scenario, if you do
initdb -U public
it goes through just fine ... so our defenses against having such a
username have a hole in them.
Probably the OP would not be very happy if the outcome of this discussion
is that "initdb -U user" fails, but I am not seeing a principled reason
why that should be allowed.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 01:35 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:15 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-18 02:27 ` Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:51 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 11+ messages in thread
From: Michael Paquier @ 2018-01-18 02:27 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Tomas Vondra <tomas.vondra@2ndquadrant.com>; eshkinkot@gmail.com; pgsql-bugs@lists.postgresql.org
On Wed, Jan 17, 2018 at 09:15:06PM -0500, Tom Lane wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
>> Perhaps a stupid question. What's the point behind the logic to forbid a
>> double-quoted "public" but to authorize a double-quoted "user"? The
>> whole thing looks inconsistent to me.
>
> Good question. There may be some backwards-compatibility considerations
> here, but still this is just plain inconsistent:
>
> <snip>
>
> I can see the point of disallowing a user named "public", because
> otherwise syntax like GRANT some-privilege TO PUBLIC is just a trap
> for the unwary DBA, one that could have bad security consequences.
> But it's not clear to me why the same logic doesn't apply to "user",
> "current_user", or "session_user", all of which are equally conflatable
> with a built-in meaning in some security-relevant contexts.
Just forgot to mention that double-quoted user names with upper-case
characters are similarly allowed should still be allowed, like:
=# CREATE ROLE "Public";
CREATE ROLE
=# CREATE ROLE "pG_as";
CREATE ROLE
So those are correctly handled now.
Worth noting also this bit (from IsReservedName), which looks correct to
me:
=# CREATE ROLE "pg_aB";
ERROR: 42939: role name "pg_aB" is reserved
DETAIL: Role names starting with "pg_" are reserved.
> BTW, you might think that those wildly different phrasings of essentially
> the same error come from different places in the code, but no, they are
> from adjacent lines in gram.y. WTF? This seems to be deliberately
> anti-consistent.
Same reaction here :)
I would have expected all the checks to be in user.c and at parsing
level.
> Probably the OP would not be very happy if the outcome of this discussion
> is that "initdb -U user" fails, but I am not seeing a principled reason
> why that should be allowed.
Me neither.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 01:35 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:15 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 02:27 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
@ 2018-01-18 02:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 16:39 ` Re: BUG #15006: "make check" error if current user is "user" Joe Conway <mail@joeconway.com>
2018-01-18 18:58 ` Re: BUG #15006: "make check" error if current user is "user" Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 2 replies; 11+ messages in thread
From: Tom Lane @ 2018-01-18 02:51 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Tomas Vondra <tomas.vondra@2ndquadrant.com>; eshkinkot@gmail.com; pgsql-bugs@lists.postgresql.org
Michael Paquier <michael.paquier@gmail.com> writes:
> On Wed, Jan 17, 2018 at 09:15:06PM -0500, Tom Lane wrote:
>> Probably the OP would not be very happy if the outcome of this discussion
>> is that "initdb -U user" fails, but I am not seeing a principled reason
>> why that should be allowed.
> Me neither.
Alternatively, we could consider removing all these artificial
restrictions on what a username can be, and just expecting the DBA
to know what he's doing. But what we've got right now is weirdly
inconsistent.
regards, tom lane
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 01:35 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:15 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 02:27 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:51 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-18 16:39 ` Joe Conway <mail@joeconway.com>
1 sibling, 0 replies; 11+ messages in thread
From: Joe Conway @ 2018-01-18 16:39 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael.paquier@gmail.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Tomas Vondra <tomas.vondra@2ndquadrant.com>; eshkinkot@gmail.com; pgsql-bugs@lists.postgresql.org
On 01/17/2018 06:51 PM, Tom Lane wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
>> On Wed, Jan 17, 2018 at 09:15:06PM -0500, Tom Lane wrote:
>>> Probably the OP would not be very happy if the outcome of this discussion
>>> is that "initdb -U user" fails, but I am not seeing a principled reason
>>> why that should be allowed.
>
>> Me neither.
>
> Alternatively, we could consider removing all these artificial
> restrictions on what a username can be, and just expecting the DBA
> to know what he's doing. But what we've got right now is weirdly
> inconsistent.
+1
Joe
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
Attachments:
signature.asc (application/pgp-signature, 818B) download
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` Re: BUG #15006: "make check" error if current user is "user" David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 01:35 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:15 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 02:27 ` Re: BUG #15006: "make check" error if current user is "user" Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:51 ` Re: BUG #15006: "make check" error if current user is "user" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-01-18 18:58 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
1 sibling, 0 replies; 11+ messages in thread
From: Alvaro Herrera @ 2018-01-18 18:58 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Michael Paquier <michael.paquier@gmail.com>; David G. Johnston <david.g.johnston@gmail.com>; Tomas Vondra <tomas.vondra@2ndquadrant.com>; eshkinkot@gmail.com; pgsql-bugs@lists.postgresql.org
Tom Lane wrote:
> Michael Paquier <michael.paquier@gmail.com> writes:
> > On Wed, Jan 17, 2018 at 09:15:06PM -0500, Tom Lane wrote:
> >> Probably the OP would not be very happy if the outcome of this discussion
> >> is that "initdb -U user" fails, but I am not seeing a principled reason
> >> why that should be allowed.
>
> > Me neither.
>
> Alternatively, we could consider removing all these artificial
> restrictions on what a username can be, and just expecting the DBA
> to know what he's doing. But what we've got right now is weirdly
> inconsistent.
Have at it.
This all comes from
https://www.postgresql.org/message-id/20141010.172740.88258644.horiguchi.kyotaro@lab.ntt.co.jp
which ended up as commit 31eae6028eca4365e7165f5f33fee1ed0486aee0 (with
a couple of fixups afterwards).
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 11+ messages in thread
* Re: BUG #15006: "make check" error if current user is "user"
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Re: BUG #15006: "make check" error if current user is "user" Tomas Vondra <tomas.vondra@2ndquadrant.com>
@ 2018-01-19 14:18 ` Sergey Burladyan <eshkinkot@gmail.com>
1 sibling, 0 replies; 11+ messages in thread
From: Sergey Burladyan @ 2018-01-19 14:18 UTC (permalink / raw)
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>; +Cc: pgsql-bugs@lists.postgresql.org
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> Of course, a particularly strange distribution could still pick a
> conflicting OS name, but that seems rather unlikely, I guess.
Why the tests depend and use current OS user name? I think it's not very
good (if you does not test exactly that, of course).
If you enforce user name for temporary initdb cluster and use this
name for connection in tests, then you does not depends on OS name at
all, something like this (see attachment).
With this patch "make check-world" run successfully with OS name "user"
and "current_user".
--
Sergey Burladyan
Attachments:
force-postgres.patch (text/x-patch, 2.1K) download
diff -urN old/postgresql-10.1/src/bin/pg_upgrade/test.sh new/postgresql-10.1/src/bin/pg_upgrade/test.sh
--- old/postgresql-10.1/src/bin/pg_upgrade/test.sh 2017-11-07 00:46:52.000000000 +0000
+++ new/postgresql-10.1/src/bin/pg_upgrade/test.sh 2018-01-12 18:50:04.038190911 +0000
@@ -20,7 +20,7 @@
# Run a given "initdb" binary and overlay the regression testing
# authentication configuration.
standard_initdb() {
- "$1" -N
+ "$1" -U postgres -N
if [ -n "$TEMP_CONFIG" -a -r "$TEMP_CONFIG" ]
then
cat "$TEMP_CONFIG" >> "$PGDATA/postgresql.conf"
@@ -153,6 +153,9 @@
# enable echo so the user can see what is being executed
set -x
+PGUSER=postgres
+export PGUSER
+
standard_initdb "$oldbindir"/initdb
"$oldbindir"/pg_ctl start -l "$logdir/postmaster1.log" -o "$POSTMASTER_OPTS" -w
@@ -252,6 +255,8 @@
*) sh ./delete_old_cluster.sh ;;
esac
+unset PGUSER
+
if diff "$temp_root"/dump1.sql "$temp_root"/dump2.sql >/dev/null; then
echo PASSED
exit 0
diff -urN old/postgresql-10.1/src/test/regress/pg_regress.c new/postgresql-10.1/src/test/regress/pg_regress.c
--- old/postgresql-10.1/src/test/regress/pg_regress.c 2017-11-07 00:46:52.000000000 +0000
+++ new/postgresql-10.1/src/test/regress/pg_regress.c 2018-01-12 18:03:56.732603484 +0000
@@ -829,6 +829,9 @@
sprintf(s, "%d", port);
doputenv("PGPORT", s);
}
+
+ /* use user "postgres" for temp instance */
+ doputenv("PGUSER", "postgres");
}
else
{
@@ -2246,7 +2249,7 @@
/* initdb */
header(_("initializing database system"));
snprintf(buf, sizeof(buf),
- "\"%s%sinitdb\" -D \"%s/data\" --no-clean --no-sync%s%s > \"%s/log/initdb.log\" 2>&1",
+ "\"%s%sinitdb\" -D \"%s/data\" -U postgres --no-clean --no-sync%s%s > \"%s/log/initdb.log\" 2>&1",
bindir ? bindir : "",
bindir ? "/" : "",
temp_instance,
@@ -2317,7 +2320,7 @@
* Check if there is a postmaster running already.
*/
snprintf(buf2, sizeof(buf2),
- "\"%s%spsql\" -X postgres <%s 2>%s",
+ "\"%s%spsql\" -X -U postgres <%s 2>%s",
bindir ? bindir : "",
bindir ? "/" : "",
DEVNULL, DEVNULL);
^ permalink raw reply [nested|flat] 11+ messages in thread
end of thread, other threads:[~2018-01-19 14:18 UTC | newest]
Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-01-11 12:53 BUG #15006: "make check" error if current user is "user" PG Bug reporting form <noreply@postgresql.org>
2018-01-17 21:58 ` Tomas Vondra <tomas.vondra@2ndquadrant.com>
2018-01-17 22:11 ` David G. Johnston <david.g.johnston@gmail.com>
2018-01-18 00:21 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 01:35 ` Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:15 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 02:27 ` Michael Paquier <michael.paquier@gmail.com>
2018-01-18 02:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-01-18 16:39 ` Joe Conway <mail@joeconway.com>
2018-01-18 18:58 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-01-19 14:18 ` Sergey Burladyan <eshkinkot@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox