pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergey Burladyan <eshkinkot@gmail.com>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15006: "make check" error if current user is "user"
Date: Fri, 19 Jan 2018 17:18:43 +0300
Message-ID: <87fu7253uk.fsf@gmail.com> (raw)
In-Reply-To: <d67a0d73-fbc4-f0b3-a5fd-eb1fcb42b555@2ndquadrant.com>
References: <20180111125319.1423.23692@wrigleys.postgresql.org>
	<d67a0d73-fbc4-f0b3-a5fd-eb1fcb42b555@2ndquadrant.com>

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);

view thread (11+ messages)

Message-ID: <87fu7253uk.fsf@gmail.com>
Permalink:  ../87fu7253uk.fsf@gmail.com/
Also on:    postgresql.org/message-id/87fu7253uk.fsf@gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: eshkinkot@gmail.com, tomas.vondra@2ndquadrant.com
  Subject: Re: BUG #15006: "make check" error if current user is "user"
  In-Reply-To: <87fu7253uk.fsf@gmail.com>
  References: <20180111125319.1423.23692@wrigleys.postgresql.org> <d67a0d73-fbc4-f0b3-a5fd-eb1fcb42b555@2ndquadrant.com> <87fu7253uk.fsf@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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