Re: time_t timezone

Lists: pgsql-cygwinpgsql-patches
From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c, timezone/pgtz.c
Date: 2004-08-24 19:49:51
Message-ID: 412B9BDF.1010806@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: 503 토토 사이트 추천 pgsql-patches

Attached patches are required for cygwin:

2004-08-24 21:23:53 rurban(at)x-ray(dot)at
* (postmaster/syslogger.c) struct timeval is
declared in sys/time.h, not in time.h

2004-08-24 20:20:54 rurban:
* (port/dirmod.c) cygwin needs different header locations,
and unlink is a macro. There are no pgport_palloc
versions yet

timezone/pgtz.c:
Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
PGAC_VAR_INT_TIMEZONE

In the meantime I've hacked it with a cast from time_t to (int) in
timezone/pgtz.c: get_timezone_offset

but timezone really is of time_t, not int. I don't know what you are
trying to do here.

There's on remaining issue for the cygwin build:
../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
reference to `__imp__CurrentMemoryContext'
../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
reference to `__imp__CurrentMemoryContext'

which explains the pgport_palloc problem.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

Attachment Content-Type Size
postgresql-8.0.0beta1-dirmode.diff text/plain 809 bytes
postgresql-8.0.0beta1-timeval.diff text/plain 451 bytes
postgresql-8.0.0beta1-pgtz.diff text/plain 441 bytes

From: Jason Tishler <jason(at)tishler(dot)net>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c, timezone/pgtz.c
Date: 2004-08-24 20:24:50
Message-ID: 20040824202450.GA84212@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

On Tue, Aug 24, 2004 at 09:49:51PM +0200, Reini Urban wrote:
> There's on remaining issue for the cygwin build:
> ../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
> reference to `__imp__CurrentMemoryContext'
> ../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
> reference to `__imp__CurrentMemoryContext'

Note I have no experience with 8.0 so the following is a WAG...
The above is likely caused by not linking against an import library
(i.e., libpostgres.a).

HTH,
Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-cygwin(at)postgresql(dot)org
Cc: Jason Tishler <jason(at)tishler(dot)net>
Subject: Re: [PATCHES] cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-24 23:12:46
Message-ID: 412BCB6E.405@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Jason Tishler schrieb:
> On Tue, Aug 24, 2004 at 09:49:51PM +0200, Reini Urban wrote:
>>There's on remaining issue for the cygwin build:
>>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
>>reference to `__imp__CurrentMemoryContext'
>>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
>>reference to `__imp__CurrentMemoryContext'
>
>
> Note I have no experience with 8.0 so the following is a WAG...
> The above is likely caused by not linking against an import library
> (i.e., libpostgres.a).

Yes, it is defined in libpostgres.a. Hmm, a cross-dependency problem in
the Makefile. With an added -lpostgres postgres.exe builds fine.
But I'll try to add the single object file only where it is defined.

I also see that it is still linking against cygipc.
LIBS=-lintl -lssl -lcrypto -lz -lreadline -lcygipc -lcrypt -lresolv -lm

Do we still need this? As I see it, pgsql has its own ipc mechanism.
Without -lcygipc it also builds fine. ...

>I'm quite willing to help to ensure a smooth transition and to help
>minimize your "pain." :,) Maybe 8.0 can be a joint effort, with you
>taking over fully with 8.0.x or 8.1?

Sure, why not?
But I'm also trying to build the 7.4.5 now, because I want to see the
changes in the new 8 branch. So you can sit and have a rest. :)

From another thread...
> Is "--with-template=cygwin" required? It wasn't before.

Yes, this is apparently new for 8.x.
And it does help to be precise in the configure line.

BTW: I will convert your build.sh to the cygwin generic-build-script
system. This is much easier.

> Does "--with-tcl" no longer build cleanly?

This wasn't in your 7.4.3 build.sh included and I didn't install the
tcl/tk sources (only under my perltk tree). But I can have a try.

I have tclsh, the headers and the libs, just a tclConfig.sh script is
missing from the cygwin build. Should not be that hard. All the libs and
includes are at the standard paths.

I'll finish the 8.0.0-beta1 port to cygwin, and post to the patches list
then the cumulative patches. Questions to pgsql-hackers or pgsql-cygwin?

The 8.x build is almost okay now. Just a remaining libreadline issue in
src/bin/psql/tab-complete.c
And testing.

And sockets would also be fine.
$ postgresql-8.0.0beta1-1/src/backend/postgres.exe
FATAL: unrecognized configuration parameter "tcpip_socket"
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Jason Tishler <jason(at)tishler(dot)net>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [PATCHES] cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c, timezone/pgtz.c
Date: 2004-08-25 12:05:44
Message-ID: 20040825120544.GE84948@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini,

On Wed, Aug 25, 2004 at 01:12:46AM +0200, Reini Urban wrote:
> Jason Tishler schrieb:
> >On Tue, Aug 24, 2004 at 09:49:51PM +0200, Reini Urban wrote:
> >>There's on remaining issue for the cygwin build:
> >>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
> >>reference to `__imp__CurrentMemoryContext'
> >>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
> >>reference to `__imp__CurrentMemoryContext'
> >
> >Note I have no experience with 8.0 so the following is a WAG...
> >The above is likely caused by not linking against an import library
> >(i.e., libpostgres.a).
>
> Yes, it is defined in libpostgres.a. Hmm, a cross-dependency problem in
> the Makefile. With an added -lpostgres postgres.exe builds fine.

In previous versions, postgres.exe built fine without -lpostgres. Other
components needed to link with libpostgres.a -- not postgres.exe. As
you indicated above, seems like there is a cross-dependency issue
introduced in 8.0.

> But I'll try to add the single object file only where it is defined.

IMO, linking against libpostgres.a is preferable assuming the
cross-dependency issue cannot be solved.

> I also see that it is still linking against cygipc.
> LIBS=-lintl -lssl -lcrypto -lz -lreadline -lcygipc -lcrypt -lresolv -lm

The shouldn't happen. Do you have cygipc installed? If so, then
uninstall and try again. Any better?

> Do we still need this?

AFAICT, no.

> As I see it, pgsql has its own ipc mechanism.

Does the above imply that 8.0 will not need the IPC in cygserver?

> Without -lcygipc it also builds fine. ...

Yes. For example, 7.4.3 build fine against cygserver.

> >I'm quite willing to help to ensure a smooth transition and to help
> >minimize your "pain." :,) Maybe 8.0 can be a joint effort, with you
> >taking over fully with 8.0.x or 8.1?
>
> Sure, why not?

Thanks!

> But I'm also trying to build the 7.4.5 now, because I want to see the
> changes in the new 8 branch. So you can sit and have a rest. :)

Thanks again. I can use the rest. :,)

> From another thread...
> > Is "--with-template=cygwin" required? It wasn't before.
>
> Yes, this is apparently new for 8.x.

OK, I was just surprised that configure didn't automatically detect the
platform.

> And it does help to be precise in the configure line.

Precise is good -- redundant is not necessarily good.

> BTW: I will convert your build.sh to the cygwin generic-build-script
> system. This is much easier.

OK.

> > Does "--with-tcl" no longer build cleanly?
>
> This wasn't in your 7.4.3 build.sh included and I didn't install the
> tcl/tk sources (only under my perltk tree).

Sorry, for the above. I temporarily forgot that Cygwin PostgreSQL has
TCL issues.

> But I can have a try.

OK, but IMO I would address the other issues first since Cygwin
PostgreSQL never supported TCL in the past. BTW, check the archives,
Patrick Samson and I have made some progress in the past.

> I have tclsh, the headers and the libs, just a tclConfig.sh script is
> missing from the cygwin build. Should not be that hard. All the libs and
> includes are at the standard paths.

It may be harder than anticipated -- remember the Cygwin Tcl/Tk package
is really a native Win32 package not a Cygwin one... :,(

> I'll finish the 8.0.0-beta1 port to cygwin,

Thanks.

> and post to the patches list then the cumulative patches

Sounds good.

> Questions to pgsql-hackers or pgsql-cygwin?

Depends on the question. :,)

> The 8.x build is almost okay now. Just a remaining libreadline issue in
> src/bin/psql/tab-complete.c
> And testing.

Let me know how is goes.

> And sockets would also be fine.
> $ postgresql-8.0.0beta1-1/src/backend/postgres.exe
> FATAL: unrecognized configuration parameter "tcpip_socket"

See the following:

http://archives.postgresql.org/pgsql-general/2004-08/msg01181.php

Thanks,
Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [PATCHES] cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-25 14:13:29
Message-ID: 412C9E89.3030000@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Attached is my 7.4.5 build script,
not yet converted to the new generic-build-script mechanism.

In order to fix the tcl issues I needed perl.
There are still minor tcl issues, but I'll fix them soon.

There's another short Makefile.cygwin patch to build contrib/dbase
correctly. Hope this will be accepted (or looked at) upstream.
With the standard order of libs from configure it will fail, because our
libiconv is shared.
With just the needed libs in the correct order it builds fine:
$ gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations dbf.o dbf2pg.o endian.o -lpq -L../../src/port
-lpgport -lintl -o dbf2pg

*************************

The first standard regression test attempt (--max-connections=10) failed
with:

creating template1 database in
/usr/src/postgresql/postgresql-7.4.5-1/src/test/regress/./tmp_check/data/base/1...
FATAL: could not create shared memory segment: Function not implemented
DETAIL: Failed system call was shmget(key=1, size=1081344, 03600).

Seems to be a cygserver issue. cygserver is running as service.
I'll hunt that down, but looks strange. Seems that I really linked
against cygipc and so it doesn't use cygserver :(

$ tmp_check/install/usr/bin/initdb -D "tmp_check/data" -L
tmp_check/install/usr/share/postgresql --debug --no-locale -E Latin1

creating template1 database in tmp_check/data/base/1... DEBUG: invoking
IpcMemoryCreate(size=1081344)
FATAL: could not create shared memory segment: Function not implemented
DETAIL: Failed system call was shmget(key=1, size=1081344, 03600).

Jason Tishler schrieb:
> On Wed, Aug 25, 2004 at 01:12:46AM +0200, Reini Urban wrote:
>
>>Jason Tishler schrieb:
>>
>>>On Tue, Aug 24, 2004 at 09:49:51PM +0200, Reini Urban wrote:
>>>
>>>>There's on remaining issue for the cygwin build:
>>>>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
>>>>reference to `__imp__CurrentMemoryContext'
>>>>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
>>>>reference to `__imp__CurrentMemoryContext'
>>>
>>>Note I have no experience with 8.0 so the following is a WAG...
>>>The above is likely caused by not linking against an import library
>>>(i.e., libpostgres.a).
>>
>>Yes, it is defined in libpostgres.a. Hmm, a cross-dependency problem in
>>the Makefile. With an added -lpostgres postgres.exe builds fine.
>
>
> In previous versions, postgres.exe built fine without -lpostgres. Other
> components needed to link with libpostgres.a -- not postgres.exe. As
> you indicated above, seems like there is a cross-dependency issue
> introduced in 8.0.

It's just one simple backend object file, so I'll try to hunt that down
later. So the developers can fix their Makefile also.

>>But I'll try to add the single object file only where it is defined.
>
>
> IMO, linking against libpostgres.a is preferable assuming the
> cross-dependency issue cannot be solved.
>
>
>>I also see that it is still linking against cygipc.
>>LIBS=-lintl -lssl -lcrypto -lz -lreadline -lcygipc -lcrypt -lresolv -lm
>
>
> The shouldn't happen. Do you have cygipc installed? If so, then
> uninstall and try again. Any better?

That is probably some left-over autoconf issue.

>>Do we still need this?
>
> AFAICT, no.
>
>
>>As I see it, pgsql has its own ipc mechanism.
> Does the above imply that 8.0 will not need the IPC in cygserver?

Looks like so, but I'll check later. First I want to finish 7.4.5
because of the pending perl problems.

>>Without -lcygipc it also builds fine. ...
>
> Yes. For example, 7.4.3 build fine against cygserver.
>
>
>>>I'm quite willing to help to ensure a smooth transition and to help
>>>minimize your "pain." :,) Maybe 8.0 can be a joint effort, with you
>>>taking over fully with 8.0.x or 8.1?
>>
>>Sure, why not?
>
>
> Thanks!
>
>
>>But I'm also trying to build the 7.4.5 now, because I want to see the
>>changes in the new 8 branch. So you can sit and have a rest. :)
>
>
> Thanks again. I can use the rest. :,)
>
>
>>From another thread...
>>
>>>Is "--with-template=cygwin" required? It wasn't before.
>>
>>Yes, this is apparently new for 8.x.
>
>
> OK, I was just surprised that configure didn't automatically detect the
> platform.
>
>
>>And it does help to be precise in the configure line.
>
>
> Precise is good -- redundant is not necessarily good.
>
>
>>BTW: I will convert your build.sh to the cygwin generic-build-script
>>system. This is much easier.
>
>
> OK.
>
>
>>>Does "--with-tcl" no longer build cleanly?
>>
>>This wasn't in your 7.4.3 build.sh included and I didn't install the
>>tcl/tk sources (only under my perltk tree).
>
>
> Sorry, for the above. I temporarily forgot that Cygwin PostgreSQL has
> TCL issues.
>
>
>>But I can have a try.
>
>
> OK, but IMO I would address the other issues first since Cygwin
> PostgreSQL never supported TCL in the past. BTW, check the archives,
> Patrick Samson and I have made some progress in the past.
>
>
>>I have tclsh, the headers and the libs, just a tclConfig.sh script is
>>missing from the cygwin build. Should not be that hard. All the libs and
>>includes are at the standard paths.
>
>
> It may be harder than anticipated -- remember the Cygwin Tcl/Tk package
> is really a native Win32 package not a Cygwin one... :,(
>
>
>>I'll finish the 8.0.0-beta1 port to cygwin,
>
>
> Thanks.
>
>
>>and post to the patches list then the cumulative patches
>
>
> Sounds good.
>
>
>>Questions to pgsql-hackers or pgsql-cygwin?
>
>
> Depends on the question. :,)
>
>
>>The 8.x build is almost okay now. Just a remaining libreadline issue in
>>src/bin/psql/tab-complete.c
>>And testing.
>
>
> Let me know how is goes.

