pg_ctl restart just appends to command line instead of regenerating original cmd

Started by PostgreSQL Bugs Listalmost 25 years ago4 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
pg_ctl restart just appends to command line instead of regenerating original cmd

Long Description
I see in the mailing lists that there was activity around the pg_ctl restart function in April. I wondered if there had been or was going to be some action taken, and if so, if those involved were aware that subsequent restarts keep adding to the command line (rather than re-executing it exactly). For example, if the command at start is:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data'

Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

And so it continues with each subsequent restart.

Sample Code

No file was uploaded with this report

#2Bruce Momjian
bruce@momjian.us
In reply to: PostgreSQL Bugs List (#1)
Re: pg_ctl restart just appends to command line instead of regenerating original cmd

I can confirm that problem exists in the current CVS sources.

Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
pg_ctl restart just appends to command line instead of regenerating original cmd

Long Description
I see in the mailing lists that there was activity around the pg_ctl restart function in April. I wondered if there had been or was going to be some action taken, and if so, if those involved were aware that subsequent restarts keep adding to the command line (rather than re-executing it exactly). For example, if the command at start is:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data'

Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

And so it continues with each subsequent restart.

Sample Code

No file was uploaded with this report

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Peter Eisentraut
peter_e@gmx.net
In reply to: PostgreSQL Bugs List (#1)
Re: pg_ctl restart just appends to command line instead of regenerating original cmd

Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3

Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

Actually, only the -D option is repeated. The patch below might fix it,
but please check all the other start and restart modes, too (with/without
-o, especially).

--- pg_ctl.sh   Sat Apr 21 13:23:58 2001
+++ pg_ctl.sh.new       Wed Jun 20 17:03:07 2001
@@ -316,7 +316,7 @@
         eval set X "$POSTOPTS"; shift
     fi
-    set X -D "$PGDATA" ${1+"$@"}; shift
+    export PGDATA

if [ -n "$logfile" ]; then
"$po_path" "$@" </dev/null >>$logfile 2>&1 &

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#4Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#3)
Re: pg_ctl restart just appends to command line instead of regenerating original cmd

I have applied the following patch based on Peter's fix. The forced -D
in the old code clearly was error-prone. This should fix the reported
problem.

Patricia Holben (pholben@greatbridge.com) reports a bug with a severity of 3

Then when "pg_ctl restart" is executed, the "pg_ctl status" will display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

A subsequent "pg_ctl restart" causes the next "pg_ctl status" to display:
pg_ctl: postmaster is running (pid: 14635)
Command line was:
/usr/bin/postmaster '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data' '-D' '/var/lib/pgsql/data'

Actually, only the -D option is repeated. The patch below might fix it,
but please check all the other start and restart modes, too (with/without
-o, especially).

--- pg_ctl.sh   Sat Apr 21 13:23:58 2001
+++ pg_ctl.sh.new       Wed Jun 20 17:03:07 2001
@@ -316,7 +316,7 @@
eval set X "$POSTOPTS"; shift
fi
-    set X -D "$PGDATA" ${1+"$@"}; shift
+    export PGDATA

if [ -n "$logfile" ]; then
"$po_path" "$@" </dev/null >>$logfile 2>&1 &

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Attachments:

/bjm/difftext/plainDownload+3-3