public inbox for gnats-devel@sourceware.org
 help / color / mirror / Atom feed
* Current Gnats 4 CVS broken on Solaris
@ 2001-05-10 16:37 Yngve Svendsen
  2001-05-27  8:36 ` Milan Zamazal
  0 siblings, 1 reply; 9+ messages in thread
From: Yngve Svendsen @ 2001-05-10 16:37 UTC (permalink / raw)
  To: gnats-devel; +Cc: Milan Zamazal

Seems the %Z to %z change broke Gnats 4 on Solaris 7. It turns out that 
Solaris' strftime does not support the %z conversion specification. I get 
error messages saying that Gnats is unable to parse the Arrival Date field 
when submitting edits. Changing %z to %Z again fixed it.

Yngve Svendsen
IS Engineer
Clustra AS, Trondheim, Norway
yngve.svendsen@clustra.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Current Gnats 4 CVS broken on Solaris
  2001-05-10 16:37 Current Gnats 4 CVS broken on Solaris Yngve Svendsen
@ 2001-05-27  8:36 ` Milan Zamazal
  2001-05-30  8:51   ` Yngve Svendsen
  0 siblings, 1 reply; 9+ messages in thread
From: Milan Zamazal @ 2001-05-27  8:36 UTC (permalink / raw)
  To: Yngve Svendsen; +Cc: gnats-devel

>>>>> "YS" == Yngve Svendsen <yngve.svendsen@clustra.com> writes:

    YS> Seems the %Z to %z change broke Gnats 4 on Solaris 7. It turns
    YS> out that Solaris' strftime does not support the %z conversion
    YS> specification. I get error messages saying that Gnats is unable
    YS> to parse the Arrival Date field when submitting edits. Changing
    YS> %z to %Z again fixed it.

Well, it should be fixed now, with respect to the recent time zone
discussion.  Please let me know whether it works now.

Thanks,

Milan Zamazal

-- 
When you're in a fight with an idiot, it's difficult for other people to tell
which one the idiot is.                       -- Bruce Perens in debian-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Current Gnats 4 CVS broken on Solaris
  2001-05-27  8:36 ` Milan Zamazal
@ 2001-05-30  8:51   ` Yngve Svendsen
  2001-06-10 10:26     ` Milan Zamazal
  0 siblings, 1 reply; 9+ messages in thread
From: Yngve Svendsen @ 2001-05-30  8:51 UTC (permalink / raw)
  To: Milan Zamazal; +Cc: gnats-devel

At 16:37 27.05.2001 +0200, Milan Zamazal wrote:
>Well, it should be fixed now, with respect to the recent time zone
>discussion.  Please let me know whether it works now.

Sorry, but it seems the configure check for %z support isn't working right. 
 From the configure output, I can see that it detects support for %z on my 
Solaris 7 system, even though Solaris 7 doesn't support it. If I go on to 
build and install GNATS, I see exactly the same problems that I reported in 
my original message.

- Yngve

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Current Gnats 4 CVS broken on Solaris
  2001-05-30  8:51   ` Yngve Svendsen
@ 2001-06-10 10:26     ` Milan Zamazal
  2001-06-12  8:21       ` Yngve Svendsen
  0 siblings, 1 reply; 9+ messages in thread
From: Milan Zamazal @ 2001-06-10 10:26 UTC (permalink / raw)
  To: Yngve Svendsen; +Cc: gnats-devel

>>>>> "YS" == Yngve Svendsen <yngve.svendsen@clustra.com> writes:

    YS> Sorry, but it seems the configure check for %z support isn't
    YS> working right.

You're right.  strftime is going to become my nightmare. :-|  I tried to
fix it and also added a patch by Carl enabling numeric time zones also
on systems not supporting `%z'.  Please try whether it works or not.

Regards,

Milan Zamazal

-- 
  _/_\_/_  o     _\_/_\_  o     _/_\_/_  o     _\_/_\_  o    BEWARE!
-<_|_|_|_><--  -<_|_|_|_><--  -<_|_|_|_><--  -<_|_|_|_><--   *Bugs* are
   / \ /   o      \ / \   o      / \ /   o      \ / \   o     approaching!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Current Gnats 4 CVS broken on Solaris
  2001-06-10 10:26     ` Milan Zamazal
@ 2001-06-12  8:21       ` Yngve Svendsen
  2001-06-12 13:23         ` Yngve Svendsen
  0 siblings, 1 reply; 9+ messages in thread
From: Yngve Svendsen @ 2001-06-12  8:21 UTC (permalink / raw)
  To: Milan Zamazal; +Cc: gnats-devel

At 17:15 10.06.2001 +0200, Milan Zamazal wrote:
> >>>>> "YS" == Yngve Svendsen <yngve.svendsen@clustra.com> writes:
>
>     YS> Sorry, but it seems the configure check for %z support isn't
>     YS> working right.
>
>You're right.  strftime is going to become my nightmare. :-|  I tried to
>fix it and also added a patch by Carl enabling numeric time zones also
>on systems not supporting `%z'.  Please try whether it works or not.