Uh, this was my old readline lib leftover in /usr/local/lib
It builds fine now.

>>And sockets would also be fine.
>>$ postgresql-8.0.0beta1-1/src/backend/postgres.exe
>>FATAL: unrecognized configuration parameter "tcpip_socket"
>
>
> See the following:
>
> http://archives.postgresql.org/pgsql-general/2004-08/msg01181.php

--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

Attachment Content-Type Size
build.sh text/plain 3.8 KB

From: Jason Tishler <jason(at)tishler(dot)net>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [PATCHES] cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-25 17:16:59
Message-ID: 20040825171659.GA85492@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini,

On Wed, Aug 25, 2004 at 04:13:29PM +0200, Reini Urban wrote:
> Attached is my 7.4.5 build script,
> not yet converted to the new generic-build-script mechanism.
>
> In order to fix the tcl issues I needed perl.
> There are still minor tcl issues, but I'll fix them soon.

IMO, I would hold off on Tcl until 8.0 in order to get 7.4.5 out ASAP.

> There's another short Makefile.cygwin patch to build contrib/dbase
> correctly. Hope this will be accepted (or looked at) upstream.

Sending patches to pgsql-patches@ is a better way to get noticed. :,)

> With the standard order of libs from configure it will fail, because
> our libiconv is shared.
> With just the needed libs in the correct order it builds fine:
> $ gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
> -Wmissing-declarations dbf.o dbf2pg.o endian.o -lpq -L../../src/port
> -lpgport -lintl -o dbf2pg

dbf2pg from 7.4.3 built cleanly for me:

gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations dbf.o dbf2pg.o endian.o -L../../src/interfaces/libpq -lpq -L../../src/port -L/usr/local/lib -lssl -lcrypto -lz -lreadline -lcrypt -lpgport -o dbf2pg

Why is it failing for you?

> The first standard regression test attempt (--max-connections=10)
> failed with:

I recommend using the following:

make MAX_CONNECTIONS=1 check

I certainly wouldn't use MAX_CONNECTIONS > 5 as indicated in the README.

> [snip]
> Seems to be a cygserver issue. cygserver is running as service. I'll
> hunt that down, but looks strange. Seems that I really linked against
> cygipc and so it doesn't use cygserver :(

Hmm... What does cygcheck indicate?

Thanks,
Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6


From: Reini Urban <rurban(at)x-ray(dot)at>
To: Jason Tishler <jason(at)tishler(dot)net>
Cc: pgsql-cygwin(at)postgresql(dot)org, Cygwin Apps <cygwin-apps(at)cygwin(dot)com>
Subject: postgresql-7.4.5-1 ready for review
Date: 2004-08-25 18:09:26
Message-ID: 412CD5D6.6060807@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

ok, postgresql-7.4.5-1 is ready.

The problems were cygipc related (of course), which I
patched away in configure.

All tests passed ok (besides one minor cr/lf issue. see attached)

The files are at
http://xarch.tu-graz.ac.at/home/rurban/software/cygwin/postgresql/postgresql-7.4.5-1/

just the setup.hint is missing. This is your (Jason) job :)

The src package is similar to your old setup,
(orisrc/ plus orisrc/CYGWIN-PATCHES/)
but it really should be changed to
<orisrc>.tar.bz2 and the build and patch file.

I'll to change that with the 8.0.0beta1 package.

Jason Tishler schrieb:
> On Wed, Aug 25, 2004 at 04:13:29PM +0200, Reini Urban wrote:
>
>>Attached is my 7.4.5 build script,
>>not yet converted to the new generic-build-script mechanism.
>>
>>In order to fix the tcl issues I needed perl.
>>There are still minor tcl issues, but I'll fix them soon.
>
> IMO, I would hold off on Tcl until 8.0 in order to get 7.4.5 out ASAP.
>
>
>>There's another short Makefile.cygwin patch to build contrib/dbase
>>correctly. Hope this will be accepted (or looked at) upstream.
>
>
> Sending patches to pgsql-patches@ is a better way to get noticed. :,)

ok, I'll do.

>>With the standard order of libs from configure it will fail, because
>>our libiconv is shared.
>>With just the needed libs in the correct order it builds fine:
>>$ gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
>>-Wmissing-declarations dbf.o dbf2pg.o endian.o -lpq -L../../src/port
>>-lpgport -lintl -o dbf2pg
>
>
> dbf2pg from 7.4.3 built cleanly for me:
>
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations dbf.o dbf2pg.o endian.o -L../../src/interfaces/libpq -lpq -L../../src/port -L/usr/local/lib -lssl -lcrypto -lz -lreadline -lcrypt -lpgport -o dbf2pg
>
> Why is it failing for you?

Because a had -lintl also, which is dynamically resolved.
your built doesn't use libintl.
I wanted to have nls support. :)

>>The first standard regression test attempt (--max-connections=10)
>>failed with:
>
>
> I recommend using the following:
>
> make MAX_CONNECTIONS=1 check
>
> I certainly wouldn't use MAX_CONNECTIONS > 5 as indicated in the README.
>
>
>>[snip]
>>Seems to be a cygserver issue. cygserver is running as service. I'll
>>hunt that down, but looks strange. Seems that I really linked against
>>cygipc and so it doesn't use cygserver :(
>
> Hmm... What does cygcheck indicate?

The problem was this autoconf line (configure.in):
AC_CHECK_LIB(cygipc, shmget)

we have now "native" cygwin shmget support. so this check is bogus.
we really should add a check if shmget is in sys/shm.h
something like
AC_CHECK_LIB(, shmget)

(untested)
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

Attachment Content-Type Size
regression.diffs text/plain 2.2 KB

From: Jason Tishler <jason(at)tishler(dot)net>
To: cygwin-apps(at)cygwin(dot)com
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: postgresql-7.4.5-1 ready for review
Date: 2004-08-26 16:29:53
Message-ID: 20040826162953.GA86844@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini,

On Wed, Aug 25, 2004 at 08:09:26PM +0200, Reini Urban wrote:
> ok, postgresql-7.4.5-1 is ready.

Thanks, but I'm going to upload a postgresql-7.4.5-1 shortly. Let's
transition maintainership in the 8.0 time frame.

> The problems were cygipc related (of course), which I patched away in
> configure.

AFAICT, there should not be any cygipc problems as long as it is not
installed on the build system.

> All tests passed ok (besides one minor cr/lf issue. see attached)

horology fails for me too, but the failure is due to daylight saving
issues (i.e., PDT vs. PST) not a textmode issue.

> just the setup.hint is missing. This is your (Jason) job :)

The setup.hint already on sources does not require any updating.

> The src package is similar to your old setup,
> (orisrc/ plus orisrc/CYGWIN-PATCHES/)
> but it really should be changed to
> <orisrc>.tar.bz2 and the build and patch file.
>
> I'll to change that with the 8.0.0beta1 package.

The above is fine -- just call me old fashioned... :,)

> Jason Tishler schrieb:
> >Hmm... What does cygcheck indicate?
>
> The problem was this autoconf line (configure.in):
> AC_CHECK_LIB(cygipc, shmget)
>
> we have now "native" cygwin shmget support. so this check is bogus.
> we really should add a check if shmget is in sys/shm.h
> something like
> AC_CHECK_LIB(, shmget)

AFAICT, the above change is not necessary:

checking for shmget in -lcygipc... no
...
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6


From: Reini Urban <rurban(at)x-ray(dot)at>
To: cygwin-apps(at)cygwin(dot)com
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: postgresql-7.4.5-1 ready for review
Date: 2004-08-26 16:59:24
Message-ID: 412E16EC.7050104@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Jason Tishler schrieb:
> On Wed, Aug 25, 2004 at 08:09:26PM +0200, Reini Urban wrote:
>>ok, postgresql-7.4.5-1 is ready.
>
> Thanks, but I'm going to upload a postgresql-7.4.5-1 shortly. Let's
> transition maintainership in the 8.0 time frame.

Super. So I can check tcl also.

Please also check my version of the cygwin README.
I added a "Whats new" section.

The new native win32 server is very good, but the cygwin port is much
more compatible to the unix version, and most people will prefer cygwin
as development platform. Just to test it.

> AFAICT, the above change is not necessary:
>
> checking for shmget in -lcygipc... no
> ...
> checking sys/ipc.h usability... yes
> checking sys/ipc.h presence... yes
> checking for sys/ipc.h... yes

The problem is, that I still have cygipc installed, so it will find it,
even if cygserver is running.
Others maybe also. Call it defensive programming.

Anyway my postgresql-7.4.5-1 cygipc configure.in patch is pending, and
will be useful for the 8 series also.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Jason Tishler <jason(at)tishler(dot)net>
To: cygwin-apps(at)cygwin(dot)com
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: postgresql-7.4.5-1 ready for review
Date: 2004-08-27 12:00:36
Message-ID: 20040827120036.GA87688@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini,

On Thu, Aug 26, 2004 at 06:59:24PM +0200, Reini Urban wrote:
> Jason Tishler schrieb:
> >On Wed, Aug 25, 2004 at 08:09:26PM +0200, Reini Urban wrote:
> >>ok, postgresql-7.4.5-1 is ready.
> >
> >Thanks, but I'm going to upload a postgresql-7.4.5-1 shortly. Let's
> >transition maintainership in the 8.0 time frame.
>
> Super. So I can check tcl also.

Please do. Building with Tcl is only the first step, I never got PL/Tcl
to work.

> Please also check my version of the cygwin README. I added a "Whats
> new" section.

Will do.

> >AFAICT, the above change is not necessary:
> >
> > checking for shmget in -lcygipc... no
> > ...
> > checking sys/ipc.h usability... yes
> > checking sys/ipc.h presence... yes
> > checking for sys/ipc.h... yes
>
> The problem is, that I still have cygipc installed, so it will find
> it, even if cygserver is running. Others maybe also. Call it
> defensive programming.

If you are going to maintain Cygwin PostgreSQL, then I highly recommend
uninstalling the deprecated cygipc package.

> Anyway my postgresql-7.4.5-1 cygipc configure.in patch is pending, and
> will be useful for the 8 series also.

AFAICT, your configure.in patch has been rejected. Sorry, but I have to
agree with Peter.

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-29 02:58:41
Message-ID: 200408290258.i7T2wfk16120@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg와이즈 토토SQL pgsql-patches


Your patch highlighted several bugs in our code. First, I wasn't
testing for CYGWIN in the backend pgport_palloc code. Second, I added
an #undef to prevent compiler warnings. Third I added your Cygwin
includes with an #ifdef. These will appear in beta2.

On the timezone issue, I see this in dt.h:

/* Global variable holding time zone information. */
#if !defined(__CYGWIN__) && !defined(WIN32)
#define TIMEZONE_GLOBAL timezone
#else
#define TIMEZONE_GLOBAL _timezone
#define tzname _tzname /* should be in time.h? */
#endif

so are you saying your _timezone is time_t and not an int? Sometimes it
is just a short because it is only minutes west of GMT, not an actually
seconds since 1970 or anything. Making it time_t actually sounds like
overkill, but we can work around that in dt.h if indeed that is how your
OS defines it. The easiest fix would probably be to add the cast to int
right in dt.h and only for Cygwin:

#define TIMEZONE_GLOBAL ((int)_timezone)

Does that work for you?

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

Reini Urban wrote:
> Attached patches are required for cygwin:
>
> 2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> * (postmaster/syslogger.c) struct timeval is
> declared in sys/time.h, not in time.h
>
> 2004-08-24 20:20:54 rurban:
> * (port/dirmod.c) cygwin needs different header locations,
> and unlink is a macro. There are no pgport_palloc
> versions yet
>
>
> timezone/pgtz.c:
> Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
> PGAC_VAR_INT_TIMEZONE
>
> In the meantime I've hacked it with a cast from time_t to (int) in
> timezone/pgtz.c: get_timezone_offset
>
> but timezone really is of time_t, not int. I don't know what you are
> trying to do here.
>
>
> There's on remaining issue for the cygwin build:
> ../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
> reference to `__imp__CurrentMemoryContext'
> ../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
> reference to `__imp__CurrentMemoryContext'
>
> which explains the pgport_palloc problem.
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
>

