Bug 156662

Summary: databases/postgresql90-server install fails due to misuse of PGUSER environment variable
Product: Ports & Packages Reporter: Mark Stosberg <mark>
Component: Individual Port(s)Assignee: Palle Girgensohn <girgen>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Mark Stosberg 2011-04-26 17:00:21 UTC
I have done multiple point upgrades of the PostgreSQL 9.0.x port series, but the latest one failed inbetween "make deinstall" and "make reinstall", creating some downtime. Fortunately, it was a dev machine.

The issue is that the "PGUSER" environment variable (and perhaps others) are being mis-used. 

Variables like this are documented by PostgreSQL to be "default connection parameters". However, the
installation process assumes that if they are defined, they are the values used for the "pgsql super-user".

For anyone who has these set for a different default connection, the installation will fail with a cryptic error, shown
below.

Fix: 

The recommended solution is to use a new, specific environment variable for defining a custom "psql super-user" value for those who wish to set one.
How-To-Repeat: You can see the issue in this "screenshot". Notice the last line, which refers to attempting to add a "dev_limited" user, which should not be involved in the process at all.

root@dev# make reinstall
===>  Installing for postgresql-server-9.0.4_1
===>   postgresql-server-9.0.4_1 depends on shared library: pq.5 - found
===>   Generating temporary packing list
===>  Checking if databases/postgresql90-server already installed


  =========== BACKUP YOUR DATA! =============
  As always, backup your data before
  upgrading. If the upgrade leads to a higher
  minor revision (e.g. 7.3.x -> 7.4), a dump
  and restore of all databases is
  required. This is *NOT* done by the port!

  Press ctrl-C *now* if you need to pg_dump.
  ===========================================

pgsql:*:70:
You already have a group "pgsql", so I will use it.
pw: uid `70' has already been allocated
Adding user "dev_limited" failed...
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-04-26 21:11:02 UTC
Responsible Changed
From-To: freebsd-ports-bugs->girgen

Fix synopsis and assign.
Comment 2 dfilter service freebsd_committer freebsd_triage 2011-04-27 14:29:00 UTC
girgen      2011-04-27 13:28:51 UTC

  FreeBSD ports repository

  Modified files:
    databases/postgresql90-server Makefile 
    databases/postgresql84-server Makefile 
  Added files:
    databases/postgresql90-server/files pkg-install-server 
    databases/postgresql84-server/files pkg-install-server 
  Removed files:
    databases/postgresql90-server/files pkg-install-server.in 
    databases/postgresql84-server/files pkg-install-server.in 
  Log:
  Fix problem creating postgres user when PGUSER was set.
  
  PR: 156662
  
  Revision  Changes    Path
  1.222     +6 -4      ports/databases/postgresql84-server/Makefile
  1.1       +61 -0     ports/databases/postgresql84-server/files/pkg-install-server (new)
  1.2       +0 -66     ports/databases/postgresql84-server/files/pkg-install-server.in (dead)
  1.217     +6 -4      ports/databases/postgresql90-server/Makefile
  1.1       +61 -0     ports/databases/postgresql90-server/files/pkg-install-server (new)
  1.2       +0 -66     ports/databases/postgresql90-server/files/pkg-install-server.in (dead)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Palle Girgensohn freebsd_committer freebsd_triage 2011-04-27 14:29:13 UTC
State Changed
From-To: open->closed

Fix committed. Thanks for the heads up!