Unfortunately, the nightmare continues. "make all" results in the following 
on a Solaris 7 system:

gcc -c -I. -I. -I./../include  -g -O2 -W -Wall -W -Wall -ansi -pedantic 
-Werror -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings 
-Wno-format  -DHAVE_CONFIG_H 
-DGNATSD_USER_ACCESS_FILE=\"/usr/local/etc/gnats/gnatsd.access\" 
-DGNATSD_HOST_ACCESS_FILE=\"/usr/local/etc/gnats/gnatsd.host_access\" 
-DDEFAULT_GNATS_SERVICE=\"support\" 
-DGLOBAL_DB_LIST_FILE=\"/usr/local/etc/gnats/databases\" 
-DGNATS_USER=\"gnats\" misc.c
cc1: warnings being treated as errors
misc.c: In function `gnats_strftime':
misc.c:570: warning: subscript has type `char'
gmake[1]: *** [misc.o] Error 1
gmake[1]: Leaving directory `/usr/local/src/gnats-400/gnats/gnats'
gmake: *** [all-gnats] Error 2

- Yngve

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Current Gnats 4 CVS broken on Solaris
  2001-06-12  8:21       ` Yngve Svendsen
@ 2001-06-12 13:23         ` Yngve Svendsen
  2001-06-13 10:33           ` Milan Zamazal
  2002-09-12 15:07           ` Wrong dates in PRs if no %z support in strftime(3) Lars Henriksen
  0 siblings, 2 replies; 9+ messages in thread
From: Yngve Svendsen @ 2001-06-12 13:23 UTC (permalink / raw)
  To: Milan Zamazal; +Cc: gnats-devel

At 17:19 12.06.2001 +0200, Yngve Svendsen wrote:
>At 17:15 10.06.2001 +0200, Milan Zamazal wrote:
>> >>>>> "YS" == Yngve Svendsen <yngve.svendsen@clustra.com> writes:
>>
>>     YS> Sorry, but it seems the configure check for %z support isn't
>>     YS> working right.
>>
>>You're right.  strftime is going to become my nightmare. :-|  I tried to
>>fix it and also added a patch by Carl enabling numeric time zones also
>>on systems not supporting `%z'.  Please try whether it works or not.
>
>Unfortunately, the nightmare continues. "make all" results in the 
>following on a Solaris 7 system:

[snip]

On some systems, Solaris among them, isdigit() requires an explicit cast to 
int. The very simple patch below fixes the problem and makes the current 
GNATS 4 compile on both Solaris and Linux.

I have compiled and done some testing, and as far as I can tell, all is now 
well on systems that don't support %z.

- Yngve