> 2004-08-24 20:20:54 rurban:
> * cygwin needs different header locations, and unlink is a macro
> * There are no pgport_palloc versions yet
>
> --- postgresql-8.0.0beta1/src/port/dirmod.c.orig 2004-08-08 07:44:36.000000000 +0100
> +++ postgresql-8.0.0beta1/src/port/dirmod.c 2004-08-24 19:20:56.557435000 +0100
> @@ -33,16 +33,28 @@
>
>
> #include "miscadmin.h"
> +
> +#ifdef __CYGWIN__
> +#include <windows.h>
> +#include <w32api/winioctl.h>
> +#else
> #include <winioctl.h>
> +#undef unlink
> +#endif
>
> #undef rename
> -#undef unlink
>
> +/* 2004-08-24 20:20:54 rurban: There are no pgport_palloc versions yet */
> +#if 0
> #ifndef FRONTEND
> +#undef palloc
> +#undef pstrdup
> +#undef pfree
> #define palloc(sz) pgport_palloc(sz)
> #define pstrdup(str) pgport_pstrdup(str)
> #define pfree(pointer) pgport_pfree(pointer)
> #endif
> +#endif
>
>
> /*

> 2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> * struct timeval is declared in sys/time.h, not in time.h
>
> --- postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c.orig 2004-08-06 20:17:31.000000000 +0100
> +++ postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c 2004-08-24 20:21:26.057851800 +0100
> @@ -28,6 +28,7 @@
> #include <signal.h>
> #include <time.h>
> #include <unistd.h>
> +#include <sys/time.h>
> #include <sys/stat.h>
>
> #include "libpq/pqsignal.h"

> --- postgresql-8.0.0beta1/src/timezone/pgtz.c.orig 2004-07-31 20:12:15.000000000 +0100
> +++ postgresql-8.0.0beta1/src/timezone/pgtz.c 2004-08-24 19:56:30.686367800 +0100
> @@ -97,9 +97,9 @@
> return tm->tm_gmtoff;
> #elif defined(HAVE_INT_TIMEZONE)
> #ifdef HAVE_UNDERSCORE_TIMEZONE
> - return -_timezone;
> + return -(int)_timezone;
> #else
> - return -timezone;
> + return -(int)timezone;
> #endif
> #else
> #error No way to determine TZ? Can this happen?

>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 2.0 KB

From: Reini Urban <rurban(at)x-ray(dot)at>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-29 10:49:50
Message-ID: 4131B4CE.9050602@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Bruce Momjian schrieb:
> Your patch highlighted several bugs in our code. First, I wasn't
> testing for CYGWIN in the backend pgport_palloc code. Second, I added
> an #undef to prevent compiler warnings. Third I added your Cygwin
> includes with an #ifdef. These will appear in beta2.
>
> On the timezone issue, I see this in dt.h:
>
> /* Global variable holding time zone information. */
> #if !defined(__CYGWIN__) && !defined(WIN32)
> #define TIMEZONE_GLOBAL timezone
> #else
> #define TIMEZONE_GLOBAL _timezone
> #define tzname _tzname /* should be in time.h? */
> #endif
>
> so are you saying your _timezone is time_t and not an int? Sometimes it
> is just a short because it is only minutes west of GMT, not an actually
> seconds since 1970 or anything. Making it time_t actually sounds like
> overkill, but we can work around that in dt.h if indeed that is how your
> OS defines it. The easiest fix would probably be to add the cast to int
> right in dt.h and only for Cygwin:
>
> #define TIMEZONE_GLOBAL ((int)_timezone)
>
> Does that work for you?

yes, that's better.

FYI /usr/include/time.h:
/* defines for the opengroup specifications Derived from Issue 1 of the
SVID. */
extern __IMPORT time_t _timezone;
...

BTW: I see that CYGWIN also has a struct timezone in sys/time.h, but
configure didn't check for that.
I'll come with better patches after beta2.

> ---------------------------------------------------------------------------
>
> Reini Urban wrote:
>
>>Attached patches are required for cygwin:
>>
>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
>> * (postmaster/syslogger.c) struct timeval is
>> declared in sys/time.h, not in time.h
>>
>>2004-08-24 20:20:54 rurban:
>> * (port/dirmod.c) cygwin needs different header locations,
>> and unlink is a macro. There are no pgport_palloc
>> versions yet
>>
>>
>>timezone/pgtz.c:
>>Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
>>PGAC_VAR_INT_TIMEZONE
>>
>>In the meantime I've hacked it with a cast from time_t to (int) in
>>timezone/pgtz.c: get_timezone_offset
>>
>>but timezone really is of time_t, not int. I don't know what you are
>>trying to do here.
>>
>>
>>There's on remaining issue for the cygwin build:
>>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
>>reference to `__imp__CurrentMemoryContext'
>>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
>>reference to `__imp__CurrentMemoryContext'
>>
>>which explains the pgport_palloc problem.
>>--
>>Reini Urban
>>http://xarch.tu-graz.ac.at/home/rurban/
>>
>
>
>>2004-08-24 20:20:54 rurban:
>> * cygwin needs different header locations, and unlink is a macro
>> * There are no pgport_palloc versions yet
>>
>>--- postgresql-8.0.0beta1/src/port/dirmod.c.orig 2004-08-08 07:44:36.000000000 +0100
>>+++ postgresql-8.0.0beta1/src/port/dirmod.c 2004-08-24 19:20:56.557435000 +0100
>>@@ -33,16 +33,28 @@
>>
>>
>> #include "miscadmin.h"
>>+
>>+#ifdef __CYGWIN__
>>+#include <windows.h>
>>+#include <w32api/winioctl.h>
>>+#else
>> #include <winioctl.h>
>>+#undef unlink
>>+#endif
>>
>> #undef rename
>>-#undef unlink
>>
>>+/* 2004-08-24 20:20:54 rurban: There are no pgport_palloc versions yet */
>>+#if 0
>> #ifndef FRONTEND
>>+#undef palloc
>>+#undef pstrdup
>>+#undef pfree
>> #define palloc(sz) pgport_palloc(sz)
>> #define pstrdup(str) pgport_pstrdup(str)
>> #define pfree(pointer) pgport_pfree(pointer)
>> #endif
>>+#endif
>>
>>
>> /*
>
>
>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
>> * struct timeval is declared in sys/time.h, not in time.h
>>
>>--- postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c.orig 2004-08-06 20:17:31.000000000 +0100
>>+++ postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c 2004-08-24 20:21:26.057851800 +0100
>>@@ -28,6 +28,7 @@
>> #include <signal.h>
>> #include <time.h>
>> #include <unistd.h>
>>+#include <sys/time.h>
>> #include <sys/stat.h>
>>
>> #include "libpq/pqsignal.h"
>
>
>>--- postgresql-8.0.0beta1/src/timezone/pgtz.c.orig 2004-07-31 20:12:15.000000000 +0100
>>+++ postgresql-8.0.0beta1/src/timezone/pgtz.c 2004-08-24 19:56:30.686367800 +0100
>>@@ -97,9 +97,9 @@
>> return tm->tm_gmtoff;
>> #elif defined(HAVE_INT_TIMEZONE)
>> #ifdef HAVE_UNDERSCORE_TIMEZONE
>>- return -_timezone;
>>+ return -(int)_timezone;
>> #else
>>- return -timezone;
>>+ return -(int)timezone;
>> #endif
>> #else
>> #error No way to determine TZ? Can this happen?
>
>
>>---------------------------(end of broadcast)---------------------------
>>TIP 9: the planner will ignore your desire to choose an index scan if your
>> joining column's datatypes do not match
>
>
>
> ------------------------------------------------------------------------
>
> Index: src/backend/utils/mmgr/mcxt.c
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/backend/utils/mmgr/mcxt.c,v
> retrieving revision 1.47
> diff -c -c -r1.47 mcxt.c
> *** src/backend/utils/mmgr/mcxt.c 8 Aug 2004 06:44:32 -0000 1.47
> --- src/backend/utils/mmgr/mcxt.c 29 Aug 2004 02:50:25 -0000
> ***************
> *** 631,637 ****
> }
>
>
> ! #ifdef WIN32
> /*
> * Memory support routines for libpgport on Win32
> *
> --- 631,637 ----
> }
>
>
> ! #if defined(WIN32) || defined(__CYGWIN__)
> /*
> * Memory support routines for libpgport on Win32
> *
> ***************
> *** 649,654 ****
> --- 649,655 ----
> return palloc(sz);
> }
>
> +
> char *
> pgport_pstrdup(const char *str)
> {
> Index: src/port/dirmod.c
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
> retrieving revision 1.19
> diff -c -c -r1.19 dirmod.c
> *** src/port/dirmod.c 29 Aug 2004 01:44:02 -0000 1.19
> --- src/port/dirmod.c 29 Aug 2004 02:50:28 -0000
> ***************
> *** 31,48 ****
>
> #if defined(WIN32) || defined(__CYGWIN__)
>
> -
> #include "miscadmin.h"
> - #include <winioctl.h>
>
> #undef rename
> #undef unlink
>
> #ifndef FRONTEND
> /*
> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
> * because of DLLIMPORT.
> */
> #define palloc(sz) pgport_palloc(sz)
> #define pstrdup(str) pgport_pstrdup(str)
> #define pfree(pointer) pgport_pfree(pointer)
> --- 31,57 ----
>
> #if defined(WIN32) || defined(__CYGWIN__)
>
> #include "miscadmin.h"
>
> #undef rename
> #undef unlink
>
> + #ifdef __WIN32__
> + #include <winioctl.h>
> + #else
> + /* __CYGWIN__ */
> + #include <windows.h>
> + #include <w32api/winioctl.h>
> + #endif
> +
> #ifndef FRONTEND
> /*
> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
> * because of DLLIMPORT.
> */
> + #undef palloc
> + #undef pstrdup
> + #undef pfree
> #define palloc(sz) pgport_palloc(sz)
> #define pstrdup(str) pgport_pstrdup(str)
> #define pfree(pointer) pgport_pfree(pointer)

--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-30 03:23:31
Message-ID: 200408300323.i7U3NVJ21776@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches


Should I apply this change?

#define TIMEZONE_GLOBAL ((int)_timezone)

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

Reini Urban wrote:
> Bruce Momjian schrieb:
> > Your patch highlighted several bugs in our code. First, I wasn't
> > testing for CYGWIN in the backend pgport_palloc code. Second, I added
> > an #undef to prevent compiler warnings. Third I added your Cygwin
> > includes with an #ifdef. These will appear in beta2.
> >
> > On the timezone issue, I see this in dt.h:
> >
> > /* Global variable holding time zone information. */
> > #if !defined(__CYGWIN__) && !defined(WIN32)
> > #define TIMEZONE_GLOBAL timezone
> > #else
> > #define TIMEZONE_GLOBAL _timezone
> > #define tzname _tzname /* should be in time.h? */
> > #endif
> >
> > so are you saying your _timezone is time_t and not an int? Sometimes it
> > is just a short because it is only minutes west of GMT, not an actually
> > seconds since 1970 or anything. Making it time_t actually sounds like
> > overkill, but we can work around that in dt.h if indeed that is how your
> > OS defines it. The easiest fix would probably be to add the cast to int
> > right in dt.h and only for Cygwin:
> >
> > #define TIMEZONE_GLOBAL ((int)_timezone)
> >
> > Does that work for you?
>
> yes, that's better.
>
> FYI /usr/include/time.h:
> /* defines for the opengroup specifications Derived from Issue 1 of the
> SVID. */
> extern __IMPORT time_t _timezone;
> ...
>
> BTW: I see that CYGWIN also has a struct timezone in sys/time.h, but
> configure didn't check for that.
> I'll come with better patches after beta2.
>
>
> > ---------------------------------------------------------------------------
> >
> > Reini Urban wrote:
> >
> >>Attached patches are required for cygwin:
> >>
> >>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> >> * (postmaster/syslogger.c) struct timeval is
> >> declared in sys/time.h, not in time.h
> >>
> >>2004-08-24 20:20:54 rurban:
> >> * (port/dirmod.c) cygwin needs different header locations,
> >> and unlink is a macro. There are no pgport_palloc
> >> versions yet
> >>
> >>
> >>timezone/pgtz.c:
> >>Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
> >>PGAC_VAR_INT_TIMEZONE
> >>
> >>In the meantime I've hacked it with a cast from time_t to (int) in
> >>timezone/pgtz.c: get_timezone_offset
> >>
> >>but timezone really is of time_t, not int. I don't know what you are
> >>trying to do here.
> >>
> >>
> >>There's on remaining issue for the cygwin build:
> >>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
> >>reference to `__imp__CurrentMemoryContext'
> >>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
> >>reference to `__imp__CurrentMemoryContext'
> >>
> >>which explains the pgport_palloc problem.
> >>--
> >>Reini Urban
> >>http://xarch.tu-graz.ac.at/home/rurban/
> >>
> >
> >
> >>2004-08-24 20:20:54 rurban:
> >> * cygwin needs different header locations, and unlink is a macro
> >> * There are no pgport_palloc versions yet
> >>
> >>--- postgresql-8.0.0beta1/src/port/dirmod.c.orig 2004-08-08 07:44:36.000000000 +0100
> >>+++ postgresql-8.0.0beta1/src/port/dirmod.c 2004-08-24 19:20:56.557435000 +0100
> >>@@ -33,16 +33,28 @@
> >>
> >>
> >> #include "miscadmin.h"
> >>+
> >>+#ifdef __CYGWIN__
> >>+#include <windows.h>
> >>+#include <w32api/winioctl.h>
> >>+#else
> >> #include <winioctl.h>
> >>+#undef unlink
> >>+#endif
> >>
> >> #undef rename
> >>-#undef unlink
> >>
> >>+/* 2004-08-24 20:20:54 rurban: There are no pgport_palloc versions yet */
> >>+#if 0
> >> #ifndef FRONTEND
> >>+#undef palloc
> >>+#undef pstrdup
> >>+#undef pfree
> >> #define palloc(sz) pgport_palloc(sz)
> >> #define pstrdup(str) pgport_pstrdup(str)
> >> #define pfree(pointer) pgport_pfree(pointer)
> >> #endif
> >>+#endif
> >>
> >>
> >> /*
> >
> >
> >>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> >> * struct timeval is declared in sys/time.h, not in time.h
> >>
> >>--- postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c.orig 2004-08-06 20:17:31.000000000 +0100
> >>+++ postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c 2004-08-24 20:21:26.057851800 +0100
> >>@@ -28,6 +28,7 @@
> >> #include <signal.h>
> >> #include <time.h>
> >> #include <unistd.h>
> >>+#include <sys/time.h>
> >> #include <sys/stat.h>
> >>
> >> #include "libpq/pqsignal.h"
> >
> >
> >>--- postgresql-8.0.0beta1/src/timezone/pgtz.c.orig 2004-07-31 20:12:15.000000000 +0100
> >>+++ postgresql-8.0.0beta1/src/timezone/pgtz.c 2004-08-24 19:56:30.686367800 +0100
> >>@@ -97,9 +97,9 @@
> >> return tm->tm_gmtoff;
> >> #elif defined(HAVE_INT_TIMEZONE)
> >> #ifdef HAVE_UNDERSCORE_TIMEZONE
> >>- return -_timezone;
> >>+ return -(int)_timezone;
> >> #else
> >>- return -timezone;
> >>+ return -(int)timezone;
> >> #endif
> >> #else
> >> #error No way to determine TZ? Can this happen?
> >
> >
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 9: the planner will ignore your desire to choose an index scan if your
> >> joining column's datatypes do not match
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > Index: src/backend/utils/mmgr/mcxt.c
> > ===================================================================
> > RCS file: /cvsroot/pgsql-server/src/backend/utils/mmgr/mcxt.c,v
> > retrieving revision 1.47
> > diff -c -c -r1.47 mcxt.c
> > *** src/backend/utils/mmgr/mcxt.c 8 Aug 2004 06:44:32 -0000 1.47
> > --- src/backend/utils/mmgr/mcxt.c 29 Aug 2004 02:50:25 -0000
> > ***************
> > *** 631,637 ****
> > }
> >
> >
> > ! #ifdef WIN32
> > /*
> > * Memory support routines for libpgport on Win32
> > *
> > --- 631,637 ----
> > }
> >
> >
> > ! #if defined(WIN32) || defined(__CYGWIN__)
> > /*
> > * Memory support routines for libpgport on Win32
> > *
> > ***************
> > *** 649,654 ****
> > --- 649,655 ----
> > return palloc(sz);
> > }
> >
> > +
> > char *
> > pgport_pstrdup(const char *str)
> > {
> > Index: src/port/dirmod.c
> > ===================================================================
> > RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
> > retrieving revision 1.19
> > diff -c -c -r1.19 dirmod.c
> > *** src/port/dirmod.c 29 Aug 2004 01:44:02 -0000 1.19
> > --- src/port/dirmod.c 29 Aug 2004 02:50:28 -0000
> > ***************
> > *** 31,48 ****
> >
> > #if defined(WIN32) || defined(__CYGWIN__)
> >
> > -
> > #include "miscadmin.h"
> > - #include <winioctl.h>
> >
> > #undef rename
> > #undef unlink
> >
> > #ifndef FRONTEND
> > /*
> > * Call non-macro versions of palloc, can't reference CurrentMemoryContext
> > * because of DLLIMPORT.
> > */
> > #define palloc(sz) pgport_palloc(sz)
> > #define pstrdup(str) pgport_pstrdup(str)
> > #define pfree(pointer) pgport_pfree(pointer)
> > --- 31,57 ----
> >
> > #if defined(WIN32) || defined(__CYGWIN__)
> >
> > #include "miscadmin.h"
> >
> > #undef rename
> > #undef unlink
> >
> > + #ifdef __WIN32__
> > + #include <winioctl.h>
> > + #else
> > + /* __CYGWIN__ */
> > + #include <windows.h>
> > + #include <w32api/winioctl.h>
> > + #endif
> > +
> > #ifndef FRONTEND
> > /*
> > * Call non-macro versions of palloc, can't reference CurrentMemoryContext
> > * because of DLLIMPORT.
> > */
> > + #undef palloc
> > + #undef pstrdup
> > + #undef pfree
> > #define palloc(sz) pgport_palloc(sz)
> > #define pstrdup(str) pgport_pstrdup(str)
> > #define pfree(pointer) pgport_pfree(pointer)
>
>
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Reini Urban <rurban(at)x-ray(dot)at>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-08-30 07:01:37
Message-ID: 4132D0D1.2060102@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin Postg스포츠 토토 결과SQL

