Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 394159 - dev-db/postgresql-server-8.2 (and others?) init script does not work with PG_EXTRA_ENV
Summary: dev-db/postgresql-server-8.2 (and others?) init script does not work with PG_...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2011-12-09 16:29 UTC by Ian Stakenvicius (RETIRED)
Modified: 2011-12-25 16:41 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Stakenvicius (RETIRED) gentoo-dev 2011-12-09 16:29:55 UTC
If one sets PG_EXTRA_ENV in /etc/conf.d/postgresql-8.2 , then the init script fails due to the fact that the argument passed to start-stop-server (which is:
--env "PGPORT=${whatever} ${PG_EXTRA_ENV}"
) expects everything after the = to be assigned to PGPORT.  The options specified in PG_EXTRA_ENV need to be split up and each have their own individual --env parameter.

The following adjustment will work:

--- /etc/init.d/postgresql-8.2.old
+++ /etc/init.d/postgresql-8.2
@@ -85,10 +85,12 @@
     rm -f ${DATA_DIR}/postmaster.pid

     local retval
+     local pgenvopts=$(echo $PG_EXTRA_ENV |sed -e 's/\([A-Z][^=]*\)=/--env \1=/g')

     start-stop-daemon --start \
          --user postgres \
          --exec /usr/lib/postgresql-8.2/bin/postgres \
-         --env "PGPORT=${configured_port} ${PG_EXTRA_ENV}" \
+         --env PGPORT=${configured_port} \
+         ${pgenvopts} \
          --wait $((${START_TIMEOUT}*1000)) \
          --pidfile ${DATA_DIR}/postmaster.pid \


Reproducible: Always
Comment 1 Aaron W. Swenson gentoo-dev 2011-12-25 16:41:37 UTC
Seems to me a for loop does the same thing with less work.

  25 Dec 2011; Aaron W. Swenson <titanofold@gentoo.org>
  +postgresql-server-8.2.23-r1.ebuild, +postgresql-server-8.3.17-r1.ebuild,
  +postgresql-server-8.4.10-r1.ebuild, +postgresql-server-9.0.6-r1.ebuild,
  +postgresql-server-9.1.2-r2.ebuild:
  Fixes bugs 395263, 394389, and 394159