Received: (qmail 71175 invoked by uid 501); 28 Apr 2000 11:35:33 -0000 Message-Id: <20000428113532.71174.qmail@locus.apache.org> Date: 28 Apr 2000 11:35:32 -0000 From: Alessandro Vesely Reply-To: vesely@tana.it To: submit@bugz.apache.org Subject: broken localtime - autoindex displays wrong file date/time X-Send-Pr-Version: 3.110 >Number: 6035 >Category: os-solaris >Synopsis: broken localtime - autoindex displays wrong file date/time >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: open >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Fri Apr 28 04:40:00 PDT 2000 >Closed-Date: >Last-Modified: >Originator: vesely@tana.it >Release: 1.3.12 >Organization: apache >Environment: SunOS 5.7 sun4m sparc >Description: The static struct tm* returned by localtime cannot be reused with strftime and other functions on solaris 2.6 and 7. The autoindex module offers an easy way to check for this bug. Please notice that varous solaris programs (e.g. FileManager) behave that wrong way. The time displayed is 1/1/1970 with solaris 2.6 and the current date with solaris 7. (I don't know about 2.5 and 8, it was NOT there in 2.4.) >How-To-Repeat: Point your browser at a directory to be listed by autoindex that contains some file older than today and check the output. >Fix: /* in ap_config.h: */ static struct tm* my_localtime(time_t const *clock) { static struct tm my_tm; return memcpy(&my_tm, localtime(clock), sizeof my_tm); } #define localtime(X) my_localtime(X) /* I did the same with gmtime. ** ** Alternatively, one may experiment with localtime_r, gmtime_r */ >Release-Note: >Audit-Trail: >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]