Обсуждение: Bug #741: postgresql and cygwin

Поиск
Список
Период
Сортировка

Bug #741: postgresql and cygwin

От
pgsql-bugs@postgresql.org
Дата:
Przemyslaw Sztoch (psztoch@interia.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

Re: Bug #741: postgresql and cygwin

От
Peter Eisentraut
Дата:
> Przemyslaw Sztoch (psztoch@interia.pl) reports a bug with a severity of 3

> 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.

Please explain specifically what your problem is.  What are you doing,
what is failing?  PostgreSQL on Cygwin works for a lot of users, including
myself, so you must be doing something out of the ordinary.

--
Peter Eisentraut   peter_e@gmx.net