Bruce Momjian schrieb:
> Should I apply this change?
>
> #define TIMEZONE_GLOBAL ((int)_timezone)

yes, please.
I have no time yet, to come up with the better patch. It's already monday.

> ---------------------------------------------------------------------------
>
> Reini Urban wrote:
>
>>Bruce Momjian schrieb:
>>
>>>Your patch highlighted several bugs in our code. First, I wasn't
>>>testing for CYGWIN in the backend pgport_palloc code. Second, I added
>>>an #undef to prevent compiler warnings. Third I added your Cygwin
>>>includes with an #ifdef. These will appear in beta2.
>>>
>>>On the timezone issue, I see this in dt.h:
>>>
>>> /* Global variable holding time zone information. */
>>> #if !defined(__CYGWIN__) && !defined(WIN32)
>>> #define TIMEZONE_GLOBAL timezone
>>> #else
>>> #define TIMEZONE_GLOBAL _timezone
>>> #define tzname _tzname /* should be in time.h? */
>>> #endif
>>>
>>>so are you saying your _timezone is time_t and not an int? Sometimes it
>>>is just a short because it is only minutes west of GMT, not an actually
>>>seconds since 1970 or anything. Making it time_t actually sounds like
>>>overkill, but we can work around that in dt.h if indeed that is how your
>>>OS defines it. The easiest fix would probably be to add the cast to int
>>>right in dt.h and only for Cygwin:
>>>
>>> #define TIMEZONE_GLOBAL ((int)_timezone)
>>>
>>>Does that work for you?
>>
>>yes, that's better.
>>
>>FYI /usr/include/time.h:
>>/* defines for the opengroup specifications Derived from Issue 1 of the
>>SVID. */
>>extern __IMPORT time_t _timezone;
>>...
>>
>>BTW: I see that CYGWIN also has a struct timezone in sys/time.h, but
>>configure didn't check for that.
>>I'll come with better patches after beta2.
>>
>>
>>
>>>---------------------------------------------------------------------------
>>>
>>>Reini Urban wrote:
>>>
>>>
>>>>Attached patches are required for cygwin:
>>>>
>>>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
>>>> * (postmaster/syslogger.c) struct timeval is
>>>> declared in sys/time.h, not in time.h
>>>>
>>>>2004-08-24 20:20:54 rurban:
>>>> * (port/dirmod.c) cygwin needs different header locations,
>>>> and unlink is a macro. There are no pgport_palloc
>>>> versions yet
>>>>
>>>>
>>>>timezone/pgtz.c:
>>>>Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
>>>>PGAC_VAR_INT_TIMEZONE
>>>>
>>>>In the meantime I've hacked it with a cast from time_t to (int) in
>>>>timezone/pgtz.c: get_timezone_offset
>>>>
>>>>but timezone really is of time_t, not int. I don't know what you are
>>>>trying to do here.
>>>>
>>>>
>>>>There's on remaining issue for the cygwin build:
>>>>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
>>>>reference to `__imp__CurrentMemoryContext'
>>>>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
>>>>reference to `__imp__CurrentMemoryContext'
>>>>
>>>>which explains the pgport_palloc problem.
>>>>--
>>>>Reini Urban
>>>>http://xarch.tu-graz.ac.at/home/rurban/
>>>>
>>>
>>>
>>>>2004-08-24 20:20:54 rurban:
>>>> * cygwin needs different header locations, and unlink is a macro
>>>> * There are no pgport_palloc versions yet
>>>>
>>>>--- postgresql-8.0.0beta1/src/port/dirmod.c.orig 2004-08-08 07:44:36.000000000 +0100
>>>>+++ postgresql-8.0.0beta1/src/port/dirmod.c 2004-08-24 19:20:56.557435000 +0100
>>>>@@ -33,16 +33,28 @@
>>>>
>>>>
>>>>#include "miscadmin.h"
>>>>+
>>>>+#ifdef __CYGWIN__
>>>>+#include <windows.h>
>>>>+#include <w32api/winioctl.h>
>>>>+#else
>>>>#include <winioctl.h>
>>>>+#undef unlink
>>>>+#endif
>>>>
>>>>#undef rename
>>>>-#undef unlink
>>>>
>>>>+/* 2004-08-24 20:20:54 rurban: There are no pgport_palloc versions yet */
>>>>+#if 0
>>>>#ifndef FRONTEND
>>>>+#undef palloc
>>>>+#undef pstrdup
>>>>+#undef pfree
>>>>#define palloc(sz) pgport_palloc(sz)
>>>>#define pstrdup(str) pgport_pstrdup(str)
>>>>#define pfree(pointer) pgport_pfree(pointer)
>>>>#endif
>>>>+#endif
>>>>
>>>>
>>>>/*
>>>
>>>
>>>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
>>>> * struct timeval is declared in sys/time.h, not in time.h
>>>>
>>>>--- postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c.orig 2004-08-06 20:17:31.000000000 +0100
>>>>+++ postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c 2004-08-24 20:21:26.057851800 +0100
>>>>@@ -28,6 +28,7 @@
>>>>#include <signal.h>
>>>>#include <time.h>
>>>>#include <unistd.h>
>>>>+#include <sys/time.h>
>>>>#include <sys/stat.h>
>>>>
>>>>#include "libpq/pqsignal.h"
>>>
>>>
>>>>--- postgresql-8.0.0beta1/src/timezone/pgtz.c.orig 2004-07-31 20:12:15.000000000 +0100
>>>>+++ postgresql-8.0.0beta1/src/timezone/pgtz.c 2004-08-24 19:56:30.686367800 +0100
>>>>@@ -97,9 +97,9 @@
>>>> return tm->tm_gmtoff;
>>>>#elif defined(HAVE_INT_TIMEZONE)
>>>>#ifdef HAVE_UNDERSCORE_TIMEZONE
>>>>- return -_timezone;
>>>>+ return -(int)_timezone;
>>>>#else
>>>>- return -timezone;
>>>>+ return -(int)timezone;
>>>>#endif
>>>>#else
>>>>#error No way to determine TZ? Can this happen?
>>>
>>>
>>>>---------------------------(end of broadcast)---------------------------
>>>>TIP 9: the planner will ignore your desire to choose an index scan if your
>>>> joining column's datatypes do not match
>>>
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>Index: src/backend/utils/mmgr/mcxt.c
>>>===================================================================
>>>RCS file: /cvsroot/pgsql-server/src/backend/utils/mmgr/mcxt.c,v
>>>retrieving revision 1.47
>>>diff -c -c -r1.47 mcxt.c
>>>*** src/backend/utils/mmgr/mcxt.c 8 Aug 2004 06:44:32 -0000 1.47
>>>--- src/backend/utils/mmgr/mcxt.c 29 Aug 2004 02:50:25 -0000
>>>***************
>>>*** 631,637 ****
>>> }
>>>
>>>
>>>! #ifdef WIN32
>>> /*
>>> * Memory support routines for libpgport on Win32
>>> *
>>>--- 631,637 ----
>>> }
>>>
>>>
>>>! #if defined(WIN32) || defined(__CYGWIN__)
>>> /*
>>> * Memory support routines for libpgport on Win32
>>> *
>>>***************
>>>*** 649,654 ****
>>>--- 649,655 ----
>>> return palloc(sz);
>>> }
>>>
>>>+
>>> char *
>>> pgport_pstrdup(const char *str)
>>> {
>>>Index: src/port/dirmod.c
>>>===================================================================
>>>RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
>>>retrieving revision 1.19
>>>diff -c -c -r1.19 dirmod.c
>>>*** src/port/dirmod.c 29 Aug 2004 01:44:02 -0000 1.19
>>>--- src/port/dirmod.c 29 Aug 2004 02:50:28 -0000
>>>***************
>>>*** 31,48 ****
>>>
>>> #if defined(WIN32) || defined(__CYGWIN__)
>>>
>>>-
>>> #include "miscadmin.h"
>>>- #include <winioctl.h>
>>>
>>> #undef rename
>>> #undef unlink
>>>
>>> #ifndef FRONTEND
>>> /*
>>> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
>>> * because of DLLIMPORT.
>>> */
>>> #define palloc(sz) pgport_palloc(sz)
>>> #define pstrdup(str) pgport_pstrdup(str)
>>> #define pfree(pointer) pgport_pfree(pointer)
>>>--- 31,57 ----
>>>
>>> #if defined(WIN32) || defined(__CYGWIN__)
>>>
>>> #include "miscadmin.h"
>>>
>>> #undef rename
>>> #undef unlink
>>>
>>>+ #ifdef __WIN32__
>>>+ #include <winioctl.h>
>>>+ #else
>>>+ /* __CYGWIN__ */
>>>+ #include <windows.h>
>>>+ #include <w32api/winioctl.h>
>>>+ #endif
>>>+
>>> #ifndef FRONTEND
>>> /*
>>> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
>>> * because of DLLIMPORT.
>>> */
>>>+ #undef palloc
>>>+ #undef pstrdup
>>>+ #undef pfree
>>> #define palloc(sz) pgport_palloc(sz)
>>> #define pstrdup(str) pgport_pstrdup(str)
>>> #define pfree(pointer) pgport_pfree(pointer)
>>
>>
>>--
>>Reini Urban
>>http://xarch.tu-graz.ac.at/home/rurban/
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 4: Don't 'kill -9' the postmaster
>>
>
>

--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: cygwin 8.0.0beta1 postmaster/syslogger.c, port/dirmod.c,
Date: 2004-09-01 04:01:42
Message-ID: 200409010401.i8141gq11507@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches


OK, patch attached and applied that casts _timezone to (int) on Cygwin.

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

Reini Urban wrote:
> Bruce Momjian schrieb:
> > Should I apply this change?
> >
> > #define TIMEZONE_GLOBAL ((int)_timezone)
>
> yes, please.
> I have no time yet, to come up with the better patch. It's already monday.
>
> > ---------------------------------------------------------------------------
> >
> > Reini Urban wrote:
> >
> >>Bruce Momjian schrieb:
> >>
> >>>Your patch highlighted several bugs in our code. First, I wasn't
> >>>testing for CYGWIN in the backend pgport_palloc code. Second, I added
> >>>an #undef to prevent compiler warnings. Third I added your Cygwin
> >>>includes with an #ifdef. These will appear in beta2.
> >>>
> >>>On the timezone issue, I see this in dt.h:
> >>>
> >>> /* Global variable holding time zone information. */
> >>> #if !defined(__CYGWIN__) && !defined(WIN32)
> >>> #define TIMEZONE_GLOBAL timezone
> >>> #else
> >>> #define TIMEZONE_GLOBAL _timezone
> >>> #define tzname _tzname /* should be in time.h? */
> >>> #endif
> >>>
> >>>so are you saying your _timezone is time_t and not an int? Sometimes it
> >>>is just a short because it is only minutes west of GMT, not an actually
> >>>seconds since 1970 or anything. Making it time_t actually sounds like
> >>>overkill, but we can work around that in dt.h if indeed that is how your
> >>>OS defines it. The easiest fix would probably be to add the cast to int
> >>>right in dt.h and only for Cygwin:
> >>>
> >>> #define TIMEZONE_GLOBAL ((int)_timezone)
> >>>
> >>>Does that work for you?
> >>
> >>yes, that's better.
> >>
> >>FYI /usr/include/time.h:
> >>/* defines for the opengroup specifications Derived from Issue 1 of the
> >>SVID. */
> >>extern __IMPORT time_t _timezone;
> >>...
> >>
> >>BTW: I see that CYGWIN also has a struct timezone in sys/time.h, but
> >>configure didn't check for that.
> >>I'll come with better patches after beta2.
> >>
> >>
> >>
> >>>---------------------------------------------------------------------------
> >>>
> >>>Reini Urban wrote:
> >>>
> >>>
> >>>>Attached patches are required for cygwin:
> >>>>
> >>>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> >>>> * (postmaster/syslogger.c) struct timeval is
> >>>> declared in sys/time.h, not in time.h
> >>>>
> >>>>2004-08-24 20:20:54 rurban:
> >>>> * (port/dirmod.c) cygwin needs different header locations,
> >>>> and unlink is a macro. There are no pgport_palloc
> >>>> versions yet
> >>>>
> >>>>
> >>>>timezone/pgtz.c:
> >>>>Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
> >>>>PGAC_VAR_INT_TIMEZONE
> >>>>
> >>>>In the meantime I've hacked it with a cast from time_t to (int) in
> >>>>timezone/pgtz.c: get_timezone_offset
> >>>>
> >>>>but timezone really is of time_t, not int. I don't know what you are
> >>>>trying to do here.
> >>>>
> >>>>
> >>>>There's on remaining issue for the cygwin build:
> >>>>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
> >>>>reference to `__imp__CurrentMemoryContext'
> >>>>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
> >>>>reference to `__imp__CurrentMemoryContext'
> >>>>
> >>>>which explains the pgport_palloc problem.
> >>>>--
> >>>>Reini Urban
> >>>>http://xarch.tu-graz.ac.at/home/rurban/
> >>>>
> >>>
> >>>
> >>>>2004-08-24 20:20:54 rurban:
> >>>> * cygwin needs different header locations, and unlink is a macro
> >>>> * There are no pgport_palloc versions yet
> >>>>
> >>>>--- postgresql-8.0.0beta1/src/port/dirmod.c.orig 2004-08-08 07:44:36.000000000 +0100
> >>>>+++ postgresql-8.0.0beta1/src/port/dirmod.c 2004-08-24 19:20:56.557435000 +0100
> >>>>@@ -33,16 +33,28 @@
> >>>>
> >>>>
> >>>>#include "miscadmin.h"
> >>>>+
> >>>>+#ifdef __CYGWIN__
> >>>>+#include <windows.h>
> >>>>+#include <w32api/winioctl.h>
> >>>>+#else
> >>>>#include <winioctl.h>
> >>>>+#undef unlink
> >>>>+#endif
> >>>>
> >>>>#undef rename
> >>>>-#undef unlink
> >>>>
> >>>>+/* 2004-08-24 20:20:54 rurban: There are no pgport_palloc versions yet */
> >>>>+#if 0
> >>>>#ifndef FRONTEND
> >>>>+#undef palloc
> >>>>+#undef pstrdup
> >>>>+#undef pfree
> >>>>#define palloc(sz) pgport_palloc(sz)
> >>>>#define pstrdup(str) pgport_pstrdup(str)
> >>>>#define pfree(pointer) pgport_pfree(pointer)
> >>>>#endif
> >>>>+#endif
> >>>>
> >>>>
> >>>>/*
> >>>
> >>>
> >>>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
> >>>> * struct timeval is declared in sys/time.h, not in time.h
> >>>>
> >>>>--- postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c.orig 2004-08-06 20:17:31.000000000 +0100
> >>>>+++ postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c 2004-08-24 20:21:26.057851800 +0100
> >>>>@@ -28,6 +28,7 @@
> >>>>#include <signal.h>
> >>>>#include <time.h>
> >>>>#include <unistd.h>
> >>>>+#include <sys/time.h>
> >>>>#include <sys/stat.h>
> >>>>
> >>>>#include "libpq/pqsignal.h"
> >>>
> >>>
> >>>>--- postgresql-8.0.0beta1/src/timezone/pgtz.c.orig 2004-07-31 20:12:15.000000000 +0100
> >>>>+++ postgresql-8.0.0beta1/src/timezone/pgtz.c 2004-08-24 19:56:30.686367800 +0100
> >>>>@@ -97,9 +97,9 @@
> >>>> return tm->tm_gmtoff;
> >>>>#elif defined(HAVE_INT_TIMEZONE)
> >>>>#ifdef HAVE_UNDERSCORE_TIMEZONE
> >>>>- return -_timezone;
> >>>>+ return -(int)_timezone;
> >>>>#else
> >>>>- return -timezone;
> >>>>+ return -(int)timezone;
> >>>>#endif
> >>>>#else
> >>>>#error No way to determine TZ? Can this happen?
> >>>
> >>>
> >>>>---------------------------(end of broadcast)---------------------------
> >>>>TIP 9: the planner will ignore your desire to choose an index scan if your
> >>>> joining column's datatypes do not match
> >>>
> >>>
> >>>
> >>>------------------------------------------------------------------------
> >>>
> >>>Index: src/backend/utils/mmgr/mcxt.c
> >>>===================================================================
> >>>RCS file: /cvsroot/pgsql-server/src/backend/utils/mmgr/mcxt.c,v
> >>>retrieving revision 1.47
> >>>diff -c -c -r1.47 mcxt.c
> >>>*** src/backend/utils/mmgr/mcxt.c 8 Aug 2004 06:44:32 -0000 1.47
> >>>--- src/backend/utils/mmgr/mcxt.c 29 Aug 2004 02:50:25 -0000
> >>>***************
> >>>*** 631,637 ****
> >>> }
> >>>
> >>>
> >>>! #ifdef WIN32
> >>> /*
> >>> * Memory support routines for libpgport on Win32
> >>> *
> >>>--- 631,637 ----
> >>> }
> >>>
> >>>
> >>>! #if defined(WIN32) || defined(__CYGWIN__)
> >>> /*
> >>> * Memory support routines for libpgport on Win32
> >>> *
> >>>***************
> >>>*** 649,654 ****
> >>>--- 649,655 ----
> >>> return palloc(sz);
> >>> }
> >>>
> >>>+
> >>> char *
> >>> pgport_pstrdup(const char *str)
> >>> {
> >>>Index: src/port/dirmod.c
> >>>===================================================================
> >>>RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
> >>>retrieving revision 1.19
> >>>diff -c -c -r1.19 dirmod.c
> >>>*** src/port/dirmod.c 29 Aug 2004 01:44:02 -0000 1.19
> >>>--- src/port/dirmod.c 29 Aug 2004 02:50:28 -0000
> >>>***************
> >>>*** 31,48 ****
> >>>
> >>> #if defined(WIN32) || defined(__CYGWIN__)
> >>>
> >>>-
> >>> #include "miscadmin.h"
> >>>- #include <winioctl.h>
> >>>
> >>> #undef rename
> >>> #undef unlink
> >>>
> >>> #ifndef FRONTEND
> >>> /*
> >>> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
> >>> * because of DLLIMPORT.
> >>> */
> >>> #define palloc(sz) pgport_palloc(sz)
> >>> #define pstrdup(str) pgport_pstrdup(str)
> >>> #define pfree(pointer) pgport_pfree(pointer)
> >>>--- 31,57 ----
> >>>
> >>> #if defined(WIN32) || defined(__CYGWIN__)
> >>>
> >>> #include "miscadmin.h"
> >>>
> >>> #undef rename
> >>> #undef unlink
> >>>
> >>>+ #ifdef __WIN32__
> >>>+ #include <winioctl.h>
> >>>+ #else
> >>>+ /* __CYGWIN__ */
> >>>+ #include <windows.h>
> >>>+ #include <w32api/winioctl.h>
> >>>+ #endif
> >>>+
> >>> #ifndef FRONTEND
> >>> /*
> >>> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
> >>> * because of DLLIMPORT.
> >>> */
> >>>+ #undef palloc
> >>>+ #undef pstrdup
> >>>+ #undef pfree
> >>> #define palloc(sz) pgport_palloc(sz)
> >>> #define pstrdup(str) pgport_pstrdup(str)
> >>> #define pfree(pointer) pgport_pfree(pointer)
> >>
> >>
> >>--
> >>Reini Urban
> >>http://xarch.tu-graz.ac.at/home/rurban/
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 4: Don't 'kill -9' the postmaster
> >>
> >
> >
>
>
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 712 bytes

From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [PATCHES] time_t timezone
Date: 2004-09-01 04:36:04
Message-ID: 413551B4.1040905@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin Postg범퍼카 토토SQL

Now I've found time to test beta2 and came up
with the attached better patch:

Added configure time_t timezone check for the SUSV definition.
Not only cygwin, all newlib installations without struct tm timezone.
Casted to (int) timezone.

(configure should really be re-created by autoconf. I patched it just
for completeness in the forthcoming cygwin package.)

