Re: fetchnews.c: invalid operands to binary

2006-04-10 Thread Antoine Jacoutot

On Mon, 10 Apr 2006, Ken Murchison wrote:

try this patch:

https://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/cyrus/imap/fetchnews.c.diff?r1=1.14&r2=1.15&f=u


It now compiles great :)
Thanks so much for fixing this.

Let me know if you need more testing or anything.

Regards,

--
Antoine
k

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-10 Thread Ken Murchison

Ken Murchison wrote:

Gabor Gombas wrote:

On Mon, Apr 10, 2006 at 02:20:08PM +0200, Antoine Jacoutot wrote:


Back to this thread again.
So, after chatting with some OpenBSD devs, the included patch should 
fix the

issue.
It would be nice to officialy include it, if the fix is OK with you 
(and maybe

with an #ifdef in case it only applies to OpenBSD).


The glibc documentation says: "The `tm_gmtoff' field is derived from BSD
and is a GNU library extension; it is not visible in a strict ISO C
environment." So it should be OK for Linux and *BSD, but may still need
an autoconf feature test for other platforms.

Also, the meaning of tm_gmtoff is not the same as the global timezone
variable:

 -- Variable: long int timezone
 [...]
Unlike the `tm_gmtoff' member of the broken-down time structure,
this value is not adjusted for daylight saving, and its sign is
reversed.  In GNU programs it is better to use `tm_gmtoff',
since it contains the correct offset even when it is not the
latest one.


I have a portable fix that I am working on right now.


try this patch:

https://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/cyrus/imap/fetchnews.c.diff?r1=1.14&r2=1.15&f=u


--
Kenneth Murchison
Systems Programmer
Project Cyrus Developer/Maintainer
Carnegie Mellon University

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-10 Thread Antoine Jacoutot
Selon Ken Murchison <[EMAIL PROTECTED]>:
> I have a portable fix that I am working on right now.

Fantastic :)
Thanks!

-- 
Antoine

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-10 Thread Ken Murchison

Gabor Gombas wrote:

On Mon, Apr 10, 2006 at 02:20:08PM +0200, Antoine Jacoutot wrote:


Back to this thread again.
So, after chatting with some OpenBSD devs, the included patch should fix the
issue.
It would be nice to officialy include it, if the fix is OK with you (and maybe
with an #ifdef in case it only applies to OpenBSD).


The glibc documentation says: "The `tm_gmtoff' field is derived from BSD
and is a GNU library extension; it is not visible in a strict ISO C
environment." So it should be OK for Linux and *BSD, but may still need
an autoconf feature test for other platforms.

Also, the meaning of tm_gmtoff is not the same as the global timezone
variable:

 -- Variable: long int timezone
 [...]
Unlike the `tm_gmtoff' member of the broken-down time structure,
this value is not adjusted for daylight saving, and its sign is
reversed.  In GNU programs it is better to use `tm_gmtoff',
since it contains the correct offset even when it is not the
latest one.


I have a portable fix that I am working on right now.

--
Kenneth Murchison
Systems Programmer
Project Cyrus Developer/Maintainer
Carnegie Mellon University

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-10 Thread Gabor Gombas
On Mon, Apr 10, 2006 at 02:20:08PM +0200, Antoine Jacoutot wrote:

> Back to this thread again.
> So, after chatting with some OpenBSD devs, the included patch should fix the
> issue.
> It would be nice to officialy include it, if the fix is OK with you (and maybe
> with an #ifdef in case it only applies to OpenBSD).

The glibc documentation says: "The `tm_gmtoff' field is derived from BSD
and is a GNU library extension; it is not visible in a strict ISO C
environment." So it should be OK for Linux and *BSD, but may still need
an autoconf feature test for other platforms.

Also, the meaning of tm_gmtoff is not the same as the global timezone
variable:

 -- Variable: long int timezone
 [...]
Unlike the `tm_gmtoff' member of the broken-down time structure,
this value is not adjusted for daylight saving, and its sign is
reversed.  In GNU programs it is better to use `tm_gmtoff',
since it contains the correct offset even when it is not the
latest one.

Gabor

-- 
 -
 MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
 -

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-10 Thread Antoine Jacoutot
Selon Ken Murchison <[EMAIL PROTECTED]>:
> Antoine Jacoutot wrote:
> > Selon Ken Murchison <[EMAIL PROTECTED]>:
> >> I'm told that OpenBSD might not have a timezone variable, but timezone()
> >> is a function instead.  If this is the case, my fix will not do what you
> >> want.
> >
> > Thanks a lot for the warning.
> > I will try get in touch with OpenBSD devs on this issue and will get back
> to you
> > with a proper fix for this OS (if we can find one).
>
> Its entirely possible that the current code is taking advantage of a
> "feature" of Linux which is not intended to be exposed to the user.  I
> don't have time at the moment to look into rewriting the current code,
> but I'd be happy to accept a patch which fixes it, and maintains the
> intended logic.

Hi...

Back to this thread again.
So, after chatting with some OpenBSD devs, the included patch should fix the
issue.
It would be nice to officialy include it, if the fix is OK with you (and maybe
with an #ifdef in case it only applies to OpenBSD).

Let me know.

Regards,

-- 
Antoine

imap_fetchnews.c.diff
Description: Binary data

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

Re: fetchnews.c: invalid operands to binary

2006-04-04 Thread Gabor Gombas
On Tue, Apr 04, 2006 at 08:29:45AM -0400, Ken Murchison wrote:

> Its entirely possible that the current code is taking advantage of a 
> "feature" of Linux which is not intended to be exposed to the user.

>From 'man timezone':

The tzset() function initializes the tzname variable from the TZ
environment variable. This function is automatically called by
the other time conversion functions that depend on the time
zone. In a SysV-like environment it will also set the variables
timezone (seconds West of GMT) and daylight (0 if this time zone
does not have any daylight savings time rules, non-zero if there
is a time during the year when daylight savings time applies).
[...]
CONFORMING TO
SVID 3, POSIX, 4.3BSD
NOTES
[...]
4.3BSD  had  a  function char *timezone(zone, dst) that returned
the name of the time zone correā€ sponding to its first argument
(minutes West of GMT). If the second argument was 0, the
standard name was used, otherwise the daylight savings time
version.

SUSv3 has the same description as Linux, so only BSDs are different.

Gabor

-- 
 -
 MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
 -

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-04 Thread Ken Murchison

Antoine Jacoutot wrote:

Selon Ken Murchison <[EMAIL PROTECTED]>:

I'm told that OpenBSD might not have a timezone variable, but timezone()
is a function instead.  If this is the case, my fix will not do what you
want.


Thanks a lot for the warning.
I will try get in touch with OpenBSD devs on this issue and will get back to you
with a proper fix for this OS (if we can find one).


Its entirely possible that the current code is taking advantage of a 
"feature" of Linux which is not intended to be exposed to the user.  I 
don't have time at the moment to look into rewriting the current code, 
but I'd be happy to accept a patch which fixes it, and maintains the 
intended logic.


--
Kenneth Murchison
Systems Programmer
Project Cyrus Developer/Maintainer
Carnegie Mellon University

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-04 Thread Antoine Jacoutot
Selon Ken Murchison <[EMAIL PROTECTED]>:
> I'm told that OpenBSD might not have a timezone variable, but timezone()
> is a function instead.  If this is the case, my fix will not do what you
> want.

Thanks a lot for the warning.
I will try get in touch with OpenBSD devs on this issue and will get back to you
with a proper fix for this OS (if we can find one).

Thanks for your help !

-- 
Antoine

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-04 Thread Ken Murchison

Antoine Jacoutot wrote:

Selon Ken Murchison <[EMAIL PROTECTED]>:

This is definitely not what you want to do.  I don't know why OpenBSD
has a problem with this.  It compiles fine on Linux and Solaris.  You
could try changing #436 to:

stamp -= (time_t) timezone;


Yes, this works fine now :)


I'm told that OpenBSD might not have a timezone variable, but timezone() 
is a function instead.  If this is the case, my fix will not do what you 
want.



--
Kenneth Murchison
Systems Programmer
Project Cyrus Developer/Maintainer
Carnegie Mellon University

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-04 Thread Antoine Jacoutot
Selon Ken Murchison <[EMAIL PROTECTED]>:
> This is definitely not what you want to do.  I don't know why OpenBSD
> has a problem with this.  It compiles fine on Linux and Solaris.  You
> could try changing #436 to:
>
> stamp -= (time_t) timezone;

Yes, this works fine now :)
Thanks a lot, I appreciate!

Regards,

-- 
Antoine

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


RE: fetchnews.c: invalid operands to binary

2006-04-03 Thread Raymond Sundland
I'm so C expert, but shouldn't it be =-?  As in ... stamp =- timezone?



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ken Murchison
Sent: Monday, April 03, 2006 1:38 PM
To: Antoine Jacoutot
Cc: info-cyrus@lists.andrew.cmu.edu
Subject: Re: fetchnews.c: invalid operands to binary

Antoine Jacoutot wrote:
> Hi...
> 
> I'm trying to compile the 2.2.13 version of cyrus-imapd under OpenBSD.
> I've never had issues with earlier versions, but now, there seems to be 
> some changes in imap/fetchnews.c and I get the following error:
> 
> cc -c -I.. -I./../lib -I/usr/include -I./../sieve 
> -I/usr/local/include/db4 -I/usr/local/include -I/usr/include 
> -I/usr/include -I/usr/local/include -DHAVE_CONFIG_H -O2 -pipe -fPIC  
> fetchnews.c
> fetchnews.c: In function `main':
> fetchnews.c:436: error: invalid operands to binary -
> *** Error code 1
> 
>  If I change le line #436 from
> stamp -= timezone;
> to
> stamp = timezone;
> 
> then it compiles fine. BUT, I'm not a developper and I have no idea how 
> this change is good/dangerous... or not ???

This is definitely not what you want to do.  I don't know why OpenBSD 
has a problem with this.  It compiles fine on Linux and Solaris.  You 
could try changing #436 to:

stamp -= (time_t) timezone;



and/or try adding the following around line #66:

extern long timezone;


Let me know if one or both of these changes solve the problem.

-- 
Kenneth Murchison
Systems Programmer
Project Cyrus Developer/Maintainer
Carnegie Mellon University

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html



Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


Re: fetchnews.c: invalid operands to binary

2006-04-03 Thread Ken Murchison

Antoine Jacoutot wrote:

Hi...

I'm trying to compile the 2.2.13 version of cyrus-imapd under OpenBSD.
I've never had issues with earlier versions, but now, there seems to be 
some changes in imap/fetchnews.c and I get the following error:


cc -c -I.. -I./../lib -I/usr/include -I./../sieve 
-I/usr/local/include/db4 -I/usr/local/include -I/usr/include 
-I/usr/include -I/usr/local/include -DHAVE_CONFIG_H -O2 -pipe -fPIC  
fetchnews.c

fetchnews.c: In function `main':
fetchnews.c:436: error: invalid operands to binary -
*** Error code 1

 If I change le line #436 from
stamp -= timezone;
to
stamp = timezone;

then it compiles fine. BUT, I'm not a developper and I have no idea how 
this change is good/dangerous... or not ???


This is definitely not what you want to do.  I don't know why OpenBSD 
has a problem with this.  It compiles fine on Linux and Solaris.  You 
could try changing #436 to:


stamp -= (time_t) timezone;



and/or try adding the following around line #66:

extern long timezone;


Let me know if one or both of these changes solve the problem.

--
Kenneth Murchison
Systems Programmer
Project Cyrus Developer/Maintainer
Carnegie Mellon University

Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html