Tom Lane wrote:
> Peter Eisentraut <[EMAIL PROTECTED]> writes:
> > Tom Lane wrote:
> >> We've mostly deprecated setting options on the postmaster command
> >> line already, so why do we need another obscure way to do that?
> 
> > As long as we support the pg_ctl -o option, the file still necessary so 
> > that 
> > you get the same options after a restart.
> 
> No, it's the "postmaster.opts.default" file that I'm complaining about,
> not the postmaster.opts file.

The attached applied patch removes the use of the
"postmaster.opts.default" file by pg_ctl.

-- 
  Bruce Momjian  <[EMAIL PROTECTED]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: doc/src/sgml/ref/pg_ctl-ref.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v
retrieving revision 1.45
diff -c -c -r1.45 pg_ctl-ref.sgml
*** doc/src/sgml/ref/pg_ctl-ref.sgml	23 Apr 2008 13:44:58 -0000	1.45
--- doc/src/sgml/ref/pg_ctl-ref.sgml	26 Jun 2008 01:04:44 -0000
***************
*** 406,425 ****
     </varlistentry>
  
     <varlistentry>
-     <term><filename>postmaster.opts.default</filename></term>
- 
-     <listitem>
-      <para>
-       If this file exists in the data directory,
-       <application>pg_ctl</application> (in <option>start</option>
-       mode) will pass the contents of the file as options to the
-       <command>postgres</command> command, unless overridden by the
-       <option>-o</option> option.
-      </para>
-     </listitem>
-    </varlistentry>
- 
-    <varlistentry>
      <term><filename>postmaster.opts</filename></term>
  
      <listitem>
--- 406,411 ----
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.98
diff -c -c -r1.98 pg_ctl.c
*** src/bin/pg_ctl/pg_ctl.c	24 Apr 2008 14:23:43 -0000	1.98
--- src/bin/pg_ctl/pg_ctl.c	26 Jun 2008 01:04:44 -0000
***************
*** 140,146 ****
  static bool test_postmaster_connection(bool);
  static bool postmaster_is_alive(pid_t pid);
  
- static char def_postopts_file[MAXPGPATH];
  static char postopts_file[MAXPGPATH];
  static char pid_file[MAXPGPATH];
  static char conf_file[MAXPGPATH];
--- 140,145 ----
***************
*** 575,616 ****
  static void
  read_post_opts(void)
  {
- 	char	   *optline = NULL;
- 
  	if (post_opts == NULL)
  	{
  		char	  **optlines;
- 		int			len;
  
! 		optlines = readfile(ctl_command == RESTART_COMMAND ?
! 							postopts_file : def_postopts_file);
! 		if (optlines == NULL)
  		{
! 			if (ctl_command == START_COMMAND || ctl_command == RUN_AS_SERVICE_COMMAND)
! 				post_opts = "";
! 			else
  			{
  				write_stderr(_("%s: could not read file \"%s\"\n"), progname, postopts_file);
  				exit(1);
  			}
! 		}
! 		else if (optlines[0] == NULL || optlines[1] != NULL)
! 		{
! 			write_stderr(_("%s: option file \"%s\" must have exactly one line\n"),
! 						 progname, ctl_command == RESTART_COMMAND ?
! 						 postopts_file : def_postopts_file);
! 			exit(1);
! 		}
! 		else
! 		{
! 			optline = optlines[0];
! 			len = strcspn(optline, "\r\n");
! 			optline[len] = '\0';
! 
! 			if (ctl_command == RESTART_COMMAND)
  			{
  				char	   *arg1;
  
  				arg1 = strchr(optline, *SYSTEMQUOTE);
  				if (arg1 == NULL || arg1 == optline)
  					post_opts = "";
--- 574,608 ----
  static void
  read_post_opts(void)
  {
  	if (post_opts == NULL)
  	{
  		char	  **optlines;
  
! 		post_opts = "";		/* defatult */
! 		if (ctl_command == RESTART_COMMAND)
  		{
! 			optlines = readfile(postopts_file);
! 			if (optlines == NULL)
  			{
  				write_stderr(_("%s: could not read file \"%s\"\n"), progname, postopts_file);
  				exit(1);
  			}
! 			else if (optlines[0] == NULL || optlines[1] != NULL)
  			{
+ 				write_stderr(_("%s: option file \"%s\" must have exactly one line\n"),
+ 							 progname, postopts_file);
+ 				exit(1);
+ 			}
+ 			else
+ 			{
+ 				int			len;
+ 				char	   *optline = NULL;
  				char	   *arg1;
  
+ 				optline = optlines[0];
+ 				len = strcspn(optline, "\r\n");
+ 				optline[len] = '\0';
+ 
  				arg1 = strchr(optline, *SYSTEMQUOTE);
  				if (arg1 == NULL || arg1 == optline)
  					post_opts = "";
***************
*** 622,629 ****
  				if (postgres_path != NULL)
  					postgres_path = optline;
  			}
- 			else
- 				post_opts = optline;
  		}
  	}
  }
--- 614,619 ----
***************
*** 1894,1900 ****
  
  	if (pg_data)
  	{
- 		snprintf(def_postopts_file, MAXPGPATH, "%s/postmaster.opts.default", pg_data);
  		snprintf(postopts_file, MAXPGPATH, "%s/postmaster.opts", pg_data);
  		snprintf(pid_file, MAXPGPATH, "%s/postmaster.pid", pg_data);
  		snprintf(conf_file, MAXPGPATH, "%s/postgresql.conf", pg_data);
--- 1884,1889 ----
-- 
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Reply via email to