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)
Thu, Nov 21, 1:39 PM
Unknown Object (File)
Sep 27 2024, 2:04 PM
Unknown Object (File)
Sep 25 2024, 9:21 AM
Unknown Object (File)
Sep 25 2024, 9:18 AM
Unknown Object (File)
Sep 25 2024, 7:22 AM
Unknown Object (File)
Sep 24 2024, 6:28 AM
Unknown Object (File)
Sep 11 2024, 10:43 PM
Unknown Object (File)
Sep 4 2024, 9:27 AM
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.