bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs current-time-string core dump on 64-bit hosts


From: Paul Eggert
Subject: Re: Emacs current-time-string core dump on 64-bit hosts
Date: Fri, 31 Mar 2006 12:51:08 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Richard Stallman <address@hidden> writes:

> So I would prefer if we just have conditionals set for certain systems
> by the s/ file.

OK.

I raised this issue on the Open Group mailing lists, and just now got
the bad news that the C standardization committee intends to change
the spec for ctime and asctime, by allowing implementations to crash
if the year is outside the range 1000-9999.  So we'd need to change
Emacs anyway, to be portable to future C standards.

I'm a little rusty with s/ files, but I assume that we could use
something like this in a generic s/ file somewhere:

   /* Safe values the tm_year members of arguments passed to asctime.
      C89 and C99 say the range is -999-1900 through 9999-1900, but
      <http://www.opengroup.org/austin/mailarchives/ag/msg09383.html>
      says the C committee will change this to 1000-1900 through
      9999-1900, so use the more-conservative range here.  */
   #ifndef TM_YEAR_IN_ASCTIME_RANGE
   # define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \
        (1000 - 1900 <= (tm_year) && (tm_year) <= 9999 - 1900)
   #endif

and then in s/gnu-linux.h and src/s/gnu.h we'd put this:

   #define TM_YEAR_IN_ASCTIME_RANGE(tm_year) ((tm_year) <= INT_MAX - 1900)

and similarly for any other platform where we know the actual range.
Then b2m.c, fakemail.c, and editfns.c can use TM_YEAR_IN_ASCTIME_RANGE.

Is that the sort of thing you have in mind?  If so, can you please
suggest where the generic definition of TM_YEAR_IN_ASCTIME_RANGE
should go?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]