pgsql-server: Use strdup in pg_ctl for canonicalize_path on environment

Started by Bruce Momjianalmost 22 years ago5 messagescomitters
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Log Message:
-----------
Use strdup in pg_ctl for canonicalize_path on environment variable.
Simplify postmaster call too.

Modified Files:
--------------
pgsql-server/src/backend/postmaster:
postmaster.c (r1.409 -> r1.410)
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/postmaster/postmaster.c.diff?r1=1.409&r2=1.410)
pgsql-server/src/bin/pg_ctl:
pg_ctl.c (r1.18 -> r1.19)
(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/bin/pg_ctl/pg_ctl.c.diff?r1=1.18&r2=1.19)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: pgsql-server: Use strdup in pg_ctl for canonicalize_path on environment

momjian@svr1.postgresql.org (Bruce Momjian) writes:

Use strdup in pg_ctl for canonicalize_path on environment variable.
Simplify postmaster call too.

You're not doing very well with this project :-(. pg_ctl is now
actively broken, because the PGDATA value passed down to the
bootstrap backend is the one in the environment variable. The
previous coding canonicalized that, this does not.

I do not like the "simplified" postmaster.c coding either; it may
save one line but it is harder to understand.

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: pgsql-server: Use strdup in pg_ctl for canonicalize_path

Tom Lane wrote:

momjian@svr1.postgresql.org (Bruce Momjian) writes:

Use strdup in pg_ctl for canonicalize_path on environment variable.
Simplify postmaster call too.

You're not doing very well with this project :-(. pg_ctl is now
actively broken, because the PGDATA value passed down to the
bootstrap backend is the one in the environment variable. The
previous coding canonicalized that, this does not.

I didn't think we could modify the environment variables like that
portably. Also, it is not even needed because we now do the proper
canonicalization in the postmaster.

I do not like the "simplified" postmaster.c coding either; it may
save one line but it is harder to understand.

OK, reverted that part.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#3)
Re: pgsql-server: Use strdup in pg_ctl for canonicalize_path on environment

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Tom Lane wrote:

You're not doing very well with this project :-(. pg_ctl is now
actively broken, because the PGDATA value passed down to the
bootstrap backend is the one in the environment variable. The
previous coding canonicalized that, this does not.

I didn't think we could modify the environment variables like that
portably.

Possibly not, but if you think that then the correct response is to
re-assign the environment var using putenv().

regards, tom lane

#5Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#4)
Re: pgsql-server: Use strdup in pg_ctl for canonicalize_path

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Tom Lane wrote:

You're not doing very well with this project :-(. pg_ctl is now
actively broken, because the PGDATA value passed down to the
bootstrap backend is the one in the environment variable. The
previous coding canonicalized that, this does not.

I didn't think we could modify the environment variables like that
portably.

Possibly not, but if you think that then the correct response is to
re-assign the environment var using putenv().

Yea, but we clean up the variable on input to the backend anyway.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073