Skip to content

Commit 338e922

Browse files
felixonmarsreddevillg
authored andcommitted
fix: make tests pass without /etc/localtime
Handle ENOENT from std::filesystem::symlink_status() when resolving /etc/localtime, so the existing UTC fallback is reachable in clean Arch build chroots where /etc/localtime is absent.
1 parent c422c3d commit 338e922

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

libs/linglong/src/linglong/runtime/run_context.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ utils::error::Result<void> RunContext::resolveTimeZone()
655655
std::error_code ec;
656656
auto localtimeStatus = std::filesystem::symlink_status(localtimePath, ec);
657657
if (ec) {
658+
if (ec == std::errc::no_such_file_or_directory) {
659+
contextCfg.timezone = "UTC";
660+
return LINGLONG_OK;
661+
}
658662
return LINGLONG_ERR(fmt::format("failed to get status of {}", localtimePath), ec);
659663
}
660664

0 commit comments

Comments
 (0)