Bug #741: postgresql and cygwin

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #741: postgresql and cygwin
Date: 2002-08-22 07:19:10
Message-ID: 20020822071910.DDA12475BA6@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Przemyslaw Sztoch (psztoch(at)interia(dot)pl) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
postgresql and cygwin

Long Description
1. If you use "-boot" then argv[0] in BootstrapMain is equal "-boot", but should be equal e.g. "/pgsql/postmaster".
2. Under cygwin symlink support is strange. It will be very nice to don't use it. I propose add "-master" parametr to "postgres.exe" (like -boot).
"postmaster.exe -D /data" -> "postgres.exe -master -D /data"
3.Postmaster and postgres are both in one folder. And under MS-Windows we wouldn't have "postmaster", and only "postgres -master".
In this case we have to repair postmaster.c.

TIA for answer.

Sample Code
--- main-orig.c 2001-11-05 17:46:26.000000000 +0100
+++ main.c 2002-08-21 17:33:12.000000000 +0200
@@ -192,6 +192,13 @@
setlocale(LC_MONETARY, "");
#endif

+ if (argc > 1 && strcmp(new_argv[1], "-master") == 0) {
+ free(new_argv[1]);
+ new_argv[1] = new_argv[0];
+ new_argv[0] = NULL;
+ exit(PostmasterMain(argc - 1, new_argv + 1));
+ }
+
/*
* Now dispatch to one of PostmasterMain, PostgresMain, or
* BootstrapMain depending on the program name (and possibly first
@@ -200,7 +207,8 @@
*/
len = strlen(new_argv[0]);

- if (len >= 10 && strcmp(new_argv[0] + len - 10, "postmaster") == 0)
+ if (len >= 10 && strcmp(new_argv[0] + len - 10, "postmaster") == 0 ||
+ len >= 14 && strcmp(new_argv[0] + len - 14, "postmaster.exe") == 0)
{
/* Called as "postmaster" */
exit(PostmasterMain(argc, new_argv));
@@ -210,8 +218,12 @@
* If the first argument is "-boot", then invoke bootstrap mode. Note
* we remove "-boot" from the arguments passed on to BootstrapMain.
*/
- if (argc > 1 && strcmp(new_argv[1], "-boot") == 0)
- exit(BootstrapMain(argc - 1, new_argv + 1));
+ if (argc > 1 && strcmp(new_argv[1], "-boot") == 0) {
+ free(new_argv[1]);
+ new_argv[1] = new_argv[0];
+ new_argv[0] = NULL;
+ exit(BootstrapMain(argc - 1, new_argv + 1));
+ }

/*
* Otherwise we're a standalone backend. Invoke PostgresMain,

--- postmaster-orig.c 2002-03-15 19:20:48.000000000 +0100
+++ postmaster.c 2002-08-21 17:40:50.000000000 +0200
@@ -2653,7 +2653,9 @@
FILE *fp;
unsigned i;

- if (FindExec(fullprogname, argv[0], "postmaster") < 0)
+ if (FindExec(fullprogname, argv[0], "postgres") < 0)
return false;

filename = palloc(strlen(DataDir) + 20);

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Sean Chittenden 2002-08-22 07:30:59 Re: [GENERAL] Default values, inserts, and rules...
Previous Message Tom Lane 2002-08-22 05:28:57 Re: Default values, inserts, and rules...