Re: [PORTS] Port Bug Report: PostgreSQL misnames the UNIX-domain socket - Mailing list pgsql-ports

From Bruce Momjian
Subject Re: [PORTS] Port Bug Report: PostgreSQL misnames the UNIX-domain socket
Date
Msg-id 199907071716.NAA03350@candle.pha.pa.us
Whole thread Raw
In response to Port Bug Report: PostgreSQL misnames the UNIX-domain socket  (Unprivileged user <nobody>)
List pgsql-ports
> SParc Ultra 5 & Pentium 64MB RAM
> Linux blackcat 2.2.7 #2 Mon May 10 13:25:46 EST 1999 i586 unknown
>
>
> Versions of other tools:
> ------------------------
>
>
> --------------------------------------------------------------------------
>
> Problem Description:
> --------------------
> After building Postgres with a default port higher than 32768,
> we noticed that Postgres seems to misname the Unix domain socket.
> The TCP port is fine.

OK, we had some mixup with unsigned short in that area.  I now have:

    .s.PGSQL.40077=

Obviously, you can not do any port > 64k.  Here is a patch.  It will
appear in 6.5.1.

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@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
? doc/_xlk
? src/Makefile.custom
? src/config.log
? src/log
? src/config.cache
? src/config.status
? src/GNUmakefile
? src/Makefile.global
? src/backend/fmgr.h
? src/backend/parse.h
? src/backend/postgres
? src/backend/global1.bki.source
? src/backend/local1_template1.bki.source
? src/backend/global1.description
? src/backend/local1_template1.description
? src/backend/bootstrap/bootparse.c
? src/backend/bootstrap/bootstrap_tokens.h
? src/backend/bootstrap/bootscanner.c
? src/backend/catalog/genbki.sh
? src/backend/catalog/global1.bki.source
? src/backend/catalog/global1.description
? src/backend/catalog/local1_template1.bki.source
? src/backend/catalog/local1_template1.description
? src/backend/port/Makefile
? src/backend/utils/Gen_fmgrtab.sh
? src/backend/utils/fmgr.h
? src/backend/utils/fmgrtab.c
? src/bin/cleardbdir/cleardbdir
? src/bin/createdb/createdb
? src/bin/createlang/createlang
? src/bin/createuser/createuser
? src/bin/destroydb/destroydb
? src/bin/destroylang/destroylang
? src/bin/destroyuser/destroyuser
? src/bin/initdb/initdb
? src/bin/initlocation/initlocation
? src/bin/ipcclean/ipcclean
? src/bin/pg_dump/Makefile
? src/bin/pg_dump/pg_dump
? src/bin/pg_id/pg_id
? src/bin/pg_passwd/pg_passwd
? src/bin/pg_version/Makefile
? src/bin/pg_version/pg_version
? src/bin/pgtclsh/mkMakefile.tcldefs.sh
? src/bin/pgtclsh/mkMakefile.tkdefs.sh
? src/bin/pgtclsh/Makefile.tkdefs
? src/bin/pgtclsh/Makefile.tcldefs
? src/bin/pgtclsh/pgtclsh
? src/bin/pgtclsh/pgtksh
? src/bin/psql/Makefile
? src/bin/psql/psql
? src/include/version.h
? src/include/config.h
? src/interfaces/ecpg/lib/Makefile
? src/interfaces/ecpg/lib/libecpg.so.3.0.0
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/libpgtcl/Makefile
? src/interfaces/libpgtcl/libpgtcl.so.2.0
? src/interfaces/libpq/Makefile
? src/interfaces/libpq/libpq.so.2.0
? src/interfaces/libpq++/Makefile
? src/interfaces/libpq++/libpq++.so.3.0
? src/interfaces/odbc/GNUmakefile
? src/interfaces/odbc/Makefile.global
? src/lextest/lex.yy.c
? src/lextest/lextest
? src/pl/plpgsql/src/Makefile
? src/pl/plpgsql/src/mklang.sql
? src/pl/plpgsql/src/pl_gram.c
? src/pl/plpgsql/src/pl.tab.h
? src/pl/plpgsql/src/pl_scan.c
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/pl/tcl/mkMakefile.tcldefs.sh
? src/pl/tcl/Makefile.tcldefs
? src/template/linux_m68k
Index: doc/TODO
===================================================================
RCS file: /usr/local/cvsroot/pgsql/doc/TODO,v
retrieving revision 1.45
diff -c -r1.45 TODO
*** TODO    1999/07/07 09:11:12    1.45
--- TODO    1999/07/07 17:14:13
***************
*** 30,35 ****
--- 30,36 ----
  * Array index references without table name cause problems
  * Update table SET table.value = 3 fails
  * Creating index of timestamp fails
+ * SELECT foo UNION SELECT foo is incorrectly simplified to SELECT foo

  VIEWS

***************
*** 207,214 ****
    places, like GROUP BY, UNIQUE, index processing, etc.
  * improve dynamic memory allocation by introducing tuple-context memory
    allocation
