Page MenuHomeFreeBSD

tzcode: fix tz change detection logic
ClosedPublic

Authored by kevans on Dec 16 2021, 2:20 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 30, 11:24 PM
Unknown Object (File)
Tue, Apr 30, 11:12 PM
Unknown Object (File)
Tue, Apr 30, 11:12 PM
Unknown Object (File)
Tue, Apr 30, 8:35 PM
Unknown Object (File)
Jan 14 2024, 1:46 PM
Unknown Object (File)
Dec 20 2023, 5:34 AM
Unknown Object (File)
Oct 27 2023, 2:57 PM
Unknown Object (File)
Sep 29 2023, 12:19 PM
Subscribers

Details

Summary

clock_gettime() returns 0 if it succeeds, so don't capture that into the
fail logic. With this, WITH_DETECT_TZ_CHANGES successfully detects a
change after 61 seconds.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I'm also wondering if we should drop this name check stuff in change_in_tz(). name == "/etc/localtime" and that's almost never going to change, we'd need to trace it down to the last symlink to get anything meaningful and at that point I'm not sure it's worth the expense over just the one stat() and relying on dev/ino/ctime/mtime.

not sure about /etc/timezone. I think this code was written to detect changes to that file specifically...

This revision is now accepted and ready to land.Dec 16 2021, 2:56 AM

Thanks for tracking this down :-) As for change_in_tz() - I hadn't investigated the code around it to figure out if the path can actually change, but it kinda looks like it's trying to avoid making assumptions about it. Still, even if it did change, we would get a different inode/device numbers in stat info, which makes the name check redundant anyway.

This revision was automatically updated to reflect the committed changes.