Index: misc.c
===================================================================
RCS file: /cvs/gnats/gnats/gnats/misc.c,v
retrieving revision 1.28
diff -u -p -r1.28 misc.c
--- misc.c      2001/06/10 17:15:47     1.28
+++ misc.c      2001/06/12 20:21:01
@@ -567,7 +567,7 @@ gnats_strftime (char *s, size_t size, co
      {
        char buf[16];
        strftime (buf, 16, "%z", brokentime);
-      have_strftime_with_z = isdigit (buf[1]);
+      have_strftime_with_z = isdigit ((int) (buf[1]));
      }

    if (have_strftime_with_z)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Current Gnats 4 CVS broken on Solaris
  2001-06-12 13:23         ` Yngve Svendsen
@ 2001-06-13 10:33           ` Milan Zamazal
  2002-09-12 15:07           ` Wrong dates in PRs if no %z support in strftime(3) Lars Henriksen
  1 sibling, 0 replies; 9+ messages in thread
From: Milan Zamazal @ 2001-06-13 10:33 UTC (permalink / raw)
  To: Yngve Svendsen; +Cc: gnats-devel

>>>>> "YS" == Yngve Svendsen <yngve.svendsen@clustra.com> writes:

    YS> On some systems, Solaris among them, isdigit() requires an
    YS> explicit cast to int. The very simple patch below fixes the
    YS> problem and makes the current GNATS 4 compile on both Solaris
    YS> and Linux.

Thanks, applied.

    YS> I have compiled and done some testing, and as far as I can tell,
    YS> all is now well on systems that don't support %z.

OK, thanks.

Regards,

Milan Zamazal

-- 
When you're in a fight with an idiot, it's difficult for other people to tell
which one the idiot is.                       -- Bruce Perens in debian-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Wrong dates in PRs if no %z support in strftime(3)
  2001-06-12 13:23         ` Yngve Svendsen
  2001-06-13 10:33           ` Milan Zamazal
@ 2002-09-12 15:07           ` Lars Henriksen
  1 sibling, 0 replies; 9+ messages in thread
From: Lars Henriksen @ 2002-09-12 15:07 UTC (permalink / raw)
  To: help-gnats; +Cc: Milan Zamazal, Yngve Svendsen, Carl E. Lindberg

On Tue, Jun 12, 2001 at 10:25:02PM +0200, Yngve Svendsen wrote:
> At 17:19 12.06.2001 +0200, Yngve Svendsen wrote:
> >At 17:15 10.06.2001 +0200, Milan Zamazal wrote:
> >>>>>>> "YS" == Yngve Svendsen <yngve.svendsen@clustra.com> writes:
> >>
> >>    YS> Sorry, but it seems the configure check for %z support isn't
> >>    YS> working right.
> >>
> >>You're right.  strftime is going to become my nightmare. :-|  I tried to
> >>fix it and also added a patch by Carl enabling numeric time zones also
> >>on systems not supporting `%z'.  Please try whether it works or not.
> >
> >Unfortunately, the nightmare continues. "make all" results in the 
> >following on a Solaris 7 system:
> 
> [snip]
> 
> On some systems, Solaris among them, isdigit() requires an explicit cast to 
> int. The very simple patch below fixes the problem and makes the current 
> GNATS 4 compile on both Solaris and Linux.
> 
> I have compiled and done some testing, and as far as I can tell, all is now 
> well on systems that don't support %z.

Not quite.

There is a bug in gnats_strftime() that affects systems without %z support.
The problem is the brokentime pointer passed to gnats_strftime(). It points
to static data that may be overwritten by calls to (among others) gmtime().

Exactly this happens in the support routine minutes_gmt_offset(), whereupon
brokentime is passed on to strftime().

Patch follows. I have submitted a gnats PR as well.

Lars Henriksen

Index: misc.c
===================================================================
RCS file: /cvsroot/gnats/gnats/gnats/misc.c,v
retrieving revision 1.36
diff -u -r1.36 misc.c
--- misc.c      6 Jan 2002 16:13:20 -0000       1.36
+++ misc.c      12 Sep 2002 14:16:12 -0000
@@ -568,6 +568,11 @@
       char *fixed_template = (char*)xmalloc (strlen(template)+FORMAT_PADDING);
       const char *in = template;
       char *out = fixed_template;
+      /* Because brokentime points to static data (allocated
+       * by localtime()), it cannot be passed to a subroutine
+       * and then later be relied on to point to the same data. */
+      struct tm bktime = *brokentime;
+      int result;
      
       while (*in != '\0')
        {
@@ -602,12 +607,9 @@
            }
        }
       *out = '\0';
-    
-      {
-       int result = strftime (s, size, fixed_template, brokentime);
-       free (fixed_template);
-       return result;
-      }
+      result = strftime (s, size, fixed_template, &bktime);
+      free (fixed_template);
+      return result;
     }
 }



_______________________________________________
Help-gnats mailing list
Help-gnats@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnats

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Current Gnats 4 CVS broken on Solaris
       [not found] <991303419.19767.ezmlm@sources.redhat.com>
@ 2001-06-02  9:33 ` Carl E. Lindberg
  0 siblings, 0 replies; 9+ messages in thread
From: Carl E. Lindberg @ 2001-06-02  9:33 UTC (permalink / raw)
  To: Yngve Svendsen; +Cc: gnats-devel

> At 16:37 27.05.2001 +0200, Milan Zamazal wrote:
>> Well, it should be fixed now, with respect to the recent time zone
>> discussion.  Please let me know whether it works now.
>
> Sorry, but it seems the configure check for %z support isn't working 
> right. From the configure output, I can see that it detects support for 
> %z on my Solaris 7 system, even though Solaris 7 doesn't support it. If 
> I go on to build and install GNATS, I see exactly the same problems 
> that I reported in my original message.

	Yes, the configure check is broken -- it fails to detect missing %z 
support on MacOS X as well.  I'm not sure what the check is currently 
doing, but it should probably check that a strftime() with a format of 
"%z" results in the first character being '-' or '+'.

	-Carl Lindberg

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-09-12 14:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-10 16:37 Current Gnats 4 CVS broken on Solaris Yngve Svendsen
2001-05-27  8:36 ` Milan Zamazal
2001-05-30  8:51   ` Yngve Svendsen
2001-06-10 10:26     ` Milan Zamazal
2001-06-12  8:21       ` Yngve Svendsen
2001-06-12 13:23         ` Yngve Svendsen
2001-06-13 10:33           ` Milan Zamazal
2002-09-12 15:07           ` Wrong dates in PRs if no %z support in strftime(3) Lars Henriksen
     [not found] <991303419.19767.ezmlm@sources.redhat.com>
2001-06-02  9:33 ` Current Gnats 4 CVS broken on Solaris Carl E. Lindberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).