Date: Sun, 20 Apr 1997 17:20:42 +0300 (IDT) From: Eli Zaretskii To: k DOT ashley AT ulcc DOT ac DOT uk cc: djgpp AT delorie DOT com Subject: Re: Zoneinfo bug in EMACS? (Eli?) In-Reply-To: <5j5ocd$g56@calypso.ulcc.ac.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 17 Apr 1997, Kevin Ashley wrote: > |>Thanks for the report. This is due to a bug in the library function > |>`tzset' (more accurately, in one of its internal subroutines): it > |>caches the value of the zoneinfo directory, .... > > Given your explanation, Eli, I wouldn't categorise this as a bug in > tzset and friends - the implementation is a perfectly sensible one. > The timezone routines can get called millions of times by programs > that need to process date and time strings and caching info such as the > directory, and the zone files themselves, is the only way they can > offer acceptable performance. Caching is OK; assuming that the value of a static uninitialized variable (which goes into the .bss section) is zero every time the program starts is NOT. All that it takes to correct the bug is to detect that the program has been restarted and reinitialize; it doesn't affect performance a bit. > The problem is surely with EMACs and its arcane method of building > itself. I disagree. Emacs is just another C program, that's all. It doesn't do anything that's against any standards. I submit that a good C library should allow any program to do whatever it pleases, unless that program explicitly violates written rules of the language. Otherwise, a good library shouldn't get in the way of the programmer. > There are no doubt other gotchas lurking > somewhere involving routines which maintain internal state. I challenge you to find any such functions. AFAIK, any functions that are used in such context are already fixed to detect when the program is restarted and reinitialize. A lot of work went into that when Emacs was ported to DJGPP v2. Some people who participated in v2 beta-testing even claimed that making libc Emacs-clean will mean a complete rewrite of the library, but that turned out to be not true. > The most sensible patch might be a single one to add a new function > to tell the tz routines to forget their internally-saved names, which > EMACS could call on startup. Did you see the patch that I posted? If so, was it too complicated? I don't think so. > A patch like that might conceivably be > useful to very long-running programs as well, whose environment might > change around them. (Although in DOS, I'm not sure how this would happen.) The only way this can happen is when the program itself calls `putenv'.