BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000336 [uClibc] Other major always 07-11-05 11:20 07-26-05 17:51
Reporter jean2 View Status public  
Assigned To uClibc
Priority normal Resolution fixed  
Status closed   Product Version 0.9.27
Summary 0000336: [PATCH] strftime() returns invalid timezone
Description     Hi,

    When compiled with TM_EXTENSIONS, the strftime() function in
uClibc gives invalid timezone information. This has wide implication,
as most time functions on the system will display invalid timezone.

    To visualise the bug, let's compare x86-glibc with arm-uClibc :

----- x86-blic --------------------------------
# date -u -R
Mon, 11 Jul 2005 17:32:20 +0000
# date -R
Mon, 11 Jul 2005 10:32:21 -0700
-----------------------------------------------

----- arm-uClibc --------------------------------------------
# ntpdate ntp3a
11 Jul 10:32:10 ntpdate[243]: step time server 15.X.X.X offset 1121103095.847544 sec
# date -u -R
Mon, 11 Jul 2005 17:32:26 GMT
# date -R
Mon, 11 Jul 2005 10:32:27 +0700
-------------------------------------------------------------

    As you can see, the time is correct, which indicates that the
timezone is properly configured, however, the timezone is incorrect.

    To understand the bug, consider this :

---- localtime() -------------------------------
#ifdef __UCLIBC_HAS_TM_EXTENSIONS__
                result->tm_gmtoff = - tzi[dst].gmt_offset;
#endif /* __UCLIBC_HAS_TM_EXTENSIONS__ */
-------------------------------------------------

        and :

---- strftime() ---------------------------------
#ifdef __UCLIBC_HAS_TM_EXTENSIONS__
#define RSP_GMT_OFFSET timeptr->tm_gmtoff
#else
#define RSP_GMT_OFFSET rsp->gmt_offset
#endif

                *s = '+';
                if ((tzo = -RSP_GMT_OFFSET) < 0) {
                        tzo = -tzo;
                        *s = '-';
                }
-------------------------------------------------

    Patch to fix the bug is attached (see attachement), and quite
trivial. Patch tested with uClibc-0.9.27 on ARM with BusyBox date. A
casual look at the latest CVS indicates that the patch is still needed
and would apply fine.
    Note that I did not check if the same problem is present
elsewhere, however it looks like TM_EXTENSIONS are not used in other
places.

    Have fun...

    Jean

Additional Information
Attached Files  uClibc-strftime-timezone-2.patch [^] (642 bytes) 07-11-05 11:20

- Relationships

- Notes
(0000281)
vapier
07-11-05 20:17

maybe related to Bug 74
 
(0000283)
jean2
07-12-05 14:24

> maybe related to Bug 74

    Nope, totally unrelated. This bug only affect the display of the timezone info in a string, not the timezone calculations themselves nor the display of the time.
    In any case, it's easy enough to verify, just forward the patch attached to this bug to the other bug reporter...

    Jean
 

- Issue History
Date Modified Username Field Change
07-11-05 11:20 jean2 New Issue
07-11-05 11:20 jean2 File Added: uClibc-strftime-timezone-2.patch
07-11-05 20:17 vapier Note Added: 0000281
07-12-05 14:24 jean2 Note Added: 0000283
07-26-05 17:51 mjn3 Status assigned => closed
07-26-05 17:51 mjn3 Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker