Re: more dirmod CYGWIN - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: more dirmod CYGWIN
Date
Msg-id 200409101616.i8AGGeS04327@candle.pha.pa.us
Whole thread Raw
In response to Re: more dirmod CYGWIN  (Reini Urban <rurban@x-ray.at>)
Responses Re: more dirmod CYGWIN
List pgsql-hackers
I have applied all parts of your patch now.

---------------------------------------------------------------------------

Reini Urban wrote:
> Reini Urban schrieb:
> > [BTW: there's no need to cc all, I'm subscribed to most lists]
> > Reini Urban schrieb:
> >> Bruce Momjian schrieb:
> >>> Andrew Dunstan wrote:
> >>>> Reini Urban wrote:
> >>>>
> >>>>> FYI: WIN32 is also defined because <windows.h> is included.
> >>>>> (/usr/incluse/w32api/windef.h)
> >>>>> If you want this or that, do proper nesting, and use #else.
> >>>>
> >>>> Ugh, yes. A little experimentation shows that __WIN32__ is defined
> >>>> for MinGW only, but WIN32 is for both. I wonder how we missed that
> >>>> in various places. Maybe we need a little audit of the use of WIN32.
> >>>
> >>> OK, fixed.  We should not be using __WIN32__, just Win32.  The proper
> >>> test is #ifndef __CYGWIN__.
> >>
> >> very good. just think of future MSVC versions.
> >>
> >> Just one more glitch:
> >>
> >> #undef rename
> >> #undef unlink
> >>
> >> has to be defined before #include <unistd.h> on CYGWIN, because
> >> unistd.h has the declarations for rename and unlink, which are
> >> required inside the pg versions.
> >> without the #undef, the macros which rename rename to pgrename, ...
> >> are still effective, which will lead to undeclared/falsely
> >> autodeclared rename/unlink parts.
> >>
> >> I don't know for mingw, if they need the pgrename/pgunlink declaration.
> >> For my CYGWIN patch I moved those two lines before #include <unistd.h>.
> >
> >
> > FYI: latest cvs HEAD, without any patches.
> >
> > make runs now through with the expected implicit declaration warnings,
> > but without any errors. Esp. the CYGWIN-specific SHMLIB linking errors
> > are now gone. good!
> >
> > make[2]: Entering directory `/usr/src/postgresql/pgsql/src/port'
> > gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> > -Wmissing-declarations -I../../src/port -I../../src/include   -c -o
> > dirmod.o dirmod.c
> > dirmod.c: In Funktion >>pgunlink<<:
> > dirmod.c:113: Warnung: implicit declaration of function `unlink'
> > dirmod.c: In Funktion >>rmt_cleanup<<:
> > dirmod.c:267: Warnung: implicit declaration of function `pgport_pfree'
> > dirmod.c: In Funktion >>rmtree<<:
> > dirmod.c:318: Warnung: implicit declaration of function `pgport_palloc'
> > dirmod.c:318: Warnung: Zuweisung erzeugt Zeiger von Ganzzahl ohne
> > Typkonvertierung
> > dirmod.c:333: Warnung: implicit declaration of function `pgport_pstrdup'
> > dirmod.c:333: Warnung: Zuweisung erzeugt Zeiger von Ganzzahl ohne
> > Typkonvertierung
> >
> > make check hangs at:
> > "running on port 65432 with pid 2304
> > ============== creating database "regression"         ==============
> > CREATE DATABASE
> > ALTER DATABASE
> > ============== dropping regression test user accounts ==============
> > ============== installing PL/pgSQL                    ==============
> > ============== running regression test queries        ==============
> > parallel group (13 tests):  int2 int4 int8 float4 name varchar numeric"
> >
> > which means rename works ok. probably the false implicit declarations in
> > the memory code break it.
> >
> > I'll come with another patch later.
>
> parallel tests hang on cygwin. this is expected.
>
> attached is the postmaster stackdump on the parallel test (if you care),
> and the IPC's during the parallel test (not quite busy...):
> $ ipcs
> Message Queues:
> T     ID               KEY        MODE       OWNER    GROUP
>
> Shared Memory:
> T     ID               KEY        MODE       OWNER    GROUP
> m 1966080             65432001 --rw-------   rurban     root
>
> Semaphores:
> T     ID               KEY        MODE       OWNER    GROUP
> s 1966080             65432001 --rw-------   rurban     root
> s 1966081             65432002 --rw-------   rurban     root
> s 1966082             65432003 --rw-------   rurban     root
> s 1966083             65432004 --rw-------   rurban     root
> s 1966084             65432005 --rw-------   rurban     root
> s 1966085             65432006 --rw-------   rurban     root
> s 1966086             65432007 --rw-------   rurban     root
>
> with the serial schedule all tests but the last pass.
> test tablespace           ... FAILED
>
> This is the tail of the postmaster log for this failing test.
>
> ERROR:  cannot alter table "fullname" because column "people"."fn" uses
> its rowtype
> ERROR:  could not create symbolic link
> "/usr/src/postgresql/pgsql/src/test/regress/./tmp_check/data/pg_tblspc/155118":
> No error
> ERROR:  tablespace "testspace" does not exist
> ERROR:  schema "testschema" does not exist
> ERROR:  schema "testschema" does not exist
> ERROR:  schema "testschema" does not exist
> ERROR:  schema "testschema" does not exist
> ERROR:  could not set permissions on directory "/no/such/location": No
> such file or directory
> ERROR:  tablespace "nosuchspace" does not exist
> ERROR:  tablespace "testspace" does not exist
> ERROR:  schema "testschema" does not exist
> ERROR:  tablespace "testspace" does not exist
> LOG:  received smart shutdown request
> LOG:  shutting down
> LOG:  database system is shut down
>
> attached is the regression.diffs,
>
> and also the overall patch against current CVS HEAD I used for this run.
> (the move-#undef patch is probably already applied regarding bruce)
> this should be applied.
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/

> *** ./expected/tablespace.out    Fri Sep 10 13:42:08 2004
> --- ./results/tablespace.out    Fri Sep 10 13:53:22 2004
> ***************
> *** 1,34 ****
>   -- create a tablespace we can use
>   CREATE TABLESPACE testspace LOCATION '/usr/src/postgresql/pgsql/src/test/regress/testtablespace';
>   -- create a schema in the tablespace
>   CREATE SCHEMA testschema TABLESPACE testspace;
>   -- sanity check
>   SELECT nspname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_namespace n
>       where n.nsptablespace = t.oid and n.nspname = 'testschema';
>     nspname   |  spcname
> ! ------------+-----------
> !  testschema | testspace
> ! (1 row)
>
>   -- try a table
>   CREATE TABLE testschema.foo (i int);
>   SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
>       where c.reltablespace = t.oid AND c.relname = 'foo';
>    relname |  spcname
> ! ---------+-----------
> !  foo     | testspace
> ! (1 row)
>
>   INSERT INTO testschema.foo VALUES(1);
>   INSERT INTO testschema.foo VALUES(2);
>   -- index
>   CREATE INDEX foo_idx on testschema.foo(i);
>   SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
>       where c.reltablespace = t.oid AND c.relname = 'foo_idx';
>    relname |  spcname
> ! ---------+-----------
> !  foo_idx | testspace
> ! (1 row)
>
>   -- Will fail with bad path
>   CREATE TABLESPACE badspace LOCATION '/no/such/location';
> --- 1,37 ----
>   -- create a tablespace we can use
>   CREATE TABLESPACE testspace LOCATION '/usr/src/postgresql/pgsql/src/test/regress/testtablespace';
> + ERROR:  could not create symbolic link
"/usr/src/postgresql/pgsql/src/test/regress/./tmp_check/data/pg_tblspc/155118":No error 
>   -- create a schema in the tablespace
>   CREATE SCHEMA testschema TABLESPACE testspace;
> + ERROR:  tablespace "testspace" does not exist
>   -- sanity check
>   SELECT nspname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_namespace n
>       where n.nsptablespace = t.oid and n.nspname = 'testschema';
>    nspname | spcname
> ! ---------+---------
> ! (0 rows)
>
>   -- try a table
>   CREATE TABLE testschema.foo (i int);
> + ERROR:  schema "testschema" does not exist
>   SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
>       where c.reltablespace = t.oid AND c.relname = 'foo';
>    relname | spcname
> ! ---------+---------
> ! (0 rows)
>
>   INSERT INTO testschema.foo VALUES(1);
> + ERROR:  schema "testschema" does not exist
>   INSERT INTO testschema.foo VALUES(2);
> + ERROR:  schema "testschema" does not exist
>   -- index
>   CREATE INDEX foo_idx on testschema.foo(i);
> + ERROR:  schema "testschema" does not exist
>   SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
>       where c.reltablespace = t.oid AND c.relname = 'foo_idx';
>    relname | spcname
> ! ---------+---------
> ! (0 rows)
>
>   -- Will fail with bad path
>   CREATE TABLESPACE badspace LOCATION '/no/such/location';
> ***************
> *** 38,45 ****
>   ERROR:  tablespace "nosuchspace" does not exist
>   -- Fail, not empty
>   DROP TABLESPACE testspace;
> ! ERROR:  tablespace "testspace" is not empty
>   DROP SCHEMA testschema CASCADE;
> ! NOTICE:  drop cascades to table testschema.foo
>   -- Should succeed
>   DROP TABLESPACE testspace;
> --- 41,49 ----
>   ERROR:  tablespace "nosuchspace" does not exist
>   -- Fail, not empty
>   DROP TABLESPACE testspace;
> ! ERROR:  tablespace "testspace" does not exist
>   DROP SCHEMA testschema CASCADE;
> ! ERROR:  schema "testschema" does not exist
>   -- Should succeed
>   DROP TABLESPACE testspace;
> + ERROR:  tablespace "testspace" does not exist
>
> ======================================================================
>

> --- ./src/include/utils/palloc.h.orig    2004-08-29 05:13:11.000000000 +0100
> +++ ./src/include/utils/palloc.h    2004-09-10 13:33:04.587653100 +0100
> @@ -80,7 +80,7 @@
>
>  #define pstrdup(str)  MemoryContextStrdup(CurrentMemoryContext, (str))
>
> -#ifdef WIN32
> +#if defined(WIN32) || defined(__CYGWIN__)
>  extern void *pgport_palloc(Size sz);
>  extern char *pgport_pstrdup(const char *str);
>  extern void pgport_pfree(void *pointer);
> --- ./src/port/dirmod.c.orig    2004-09-10 10:29:36.500414700 +0100
> +++ ./src/port/dirmod.c    2004-09-10 13:33:53.790148300 +0100
> @@ -21,6 +21,9 @@
>  #include "postgres_fe.h"
>  #endif
>
> +#undef rename
> +#undef unlink
> +
>  #include <unistd.h>
>  #include <dirent.h>
>  #include <sys/stat.h>
> @@ -33,9 +36,6 @@
>
>  #include "miscadmin.h"
>
> -#undef rename
> -#undef unlink
> -
>  #ifndef __CYGWIN__
>  #include <winioctl.h>
>  #else

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly

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

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: APR 1.0 released
Next
From: Bruce Momjian
Date:
Subject: Re: row wise comparison broken