! * add pooled memory allocation where allocations are freed only as a group
!

  SOURCE CODE
  -----------
--- 208,215 ----
    places, like GROUP BY, UNIQUE, index processing, etc.
  * improve dynamic memory allocation by introducing tuple-context memory
    allocation
! * fix indexscan() so it does leak memory by not requiring caller to free
! * fix memory leak in cache code when non-existant table is refer

  SOURCE CODE
  -----------
Index: src/backend/libpq/pqcomm.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/libpq/pqcomm.c,v
retrieving revision 1.72
diff -c -r1.72 pqcomm.c
*** pqcomm.c    1999/05/25 16:09:02    1.72
--- pqcomm.c    1999/07/07 17:14:29
***************
*** 181,187 ****
   */

  int
! StreamServerPort(char *hostName, short portName, int *fdP)
  {
      SockAddr    saddr;
      int            fd,
--- 181,187 ----
   */

  int
! StreamServerPort(char *hostName, unsigned short portName, int *fdP)
  {
      SockAddr    saddr;
      int            fd,
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/postmaster/postmaster.c,v
retrieving revision 1.107
diff -c -r1.107 postmaster.c
*** postmaster.c    1999/07/02 18:09:27    1.107
--- postmaster.c    1999/07/07 17:14:38
***************
*** 130,136 ****
  /* list of ports associated with still open, but incomplete connections */
  static Dllist *PortList;

! static short PostPortName = -1;
  static short ActiveBackends = FALSE;

   /*
--- 130,136 ----
  /* list of ports associated with still open, but incomplete connections */
  static Dllist *PortList;

! static unsigned short PostPortName = 0;
  static short ActiveBackends = FALSE;

   /*
***************
*** 240,246 ****
   */
  static void pmdaemonize(void);
  static Port *ConnCreate(int serverFd);
! static void reset_shared(short port);
  static void pmdie(SIGNAL_ARGS);
  static void reaper(SIGNAL_ARGS);
  static void dumpstatus(SIGNAL_ARGS);
--- 240,246 ----
   */
  static void pmdaemonize(void);
  static Port *ConnCreate(int serverFd);
! static void reset_shared(unsigned short port);
  static void pmdie(SIGNAL_ARGS);
  static void reaper(SIGNAL_ARGS);
  static void dumpstatus(SIGNAL_ARGS);
***************
*** 502,508 ****
                  break;
              case 'p':
                  /* Set PGPORT by hand. */
!                 PostPortName = (short) atoi(optarg);
                  break;
              case 'S':

--- 502,508 ----
                  break;
              case 'p':
                  /* Set PGPORT by hand. */
!                 PostPortName = (unsigned short) atoi(optarg);
                  break;
              case 'S':

***************
*** 534,541 ****
      /*
       * Select default values for switches where needed
       */
!     if (PostPortName == -1)
!         PostPortName = pq_getport();

      /*
       * Check for invalid combinations of switches
--- 534,541 ----
      /*
       * Select default values for switches where needed
       */
!     if (PostPortName == 0)
!         PostPortName = (unsigned short)pq_getport();

      /*
       * Check for invalid combinations of switches
***************
*** 1050,1056 ****
   * reset_shared -- reset shared memory and semaphores
   */
  static void
! reset_shared(short port)
  {
      ipc_key = port * 1000 + shmem_seq * 100;
      CreateSharedMemoryAndSemaphores(ipc_key, MaxBackends);
--- 1050,1056 ----
   * reset_shared -- reset shared memory and semaphores
   */
  static void
! reset_shared(unsigned short port)
  {
      ipc_key = port * 1000 + shmem_seq * 100;
      CreateSharedMemoryAndSemaphores(ipc_key, MaxBackends);
Index: src/include/libpq/libpq.h
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/include/libpq/libpq.h,v
retrieving revision 1.30
diff -c -r1.30 libpq.h
*** libpq.h    1999/05/25 22:42:50    1.30
--- libpq.h    1999/07/07 17:14:47
***************
*** 234,240 ****
  /*
   * prototypes for functions in pqcomm.c
   */
! extern int    StreamServerPort(char *hostName, short portName, int *fdP);
  extern int    StreamConnection(int server_fd, Port *port);
  extern void StreamClose(int sock);
  extern void pq_init(void);
--- 234,240 ----
  /*
   * prototypes for functions in pqcomm.c
   */
! extern int    StreamServerPort(char *hostName, unsigned short portName, int *fdP);
  extern int    StreamConnection(int server_fd, Port *port);
  extern void StreamClose(int sock);
  extern void pq_init(void);

pgsql-ports by date:

Previous
From: Unprivileged user
Date:
Subject: Port Bug Report: PostgreSQL misnames the UNIX-domain socket
Next
From: Unprivileged user
Date:
Subject: Port Bug Report: Unable to insert large strings into a text datatype.