Re: [pgsql-hackers-win32] Other Win32 TODO items? - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [pgsql-hackers-win32] Other Win32 TODO items?
Date
Msg-id 200311110353.hAB3r9U11519@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Claudio Natoli wrote:
> * stat() + extension differences
>     - execute bits returned by stat are based on file extension under
> Win32
>     - therefore, binaries'll need to have .exe extension (ie. no symlink
> for postmaster), and the calls to stat'll have to append ".exe".

OK, the attached, applied patch takes care of these issues.

--
  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
Index: src/backend/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/Makefile,v
retrieving revision 1.95
diff -c -c -r1.95 Makefile
*** src/backend/Makefile    21 Mar 2003 17:18:34 -0000    1.95
--- src/backend/Makefile    11 Nov 2003 03:46:20 -0000
***************
*** 138,145 ****

  install-bin: postgres $(POSTGRES_IMP) installdirs
      $(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
!     @rm -f $(DESTDIR)$(bindir)/postmaster
!     ln -s postgres$(X) $(DESTDIR)$(bindir)/postmaster
  ifeq ($(MAKE_EXPORTS), true)
      $(INSTALL_DATA) $(POSTGRES_IMP) $(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)
  endif
--- 138,149 ----

  install-bin: postgres $(POSTGRES_IMP) installdirs
      $(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
! ifneq ($(PORTNAME), win32)
!     @rm -f $(DESTDIR)$(bindir)/postmaster$(X)
!     ln -s postgres$(X) $(DESTDIR)$(bindir)/postmaster$(X)
! else
!     $(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postmaster$(X)
! endif
  ifeq ($(MAKE_EXPORTS), true)
      $(INSTALL_DATA) $(POSTGRES_IMP) $(DESTDIR)$(pkglibdir)/$(POSTGRES_IMP)
  endif
Index: src/backend/utils/init/findbe.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/utils/init/findbe.c,v
retrieving revision 1.37
diff -c -c -r1.37 findbe.c
*** src/backend/utils/init/findbe.c    4 Aug 2003 02:40:06 -0000    1.37
--- src/backend/utils/init/findbe.c    11 Nov 2003 03:46:21 -0000
***************
*** 49,59 ****
--- 49,70 ----
      uid_t        euid;
      struct group *gp;
      struct passwd *pwp;
+     char        path_exe[MAXPGPATH + 2 + strlen(".exe")];
  #endif
      int            i;
      int            is_r = 0;
      int            is_x = 0;
      int            in_grp = 0;
+
+ #ifdef WIN32
+     /* Win32 requires a .exe suffix for stat() */
+     if (strlen(path) >= 4 && strcmp(path + strlen(path) - strlen(".exe"), ".exe") != 0)
+     {
+         strcpy(path_exe, path);
+         strcat(path_exe, ".exe");
+         path = path_exe;
+     }
+ #endif

      /*
       * Ensure that the file exists and is a regular file.

pgsql-patches by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: "make check" improvement for cygwin
Next
From: Bruce Momjian
Date:
Subject: Re: sigpipe handling