Hello Willy, Le 13/03/2016 23:49, Willy Tarreau a écrit : > Hi Benoit, > > On Sat, Mar 12, 2016 at 09:45:25AM +0100, Benoît GARNIER wrote: >> You just need to call tzset() once before chrooting to initialize the >> timezone subsystem. > Finally I did it directly in your patch, it was not worth delaying a > release for such a small change.
I did not send the patch earlier because I was trying to gather some more informations about chroot() and local times. It seems that my patch would not play nicely with some versions of glibc and could introduce a subtle bug. Some time functions call tzset() internally. This is the case for strftime() or localtime() (but not localtime_r() or gettimeofday()). So when populating the GMT offset cache, a hidden call to tzset() is done. The issue is that some old glibc, when not finding /etc/localtime (this is the case after a chroot), would reset the timezone to GMT. Thus, the first log would have a localtime with a GMT offset (wrongly) set to +00:00, and subsequent logs would be in full GMT time. See the following bug: https://bugzilla.redhat.com/show_bug.cgi?id=444043 In this case the only solution is to copy /etc/localtime to <chroot>/etc/localtime. So, I was trying to elaborate on your previous suggestion: prepare the cache at startup, but without messing with the tm_isdst flag. Benoit GARNIER