[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#905939: tzdata files can get corrupted via write to /etc/localtime



On 2018-08-12 03:24, Vincent Lefevre wrote:
> Package: tzdata
> Version: 2018e-0+deb9u1
> Severity: important
> 
> On a Debian 9 machine:
> 
> patate:~> TZ=UTC date; TZ=UTC0 date
> Sun Aug 12 03:02:35 CEST 2018
> Sun Aug 12 01:02:35 UTC 2018
> 
> The first line is based on the /usr/share/zoneinfo/UTC file according
> to strace, but this is wrong as CEST is not UTC. The file is:
> 
> -rw-r--r-- 1 root root 2971 2018-05-15 10:01:38 /usr/share/zoneinfo/UTC
> 
> which doesn't seem to be the original one. I assume that it got
> corrupted via a write to /etc/localtime, but /etc/localtime is
> a symlink to /usr/share/zoneinfo/Etc/UTC, which is itself a
> symlink to /usr/share/zoneinfo/UTC.
> 
> Now, could the write to /etc/localtime be regarded as a bug?
> Probably not, because /etc/localtime is a config file, and one
> is allowed to write to config files under /etc.

I don't think it should be regarded as a bug. The fact it's a conffile
means that you can replace the symlink by another one or by a file, and
that dpkg and the maintainer script should keep the changes. It doesn't
mean anything about what the user can do about it.

> In short, having a symlink from a file under /etc to a file from
> a package does not seem to be correct.

This is nothing new, on a normal installation there are hundred of links
in /etc pointing to a file under /usr. For me the bug is in the
application writing the content instead of replacing the symlink.

> BTW, on https://www.virtualmin.com/node/15246 someone mentioned
> another issue with a symlink: "It's not really wise to make
> /etc/localtime a symlink. That used to be the standard behavior for
> Linux in the past, but then someone realized that /usr/share/zoneinfo
> could be on a different volume that's not always mounted, and we
> definitely don't want to be without /etc/localtime, [...]"

This is used to be a copy, to handle the case where /usr is mounted late
in the boot script. Since Jessie (initramfs-tools 0.117), it is
guaranteed that /usr is mounted in the initramfs, so it's possible to
use a symlink.

The switch to a symlink has been done so that systemd (#803144), and
recent desktop environments can work on Debian. On other distributions
/etc/timezone does not exist and the timezone configuration can be
checked by looking where the symlink points to.

In summary I don't believe there is a bug in tzdata. The bug should be
reassigned to the package wrongly changing /etc/localtime.

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net


Reply to: