From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: Re: Emacs current-time-string core dump on 64-bit hosts Date: Fri, 17 Mar 2006 14:16:27 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1142597787 17670 80.91.229.2 (17 Mar 2006 12:16:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 17 Mar 2006 12:16:27 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 17 13:16:26 2006 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FKDsX-0005RS-3o for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Mar 2006 13:16:25 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FKDsW-0000qW-Gw for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Mar 2006 07:16:24 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FKDsU-0000qQ-Ud for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2006 07:16:22 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FKDsT-0000q6-5D for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2006 07:16:21 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FKDsS-0000q3-Vh for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2006 07:16:20 -0500 Original-Received: from [192.114.186.66] (helo=romy.inter.net.il) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FKDxK-0004Az-VJ for bug-gnu-emacs@gnu.org; Fri, 17 Mar 2006 07:21:23 -0500 Original-Received: from HOME-C4E4A596F7 (IGLD-84-228-141-3.inter.net.il [84.228.141.3]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id DTR23489 (AUTH halo1); Fri, 17 Mar 2006 14:16:18 +0200 (IST) Original-To: Paul Eggert In-reply-to: (message from Paul Eggert on Thu, 16 Mar 2006 21:58:09 -0800) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:14957 Archived-At: > From: Paul Eggert > Gcc: nnfolder+archive:outgo > Date: Thu, 16 Mar 2006 21:58:09 -0800 > > 2006-03-16 Paul Eggert > > Do not use ctime, since it has undefined behavior with > out-of-range time stamps. This fixes a bug where > (current-time-string '(2814749767106 0)) would make Emacs dump > core on 64-bit Solaris 8; the fix is to remove all uses of ctime > from the Emacs source code. Personally, I find it preposterous that we need to reinvent library functions. Isn't there a better (safer) library function, or a combination thereof, that we could use instead of rolling our own? > (Fdecode_time): Cast tm_year to EMACS_INT, to avoid overflow when > int is narrow than EMACS_INT. Can it happen that an int is narrower than EMACS_INT? I thought it was impossible, but perhaps I'm mistaken. If this cannot happen, let's not clutter the code with unnecessary kludges. > * lib-src/ntlib.c (sys_ctime): Remove, since Emacs never calls > ctime any more. > * lib-src/ntlib.h (ctime): Likewise. > * src/w32.c (sys_ctime): Likewise. > * src/s/ms-w32.h (ctime): Likewise. I wouldn't remove these: the functions are almost trivial wrappers around the library version, and someone could try using ctime in the future (in a different context), in which case they will hit the Windows library bug again.