From: ffobzb <ffobzb@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: opensmtpd: Does not respect the system time zone in mail header and logfile
Date: Tue, 27 Feb 2024 21:39:19 +0100 [thread overview]
Message-ID: <20240227203919.CA66C24705@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-39918@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]
New comment by ffobzb on void-packages repository
https://github.com/void-linux/void-packages/issues/39918#issuecomment-1967551161
Comment:
After a short break of several months :-) I picked up this issue again. I think I found the reason for the behaviour and a suitable workaround.
The chroot'ed processes can't access `/etc/localtime` and thus fall back to UTC. This shall be prevented by the call of `tzset(3)` before the chroot, and on OpenBSD this works. But in GNU libc the behaviour is - as far as I understood it - different: If the environment variable `TZ` is not set, then each call of a time-related function looks up the time zone again, and this fails after the chroot because `/etc/localtime` isn't accessible. This means that the `tzset()` call before is useless in case of GNU libc.
If `TZ` is not empty and is set to a timezone string before starting smtpd then all works as expected: Mail headers and log entries have the times in the configured time zone. This also works when TZ is set to the filespec format (see `tzset(3)`).
So the workaround is as simple as setting `TZ` before starting smtpd:
`# TZ=/etc/localtime smtpd`
And the corresponding entry in `/etc/sv/opensmtpd/run` then should be:
`TZ=/etc/localtime exec smtpd -F 2>&1
next prev parent reply other threads:[~2024-02-27 20:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 19:48 [ISSUE] " ffobzb
2022-11-04 15:02 ` sdgathman
2022-11-04 15:07 ` sdgathman
2022-11-04 15:17 ` sdgathman
2022-11-04 15:19 ` sdgathman
2022-11-04 16:37 ` sdgathman
2022-11-07 20:25 ` ffobzb
2023-05-01 15:58 ` vmc-coding
2023-05-01 15:59 ` vmc-coding
2023-05-01 15:59 ` vmc-coding
2024-02-27 20:39 ` ffobzb [this message]
2024-02-27 20:41 ` ffobzb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240227203919.CA66C24705@inbox.vuxu.org \
--to=ffobzb@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).