Bruce Momjian schrieb:
> OK, patch attached and applied that casts _timezone to (int) on Cygwin.
> ---------------------------------------------------------------------------
>
> Reini Urban wrote:
>>Bruce Momjian schrieb:
>>
>>>Should I apply this change?
>>>
>>> #define TIMEZONE_GLOBAL ((int)_timezone)
>>
>>yes, please.
>>I have no time yet, to come up with the better patch. It's already monday.
>>
>>
>>>---------------------------------------------------------------------------
>>>
>>>Reini Urban wrote:
>>>
>>>
>>>>Bruce Momjian schrieb:
>>>>
>>>>
>>>>>Your patch highlighted several bugs in our code. First, I wasn't
>>>>>testing for CYGWIN in the backend pgport_palloc code. Second, I added
>>>>>an #undef to prevent compiler warnings. Third I added your Cygwin
>>>>>includes with an #ifdef. These will appear in beta2.
>>>>>
>>>>>On the timezone issue, I see this in dt.h:
>>>>>
>>>>> /* Global variable holding time zone information. */
>>>>> #if !defined(__CYGWIN__) && !defined(WIN32)
>>>>> #define TIMEZONE_GLOBAL timezone
>>>>> #else
>>>>> #define TIMEZONE_GLOBAL _timezone
>>>>> #define tzname _tzname /* should be in time.h? */
>>>>> #endif
>>>>>
>>>>>so are you saying your _timezone is time_t and not an int? Sometimes it
>>>>>is just a short because it is only minutes west of GMT, not an actually
>>>>>seconds since 1970 or anything. Making it time_t actually sounds like
>>>>>overkill, but we can work around that in dt.h if indeed that is how your
>>>>>OS defines it. The easiest fix would probably be to add the cast to int
>>>>>right in dt.h and only for Cygwin:
>>>>>
>>>>> #define TIMEZONE_GLOBAL ((int)_timezone)
>>>>>
>>>>>Does that work for you?
>>>>
>>>>yes, that's better.
>>>>
>>>>FYI /usr/include/time.h:
>>>>/* defines for the opengroup specifications Derived from Issue 1 of the
>>>>SVID. */
>>>>extern __IMPORT time_t _timezone;
>>>>...
>>>>
>>>>BTW: I see that CYGWIN also has a struct timezone in sys/time.h, but
>>>>configure didn't check for that.
>>>>I'll come with better patches after beta2.
>>>>
>>>>
>>>>
>>>>
>>>>>---------------------------------------------------------------------------
>>>>>
>>>>>Reini Urban wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Attached patches are required for cygwin:
>>>>>>
>>>>>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
>>>>>> * (postmaster/syslogger.c) struct timeval is
>>>>>> declared in sys/time.h, not in time.h
>>>>>>
>>>>>>2004-08-24 20:20:54 rurban:
>>>>>> * (port/dirmod.c) cygwin needs different header locations,
>>>>>> and unlink is a macro. There are no pgport_palloc
>>>>>> versions yet
>>>>>>
>>>>>>
>>>>>>timezone/pgtz.c:
>>>>>>Pending is a patch against postgresql-8.0.0beta1/config/c-library.m4:
>>>>>>PGAC_VAR_INT_TIMEZONE
>>>>>>
>>>>>>In the meantime I've hacked it with a cast from time_t to (int) in
>>>>>>timezone/pgtz.c: get_timezone_offset
>>>>>>
>>>>>>but timezone really is of time_t, not int. I don't know what you are
>>>>>>trying to do here.
>>>>>>
>>>>>>
>>>>>>There's on remaining issue for the cygwin build:
>>>>>>../../src/port/libpgport.a(dirmod.o)(.text+0x5ee):dirmod.c: undefined
>>>>>>reference to `__imp__CurrentMemoryContext'
>>>>>>../../src/port/libpgport.a(dirmod.o)(.text+0x64b):dirmod.c: undefined
>>>>>>reference to `__imp__CurrentMemoryContext'
>>>>>>
>>>>>>which explains the pgport_palloc problem.
>>>>>>--
>>>>>>Reini Urban
>>>>>>http://xarch.tu-graz.ac.at/home/rurban/
>>>>>>
>>>>>
>>>>>
>>>>>>2004-08-24 20:20:54 rurban:
>>>>>> * cygwin needs different header locations, and unlink is a macro
>>>>>> * There are no pgport_palloc versions yet
>>>>>>
>>>>>>--- postgresql-8.0.0beta1/src/port/dirmod.c.orig 2004-08-08 07:44:36.000000000 +0100
>>>>>>+++ postgresql-8.0.0beta1/src/port/dirmod.c 2004-08-24 19:20:56.557435000 +0100
>>>>>>@@ -33,16 +33,28 @@
>>>>>>
>>>>>>
>>>>>>#include "miscadmin.h"
>>>>>>+
>>>>>>+#ifdef __CYGWIN__
>>>>>>+#include <windows.h>
>>>>>>+#include <w32api/winioctl.h>
>>>>>>+#else
>>>>>>#include <winioctl.h>
>>>>>>+#undef unlink
>>>>>>+#endif
>>>>>>
>>>>>>#undef rename
>>>>>>-#undef unlink
>>>>>>
>>>>>>+/* 2004-08-24 20:20:54 rurban: There are no pgport_palloc versions yet */
>>>>>>+#if 0
>>>>>>#ifndef FRONTEND
>>>>>>+#undef palloc
>>>>>>+#undef pstrdup
>>>>>>+#undef pfree
>>>>>>#define palloc(sz) pgport_palloc(sz)
>>>>>>#define pstrdup(str) pgport_pstrdup(str)
>>>>>>#define pfree(pointer) pgport_pfree(pointer)
>>>>>>#endif
>>>>>>+#endif
>>>>>>
>>>>>>
>>>>>>/*
>>>>>
>>>>>
>>>>>>2004-08-24 21:23:53 rurban(at)x-ray(dot)at
>>>>>> * struct timeval is declared in sys/time.h, not in time.h
>>>>>>
>>>>>>--- postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c.orig 2004-08-06 20:17:31.000000000 +0100
>>>>>>+++ postgresql-8.0.0beta1/src/backend/postmaster/syslogger.c 2004-08-24 20:21:26.057851800 +0100
>>>>>>@@ -28,6 +28,7 @@
>>>>>>#include <signal.h>
>>>>>>#include <time.h>
>>>>>>#include <unistd.h>
>>>>>>+#include <sys/time.h>
>>>>>>#include <sys/stat.h>
>>>>>>
>>>>>>#include "libpq/pqsignal.h"
>>>>>
>>>>>
>>>>>>--- postgresql-8.0.0beta1/src/timezone/pgtz.c.orig 2004-07-31 20:12:15.000000000 +0100
>>>>>>+++ postgresql-8.0.0beta1/src/timezone/pgtz.c 2004-08-24 19:56:30.686367800 +0100
>>>>>>@@ -97,9 +97,9 @@
>>>>>> return tm->tm_gmtoff;
>>>>>>#elif defined(HAVE_INT_TIMEZONE)
>>>>>>#ifdef HAVE_UNDERSCORE_TIMEZONE
>>>>>>- return -_timezone;
>>>>>>+ return -(int)_timezone;
>>>>>>#else
>>>>>>- return -timezone;
>>>>>>+ return -(int)timezone;
>>>>>>#endif
>>>>>>#else
>>>>>>#error No way to determine TZ? Can this happen?
>>>>>
>>>>>
>>>>>>---------------------------(end of broadcast)---------------------------
>>>>>>TIP 9: the planner will ignore your desire to choose an index scan if your
>>>>>> joining column's datatypes do not match
>>>>>
>>>>>
>>>>>
>>>>>------------------------------------------------------------------------
>>>>>
>>>>>Index: src/backend/utils/mmgr/mcxt.c
>>>>>===================================================================
>>>>>RCS file: /cvsroot/pgsql-server/src/backend/utils/mmgr/mcxt.c,v
>>>>>retrieving revision 1.47
>>>>>diff -c -c -r1.47 mcxt.c
>>>>>*** src/backend/utils/mmgr/mcxt.c 8 Aug 2004 06:44:32 -0000 1.47
>>>>>--- src/backend/utils/mmgr/mcxt.c 29 Aug 2004 02:50:25 -0000
>>>>>***************
>>>>>*** 631,637 ****
>>>>> }
>>>>>
>>>>>
>>>>>! #ifdef WIN32
>>>>> /*
>>>>> * Memory support routines for libpgport on Win32
>>>>> *
>>>>>--- 631,637 ----
>>>>> }
>>>>>
>>>>>
>>>>>! #if defined(WIN32) || defined(__CYGWIN__)
>>>>> /*
>>>>> * Memory support routines for libpgport on Win32
>>>>> *
>>>>>***************
>>>>>*** 649,654 ****
>>>>>--- 649,655 ----
>>>>> return palloc(sz);
>>>>> }
>>>>>
>>>>>+
>>>>> char *
>>>>> pgport_pstrdup(const char *str)
>>>>> {
>>>>>Index: src/port/dirmod.c
>>>>>===================================================================
>>>>>RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
>>>>>retrieving revision 1.19
>>>>>diff -c -c -r1.19 dirmod.c
>>>>>*** src/port/dirmod.c 29 Aug 2004 01:44:02 -0000 1.19
>>>>>--- src/port/dirmod.c 29 Aug 2004 02:50:28 -0000
>>>>>***************
>>>>>*** 31,48 ****
>>>>>
>>>>> #if defined(WIN32) || defined(__CYGWIN__)
>>>>>
>>>>>-
>>>>> #include "miscadmin.h"
>>>>>- #include <winioctl.h>
>>>>>
>>>>> #undef rename
>>>>> #undef unlink
>>>>>
>>>>> #ifndef FRONTEND
>>>>> /*
>>>>> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
>>>>> * because of DLLIMPORT.
>>>>> */
>>>>> #define palloc(sz) pgport_palloc(sz)
>>>>> #define pstrdup(str) pgport_pstrdup(str)
>>>>> #define pfree(pointer) pgport_pfree(pointer)
>>>>>--- 31,57 ----
>>>>>
>>>>> #if defined(WIN32) || defined(__CYGWIN__)
>>>>>
>>>>> #include "miscadmin.h"
>>>>>
>>>>> #undef rename
>>>>> #undef unlink
>>>>>
>>>>>+ #ifdef __WIN32__
>>>>>+ #include <winioctl.h>
>>>>>+ #else
>>>>>+ /* __CYGWIN__ */
>>>>>+ #include <windows.h>
>>>>>+ #include <w32api/winioctl.h>
>>>>>+ #endif
>>>>>+
>>>>> #ifndef FRONTEND
>>>>> /*
>>>>> * Call non-macro versions of palloc, can't reference CurrentMemoryContext
>>>>> * because of DLLIMPORT.
>>>>> */
>>>>>+ #undef palloc
>>>>>+ #undef pstrdup
>>>>>+ #undef pfree
>>>>> #define palloc(sz) pgport_palloc(sz)
>>>>> #define pstrdup(str) pgport_pstrdup(str)
>>>>> #define pfree(pointer) pgport_pfree(pointer)
>>>>
>>>>
>>>>--
>>>>Reini Urban
>>>>http://xarch.tu-graz.ac.at/home/rurban/
>>>>
>>>>---------------------------(end of broadcast)---------------------------
>>>>TIP 4: Don't 'kill -9' the postmaster
>>>>
>>>
>>>
>>
>>--
>>Reini Urban
>>http://xarch.tu-graz.ac.at/home/rurban/
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 8: explain analyze is your friend
>>
>
>
>
> ------------------------------------------------------------------------
>
> Index: src/interfaces/ecpg/pgtypeslib/dt.h
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/pgtypeslib/dt.h,v
> retrieving revision 1.17
> diff -c -c -r1.17 dt.h
> *** src/interfaces/ecpg/pgtypeslib/dt.h 19 Jan 2004 19:04:40 -0000 1.17
> --- src/interfaces/ecpg/pgtypeslib/dt.h 1 Sep 2004 04:00:49 -0000
> ***************
> *** 220,226 ****
> --- 220,230 ----
> #if !defined(__CYGWIN__) && !defined(WIN32)
> #define TIMEZONE_GLOBAL timezone
> #else
> + #if defined(WIN32)
> #define TIMEZONE_GLOBAL _timezone
> + #else
> + #define TIMEZONE_GLOBAL ((int)_timezone) /* time_t on Cywgin */
> + #endif
> #define tzname _tzname /* should be in time.h? */
> #endif
>

--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

Attachment Content-Type Size
pgtz.patch text/plain 4.6 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [PATCHES] time_t timezone
Date: 2004-09-01 04:55:19
Message-ID: 1100.1094014519@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini Urban <rurban(at)x-ray(dot)at> writes:
> Added configure time_t timezone check for the SUSV definition.

Kindly do not claim that this is per SUS spec.

http://www.opengroup.org/onlinepubs/007908799/xsh/timezone.html

regards, tom lane


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 06:50:58
Message-ID: 41357152.5010709@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Tom Lane schrieb:
> Reini Urban <rurban(at)x-ray(dot)at> writes:
>>Added configure time_t timezone check for the SUSV definition.
>
> Kindly do not claim that this is per SUS spec.
>
> http://www.opengroup.org/onlinepubs/007908799/xsh/timezone.html

oops! sorry :(

--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 13:05:34
Message-ID: 200409011305.i81D5Yo08497@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches


I am inclined to leave the #ifdef Cygwin test in the code rather than
add a configure check.

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

Reini Urban wrote:
> Tom Lane schrieb:
> > Reini Urban <rurban(at)x-ray(dot)at> writes:
> >>Added configure time_t timezone check for the SUSV definition.
> >
> > Kindly do not claim that this is per SUS spec.
> >
> > http://www.opengroup.org/onlinepubs/007908799/xsh/timezone.html
>
> oops! sorry :(
>
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 14:47:16
Message-ID: 4135E0F4.3050101@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Bruce Momjian schrieb:
> I am inclined to leave the #ifdef Cygwin test in the code rather than
> add a configure check.

No,
There are a lot of other systems with time_t timezone!

newlib explains it like this:
/* defines for the opengroup specifications Derived from Issue 1 of the
SVID. */
extern __IMPORT time_t _timezone;
extern __IMPORT int _daylight;
extern __IMPORT char *_tzname[2];

SVID (System V Interface Definition) seems to be an interesting spec,
which I found here:
http://www.caldera.com/developers/devspecs/vol1a.pdf
(nothing about the type of timezone though)

But the time_t timezone issue is here:
"XSHd7 Aardvark Change Request Report"
http://www.opengroup.org/austin/docs/austin_97.txt
(ERN 20 Accept as marked, page 1177)

SUSV2 only defines it as long int
http://www.opengroup.org/onlinepubs/007908799/xsh/timezone.html

Caldera, redhat and IRIX 6.2 at least use time_t
http://uw713doc.sco.com/en/man/html.3C/ctime.3C.html

http://www.opensource.apple.com/darwinsource/10.0.4/tcl-3.1/tcl/unix/tcl.m4

Please google for "time_t timezone" and the accompanying autoconf .m4
files. tcl.m4 could be quite useful, if you don't like my hack.
php also uses time_t and not long int.

PS: For compatibility newlib has:
#ifdef __CYGWIN__
#ifdef timezonevar
#ifndef timezone
#define timezone ((long int) _timezone)
#endif
#endif

Looks like we only have to define timezonevar in our hint,
eh Makefile.port, but then the other platforms will loose.

> ---------------------------------------------------------------------------
>
> Reini Urban wrote:
>>Tom Lane schrieb:
>>>Reini Urban <rurban(at)x-ray(dot)at> writes:
>>>
>>>>Added configure time_t timezone check for the SUSV definition.
>>>
>>>Kindly do not claim that this is per SUS spec.
>>>http://www.opengroup.org/onlinepubs/007908799/xsh/timezone.html
>>
>>oops! sorry :(
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 15:03:57
Message-ID: 6696.1094051037@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini Urban <rurban(at)x-ray(dot)at> writes:
> But the time_t timezone issue is here:
> "XSHd7 Aardvark Change Request Report"
> http://www.opengroup.org/austin/docs/austin_97.txt
> (ERN 20 Accept as marked, page 1177)

There is nothing whatever on that page about the datatype of the
timezone variable.

> Caldera, redhat and IRIX 6.2 at least use time_t
> http://uw713doc.sco.com/en/man/html.3C/ctime.3C.html

Red Hat certainly does not:

[tgl(at)rh1 include]$ grep timezone /usr/include/*h
/usr/include/time.h: of *TIMER in the local timezone. */
/usr/include/time.h:extern char *__tzname[2]; /* Current timezone names. */
/usr/include/time.h:extern long int __timezone; /* Seconds west of UTC. */
/usr/include/time.h:extern long int timezone;
[tgl(at)rh1 include]$

But what may be more to the point is that AFAICS we make no assumption
about the exact datatype of the timezone variable. So long as it is
some signed integer type (which surely it must be), the code will work.
I see no reason to add a configure test to test something we do not care
about.

regards, tom lane


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 16:12:22
Message-ID: 4135F4E6.6020900@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Tom Lane schrieb:
> Reini Urban <rurban(at)x-ray(dot)at> writes:
>
>>But the time_t timezone issue is here:
>> "XSHd7 Aardvark Change Request Report"
>> http://www.opengroup.org/austin/docs/austin_97.txt
>>(ERN 20 Accept as marked, page 1177)
>
> There is nothing whatever on that page about the datatype of the
> timezone variable.

"1) in POSIX, the time_t value is always related to local time by
the "seconds since the Epoch" expression and the timezone
information."

Yes, they are talking about the localtime return value,
but nevertheless the newlib folks refer to that. Their fault.

Should I discuss that with them? I will not do that.
newlib is happening in the real world, standards just a general
consensus, how it should happen.
If some other platforms use newlib, you are lost with the make abort.

>>Caldera, redhat and IRIX 6.2 at least use time_t
>> http://uw713doc.sco.com/en/man/html.3C/ctime.3C.html
>
> Red Hat certainly does not:
>
> [tgl(at)rh1 include]$ grep timezone /usr/include/*h
> /usr/include/time.h: of *TIMER in the local timezone. */
> /usr/include/time.h:extern char *__tzname[2]; /* Current timezone names. */
> /usr/include/time.h:extern long int __timezone; /* Seconds west of UTC. */
> /usr/include/time.h:extern long int timezone;
> [tgl(at)rh1 include]$

dertainly depends which redhat. I have no redhat around and newlib is
quite new. This pgtz timezone code is also quite new.

> But what may be more to the point is that AFAICS we make no assumption
> about the exact datatype of the timezone variable. So long as it is
> some signed integer type (which surely it must be), the code will work.
> I see no reason to add a configure test to test something we do not care
> about.

Bruce' patch only assumes time_t on CYGWIN and it is only for pgtypeslib
(src/interfaces/ecpg/pgtypeslib/dt.h). Not for src/timezone/pgtz.c

Fact is: src/timezone/pgtz.c does not compile on cygwin,
and will not compile on any other similar platform, as I saw from
googling around, unless it is checked in configure.in or
- the dirty way - casted away in src/timezone/pgtz.c and the .m4 macro.

Since the current configure check does not define HAVE_INT_TIMEZONE (not
casted there, so it fails), the whole pgtz #ifdef branch will abort.

http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/timezone/pgtz.c?rev=HEAD;content-type=text%2Fx-cvsweb-markup
and
http://developer.postgresql.org/cvsweb.cgi/pgsql-server/config/c-library.m4?rev=HEAD;content-type=text%2Fx-cvsweb-markup
are wrong without the cast.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 16:29:13
Message-ID: 7612.1094056153@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini Urban <rurban(at)x-ray(dot)at> writes:
> Yes, they are talking about the localtime return value,
> but nevertheless the newlib folks refer to that. Their fault.

> Should I discuss that with them?

Probably. They have a gratuitous variation from the Single Unix Spec.

>> But what may be more to the point is that AFAICS we make no assumption
>> about the exact datatype of the timezone variable.

> Bruce' patch only assumes time_t on CYGWIN and it is only for pgtypeslib
> (src/interfaces/ecpg/pgtypeslib/dt.h). Not for src/timezone/pgtz.c

Per my recent post in pghackers, I think that the datatype has nothing
to do with it anyway. The real problem is the loss of this code that
was in pg_config_manual.h in 7.4 and before:

/*
* Define this if your operating system has _timezone rather than timezone
*/
#if defined(__CYGWIN__) || defined(WIN32)
#define HAVE_INT_TIMEZONE /* has int _timezone */
#define HAVE_UNDERSCORE_TIMEZONE 1
#endif

I'm inclined to just put it back, rather than adding a configure test
that we never needed before.

regards, tom lane


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 21:10:18
Message-ID: 41363ABA.6050403@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg윈 토토SQL Postg무지개 토토SQL

Tom Lane schrieb:
> Reini Urban <rurban(at)x-ray(dot)at> writes:
>>Yes, they are talking about the localtime return value,
>>but nevertheless the newlib folks refer to that. Their fault.
>
>>Should I discuss that with them?
>
> Probably. They have a gratuitous variation from the Single Unix Spec.
>
>>>But what may be more to the point is that AFAICS we make no assumption
>>>about the exact datatype of the timezone variable.
>
>>Bruce' patch only assumes time_t on CYGWIN and it is only for pgtypeslib
>>(src/interfaces/ecpg/pgtypeslib/dt.h). Not for src/timezone/pgtz.c

> Per my recent post in pghackers, I think that the datatype has nothing
> to do with it anyway. The real problem is the loss of this code that
> was in pg_config_manual.h in 7.4 and before:
>
> /*
> * Define this if your operating system has _timezone rather than timezone
> */
> #if defined(__CYGWIN__) || defined(WIN32)
> #define HAVE_INT_TIMEZONE /* has int _timezone */
> #define HAVE_UNDERSCORE_TIMEZONE 1
> #endif
>
> I'm inclined to just put it back, rather than adding a configure test
> that we never needed before.

Fine with me. I'm just doing the cygwin packaging.
And I can apply my cast to the pgtz.c code by myself also.
But upstream would be better.

I just wanted that you are aware of that. The configure test was more
general and similar to other packages (tcl, php).
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Reini Urban <rurban(at)x-ray(dot)at>, pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-01 21:45:21
Message-ID: 200409012145.i81LjLO19100@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Tom Lane wrote:
> Reini Urban <rurban(at)x-ray(dot)at> writes:
> > Yes, they are talking about the localtime return value,
> > but nevertheless the newlib folks refer to that. Their fault.
>
> > Should I discuss that with them?
>
> Probably. They have a gratuitous variation from the Single Unix Spec.
>
> >> But what may be more to the point is that AFAICS we make no assumption
> >> about the exact datatype of the timezone variable.
>
> > Bruce' patch only assumes time_t on CYGWIN and it is only for pgtypeslib
> > (src/interfaces/ecpg/pgtypeslib/dt.h). Not for src/timezone/pgtz.c
>
> Per my recent post in pghackers, I think that the datatype has nothing
> to do with it anyway. The real problem is the loss of this code that
> was in pg_config_manual.h in 7.4 and before:
>
> /*
> * Define this if your operating system has _timezone rather than timezone
> */
> #if defined(__CYGWIN__) || defined(WIN32)
> #define HAVE_INT_TIMEZONE /* has int _timezone */
> #define HAVE_UNDERSCORE_TIMEZONE 1
> #endif
>
> I'm inclined to just put it back, rather than adding a configure test
> that we never needed before.

OK, I backed out the int cast I had made for dt.h. I agree time_t
should cast to int naturally. I noticed that HAVE_INT_TIMEZONE is
already a configure test. Is that test not working on Cygwin? Seems it
is working on MinGW. The test is this:

# PGAC_VAR_INT_TIMEZONE
# ---------------------
# Check if the global variable `timezone' exists. If so, define
# HAVE_INT_TIMEZONE.
AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
[AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
[AC_TRY_LINK([#include <time.h>
int res;],
[res = timezone / 60;],
[pgac_cv_var_int_timezone=yes],
[pgac_cv_var_int_timezone=no])])
if test x"$pgac_cv_var_int_timezone" = xyes ; then
AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global
variable 'int timezone'.])
fi])# PGAC_VAR_INT_TIMEZONE

You can look in include/pg_config.h to see how it is defined.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-02 06:44:28
Message-ID: 4136C14C.7000401@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Bruce Momjian schrieb:
> Tom Lane wrote:
>>Reini Urban <rurban(at)x-ray(dot)at> writes:
>>
>>>Yes, they are talking about the localtime return value,
>>>but nevertheless the newlib folks refer to that. Their fault.
>>
>>>Should I discuss that with them?
>>
>>Probably. They have a gratuitous variation from the Single Unix Spec.
>>
>>>>But what may be more to the point is that AFAICS we make no assumption
>>>>about the exact datatype of the timezone variable.
>>
>>>Bruce' patch only assumes time_t on CYGWIN and it is only for pgtypeslib
>>>(src/interfaces/ecpg/pgtypeslib/dt.h). Not for src/timezone/pgtz.c
>>
>>Per my recent post in pghackers, I think that the datatype has nothing
>>to do with it anyway. The real problem is the loss of this code that
>>was in pg_config_manual.h in 7.4 and before:
>>
>>/*
>> * Define this if your operating system has _timezone rather than timezone
>> */
>>#if defined(__CYGWIN__) || defined(WIN32)
>>#define HAVE_INT_TIMEZONE /* has int _timezone */
>>#define HAVE_UNDERSCORE_TIMEZONE 1
>>#endif
>>
>>I'm inclined to just put it back, rather than adding a configure test
>>that we never needed before.
>
> OK, I backed out the int cast I had made for dt.h. I agree time_t
> should cast to int naturally. I noticed that HAVE_INT_TIMEZONE is
> already a configure test. Is that test not working on Cygwin? Seems it
> is working on MinGW. The test is this:
>
> # PGAC_VAR_INT_TIMEZONE
> # ---------------------
> # Check if the global variable `timezone' exists. If so, define
> # HAVE_INT_TIMEZONE.
> AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
> [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
> [AC_TRY_LINK([#include <time.h>
> int res;],
> [res = timezone / 60;],
> [pgac_cv_var_int_timezone=yes],
> [pgac_cv_var_int_timezone=no])])
> if test x"$pgac_cv_var_int_timezone" = xyes ; then
> AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global
> variable 'int timezone'.])
> fi])# PGAC_VAR_INT_TIMEZONE
>
> You can look in include/pg_config.h to see how it is defined.

This test fails, because you cannot do arithmetic with time_t.
cygwin has/had a special workaround in pg_config_manual.h
See Tom above.

All other platforms with time_t timezone should manually enable their
HAVE_INT_TIMEZONE and manually add the (int) timezone in
src/timezone/pgtz.c.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-02 13:43:04
Message-ID: 19159.1094132584@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini Urban <rurban(at)x-ray(dot)at> writes:
> This test fails, because you cannot do arithmetic with time_t.

You apparently speak some different flavor of C than the rest of us.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-02 14:04:07
Message-ID: 200409021404.i82E47Z10537@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Reini Urban wrote:
> > # PGAC_VAR_INT_TIMEZONE
> > # ---------------------
> > # Check if the global variable `timezone' exists. If so, define
> > # HAVE_INT_TIMEZONE.
> > AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
> > [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
> > [AC_TRY_LINK([#include <time.h>
> > int res;],
> > [res = timezone / 60;],
> > [pgac_cv_var_int_timezone=yes],
> > [pgac_cv_var_int_timezone=no])])
> > if test x"$pgac_cv_var_int_timezone" = xyes ; then
> > AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global
> > variable 'int timezone'.])
> > fi])# PGAC_VAR_INT_TIMEZONE
> >
> > You can look in include/pg_config.h to see how it is defined.
>
> This test fails, because you cannot do arithmetic with time_t.
> cygwin has/had a special workaround in pg_config_manual.h
> See Tom above.
>
> All other platforms with time_t timezone should manually enable their
> HAVE_INT_TIMEZONE and manually add the (int) timezone in
> src/timezone/pgtz.c.

OK, let's get some facts. How is your timezone variable defined in your
headers? Is it _timezone? How is time_t defined? If you take the
program above and compile it alone, how does it fail?

Also, look at your config.log output to see why it fails or email it to
my privately.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Reini Urban <rurban(at)x-ray(dot)at>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-03 09:21:25
Message-ID: 41383795.1030702@x-ray.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches

Bruce Momjian schrieb:

> Reini Urban wrote:
>
>>> # PGAC_VAR_INT_TIMEZONE
>>> # ---------------------
>>> # Check if the global variable `timezone' exists. If so, define
>>> # HAVE_INT_TIMEZONE.
>>> AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
>>> [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
>>> [AC_TRY_LINK([#include <time.h>
>>> int res;],
>>> [res = timezone / 60;],
>>> [pgac_cv_var_int_timezone=yes],
>>> [pgac_cv_var_int_timezone=no])])
>>> if test x"$pgac_cv_var_int_timezone" = xyes ; then
>>> AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global
>>> variable 'int timezone'.])
>>> fi])# PGAC_VAR_INT_TIMEZONE
>>>
>>>You can look in include/pg_config.h to see how it is defined.
>>
>>This test fails, because you cannot do arithmetic with time_t.
>>cygwin has/had a special workaround in pg_config_manual.h
>>See Tom above.

sorry, my mistake. you can do arithmetic with time_t.

>>All other platforms with time_t timezone should manually enable their
>>HAVE_INT_TIMEZONE and manually add the (int) timezone in
>>src/timezone/pgtz.c.
>
> OK, let's get some facts. How is your timezone variable defined in your
> headers? Is it _timezone? How is time_t defined? If you take the
> program above and compile it alone, how does it fail?

yes, it's only _timezone.

already sent to this list. here it is:

/usr/include/time.h from newlib.
...
/* defines for the opengroup specifications Derived from Issue 1 of the
SVID. */
extern __IMPORT time_t _timezone;
extern __IMPORT int _daylight;
extern __IMPORT char *_tzname[2];

which resolves to (gcc -E):
# 98 "/usr/include/time.h" 3 4
extern __attribute__((dllimport)) time_t _timezone;
extern __attribute__((dllimport)) int _daylight;
extern __attribute__((dllimport)) char *_tzname[2];

time_t is a typedef from sys/types.h:
#ifndef __time_t_defined
typedef _TIME_T_ time_t;
#define __time_t_defined

_TIME_T_ is a macro from machine/types.h:
define _TIME_T_ long

> Also, look at your config.log output to see why it fails or email it to
> my privately.
...
configure:12843: checking for int timezone
configure:12865: gcc -o conftest.exe -O2 -fno-strict-aliasing -Wall
-Wmissing-prototypes -Wmissing-declarations -fno-strict-aliasing
-L/usr/local/lib conftest.c -lssl -lcrypto -lz -lreadline -lcrypt
-lresolv -lm >&5
conftest.c: In function `main':
conftest.c:67: error: invalid operands to binary /
configure:12871: $? = 1
configure: failed program was:
...

#include <time.h>
int res;
int
main ()
{
res = timezone / 60;
;
return 0;
}

so my patch and my whole point is wrong.
just the underscore is needed for cygwin in pg_config_manual.h
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Reini Urban <rurban(at)x-ray(dot)at>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-08 19:40:28
Message-ID: 200409081940.i88JeS514536@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches


OK, I have applied the following patch to fix the Cygwin _timezone
issue. I moved the TIMEZONE_GLOBAL up into port.h and change pgtz.c to
use that instead. I also changed the configure test for INT_TIMEZONE to
test for _timezone on Cygwin. This should fix all those problems.

You found a few problems in dirmod.c but have run out of time and will
deal with them in a few days.

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

Reini Urban wrote:
> Bruce Momjian schrieb:
>
> > Reini Urban wrote:
> >
> >>> # PGAC_VAR_INT_TIMEZONE
> >>> # ---------------------
> >>> # Check if the global variable `timezone' exists. If so, define
> >>> # HAVE_INT_TIMEZONE.
> >>> AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
> >>> [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
> >>> [AC_TRY_LINK([#include <time.h>
> >>> int res;],
> >>> [res = timezone / 60;],
> >>> [pgac_cv_var_int_timezone=yes],
> >>> [pgac_cv_var_int_timezone=no])])
> >>> if test x"$pgac_cv_var_int_timezone" = xyes ; then
> >>> AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global
> >>> variable 'int timezone'.])
> >>> fi])# PGAC_VAR_INT_TIMEZONE
> >>>
> >>>You can look in include/pg_config.h to see how it is defined.
> >>
> >>This test fails, because you cannot do arithmetic with time_t.
> >>cygwin has/had a special workaround in pg_config_manual.h
> >>See Tom above.
>
> sorry, my mistake. you can do arithmetic with time_t.
>
> >>All other platforms with time_t timezone should manually enable their
> >>HAVE_INT_TIMEZONE and manually add the (int) timezone in
> >>src/timezone/pgtz.c.
> >
> > OK, let's get some facts. How is your timezone variable defined in your
> > headers? Is it _timezone? How is time_t defined? If you take the
> > program above and compile it alone, how does it fail?
>
> yes, it's only _timezone.
>
> already sent to this list. here it is:
>
> /usr/include/time.h from newlib.
> ...
> /* defines for the opengroup specifications Derived from Issue 1 of the
> SVID. */
> extern __IMPORT time_t _timezone;
> extern __IMPORT int _daylight;
> extern __IMPORT char *_tzname[2];
>
> which resolves to (gcc -E):
> # 98 "/usr/include/time.h" 3 4
> extern __attribute__((dllimport)) time_t _timezone;
> extern __attribute__((dllimport)) int _daylight;
> extern __attribute__((dllimport)) char *_tzname[2];
>
> time_t is a typedef from sys/types.h:
> #ifndef __time_t_defined
> typedef _TIME_T_ time_t;
> #define __time_t_defined
>
> _TIME_T_ is a macro from machine/types.h:
> define _TIME_T_ long
>
> > Also, look at your config.log output to see why it fails or email it to
> > my privately.
> ...
> configure:12843: checking for int timezone
> configure:12865: gcc -o conftest.exe -O2 -fno-strict-aliasing -Wall
> -Wmissing-prototypes -Wmissing-declarations -fno-strict-aliasing
> -L/usr/local/lib conftest.c -lssl -lcrypto -lz -lreadline -lcrypt
> -lresolv -lm >&5
> conftest.c: In function `main':
> conftest.c:67: error: invalid operands to binary /
> configure:12871: $? = 1
> configure: failed program was:
> ...
>
> #include <time.h>
> int res;
> int
> main ()
> {
> res = timezone / 60;
> ;
> return 0;
> }
>
> so my patch and my whole point is wrong.
> just the underscore is needed for cygwin in pg_config_manual.h
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 3.6 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Reini Urban <rurban(at)x-ray(dot)at>, pgsql-patches(at)postgresql(dot)org
Subject: Re: time_t timezone
Date: 2004-09-09 00:23:38
Message-ID: 200409090023.i890NcE12555@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-cygwin pgsql-patches


I have done the same cleanup for _tzname for clarity and because some
files were using tzname as local variable names (pgtz.c).

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

Bruce Momjian wrote:
>
> OK, I have applied the following patch to fix the Cygwin _timezone
> issue. I moved the TIMEZONE_GLOBAL up into port.h and change pgtz.c to
> use that instead. I also changed the configure test for INT_TIMEZONE to
> test for _timezone on Cygwin. This should fix all those problems.
>
> You found a few problems in dirmod.c but have run out of time and will
> deal with them in a few days.
>
> ---------------------------------------------------------------------------
>
> Reini Urban wrote:
> > Bruce Momjian schrieb:
> >
> > > Reini Urban wrote:
> > >
> > >>> # PGAC_VAR_INT_TIMEZONE
> > >>> # ---------------------
> > >>> # Check if the global variable `timezone' exists. If so, define
> > >>> # HAVE_INT_TIMEZONE.
> > >>> AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
> > >>> [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
> > >>> [AC_TRY_LINK([#include <time.h>
> > >>> int res;],
> > >>> [res = timezone / 60;],
> > >>> [pgac_cv_var_int_timezone=yes],
> > >>> [pgac_cv_var_int_timezone=no])])
> > >>> if test x"$pgac_cv_var_int_timezone" = xyes ; then
> > >>> AC_DEFINE(HAVE_INT_TIMEZONE,, [Define to 1 if you have the global
> > >>> variable 'int timezone'.])
> > >>> fi])# PGAC_VAR_INT_TIMEZONE
> > >>>
> > >>>You can look in include/pg_config.h to see how it is defined.
> > >>
> > >>This test fails, because you cannot do arithmetic with time_t.
> > >>cygwin has/had a special workaround in pg_config_manual.h
> > >>See Tom above.
> >
> > sorry, my mistake. you can do arithmetic with time_t.
> >
> > >>All other platforms with time_t timezone should manually enable their
> > >>HAVE_INT_TIMEZONE and manually add the (int) timezone in
> > >>src/timezone/pgtz.c.
> > >
> > > OK, let's get some facts. How is your timezone variable defined in your
> > > headers? Is it _timezone? How is time_t defined? If you take the
> > > program above and compile it alone, how does it fail?
> >
> > yes, it's only _timezone.
> >
> > already sent to this list. here it is:
> >
> > /usr/include/time.h from newlib.
> > ...
> > /* defines for the opengroup specifications Derived from Issue 1 of the
> > SVID. */
> > extern __IMPORT time_t _timezone;
> > extern __IMPORT int _daylight;
> > extern __IMPORT char *_tzname[2];
> >
> > which resolves to (gcc -E):
> > # 98 "/usr/include/time.h" 3 4
> > extern __attribute__((dllimport)) time_t _timezone;
> > extern __attribute__((dllimport)) int _daylight;
> > extern __attribute__((dllimport)) char *_tzname[2];
> >
> > time_t is a typedef from sys/types.h:
> > #ifndef __time_t_defined
> > typedef _TIME_T_ time_t;
> > #define __time_t_defined
> >
> > _TIME_T_ is a macro from machine/types.h:
> > define _TIME_T_ long
> >
> > > Also, look at your config.log output to see why it fails or email it to
> > > my privately.
> > ...
> > configure:12843: checking for int timezone
> > configure:12865: gcc -o conftest.exe -O2 -fno-strict-aliasing -Wall
> > -Wmissing-prototypes -Wmissing-declarations -fno-strict-aliasing
> > -L/usr/local/lib conftest.c -lssl -lcrypto -lz -lreadline -lcrypt
> > -lresolv -lm >&5
> > conftest.c: In function `main':
> > conftest.c:67: error: invalid operands to binary /
> > configure:12871: $? = 1
> > configure: failed program was:
> > ...
> >
> > #include <time.h>
> > int res;
> > int
> > main ()
> > {
> > res = timezone / 60;
> > ;
> > return 0;
> > }
> >
> > so my patch and my whole point is wrong.
> > just the underscore is needed for cygwin in pg_config_manual.h
> > --
> > Reini Urban
> > http://xarch.tu-graz.ac.at/home/rurban/
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073

> Index: configure
> ===================================================================
> RCS file: /cvsroot/pgsql-server/configure,v
> retrieving revision 1.389
> diff -c -c -r1.389 configure
> *** configure 2 Sep 2004 20:39:57 -0000 1.389
> --- configure 8 Sep 2004 19:36:18 -0000
> ***************
> *** 10725,10731 ****
> --- 10725,10735 ----
> int
> main ()
> {
> + #ifndef __CYGWIN__
> res = timezone / 60;
> + #else
> + res = _timezone / 60;
> + #endif
> ;
> return 0;
> }
> Index: config/c-library.m4
> ===================================================================
> RCS file: /cvsroot/pgsql-server/config/c-library.m4,v
> retrieving revision 1.26
> diff -c -c -r1.26 c-library.m4
> *** config/c-library.m4 7 Jun 2004 22:39:44 -0000 1.26
> --- config/c-library.m4 8 Sep 2004 19:36:19 -0000
> ***************
> *** 10,16 ****
> [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
> [AC_TRY_LINK([#include <time.h>
> int res;],
> ! [res = timezone / 60;],
> [pgac_cv_var_int_timezone=yes],
> [pgac_cv_var_int_timezone=no])])
> if test x"$pgac_cv_var_int_timezone" = xyes ; then
> --- 10,20 ----
> [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
> [AC_TRY_LINK([#include <time.h>
> int res;],
> ! [#ifndef __CYGWIN__
> ! res = timezone / 60;
> ! #else
> ! res = _timezone / 60;
> ! #endif],
> [pgac_cv_var_int_timezone=yes],
> [pgac_cv_var_int_timezone=no])])
> if test x"$pgac_cv_var_int_timezone" = xyes ; then
> Index: src/include/port.h
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/include/port.h,v
> retrieving revision 1.57
> diff -c -c -r1.57 port.h
> *** src/include/port.h 29 Aug 2004 21:08:48 -0000 1.57
> --- src/include/port.h 8 Sep 2004 19:36:26 -0000
> ***************
> *** 180,185 ****
> --- 180,193 ----
> #define pclose(a) _pclose(a)
> #endif
>
> + /* Global variable holding time zone information. */
> + #if !defined(__CYGWIN__)
> + #define TIMEZONE_GLOBAL timezone
> + #else
> + #define TIMEZONE_GLOBAL _timezone
> + #define tzname _tzname /* should be in time.h? */
> + #endif
> +
> extern int copydir(char *fromdir, char *todir);
>
> /* Missing rand functions */
> Index: src/interfaces/ecpg/pgtypeslib/dt.h
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/pgtypeslib/dt.h,v
> retrieving revision 1.19
> diff -c -c -r1.19 dt.h
> *** src/interfaces/ecpg/pgtypeslib/dt.h 1 Sep 2004 18:59:35 -0000 1.19
> --- src/interfaces/ecpg/pgtypeslib/dt.h 8 Sep 2004 19:36:28 -0000
> ***************
> *** 216,229 ****
> } while(0)
> #endif
>
> - /* Global variable holding time zone information. */
> - #if !defined(__CYGWIN__) && !defined(WIN32)
> - #define TIMEZONE_GLOBAL timezone
> - #else
> - #define TIMEZONE_GLOBAL _timezone
> - #define tzname _tzname /* should be in time.h? */
> - #endif
> -
> /*
> * Date/time validation
> * Include check for leap year.
> --- 216,221 ----
> Index: src/timezone/pgtz.c
> ===================================================================
> RCS file: /cvsroot/pgsql-server/src/timezone/pgtz.c,v
> retrieving revision 1.27
> diff -c -c -r1.27 pgtz.c
> *** src/timezone/pgtz.c 2 Sep 2004 01:15:06 -0000 1.27
> --- src/timezone/pgtz.c 8 Sep 2004 19:36:33 -0000
> ***************
> *** 96,106 ****
> #if defined(HAVE_STRUCT_TM_TM_ZONE)
> return tm->tm_gmtoff;
> #elif defined(HAVE_INT_TIMEZONE)
> ! #ifdef HAVE_UNDERSCORE_TIMEZONE
> ! return -_timezone;
> ! #else
> ! return -timezone;
> ! #endif
> #else
> #error No way to determine TZ? Can this happen?
> #endif
> --- 96,102 ----
> #if defined(HAVE_STRUCT_TM_TM_ZONE)
> return tm->tm_gmtoff;
> #elif defined(HAVE_INT_TIMEZONE)
> ! return -TIMEZONE_GLOBAL;
> #else
> #error No way to determine TZ? Can this happen?
> #endif

>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 2.7 KB