From owner-freebsd-arch@FreeBSD.ORG Sun Oct 30 13:43:15 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C645106564A; Sun, 30 Oct 2011 13:43:15 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id C273D8FC13; Sun, 30 Oct 2011 13:43:14 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 2A16B3592EB; Sun, 30 Oct 2011 14:43:14 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 10AD528468; Sun, 30 Oct 2011 14:43:14 +0100 (CET) Date: Sun, 30 Oct 2011 14:43:13 +0100 From: Jilles Tjoelker To: Lev Serebryakov Message-ID: <20111030134313.GA94944@stack.nl> References: <457576448.20111030151023@serebryakov.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <457576448.20111030151023@serebryakov.spb.ru> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: arch@freebsd.org Subject: Re: /etc/localtime problems X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2011 13:43:15 -0000 On Sun, Oct 30, 2011 at 03:10:23PM +0400, Lev Serebryakov wrote: > Now, /etc/localtime is copy of one of files from > /usr/share/zoneinfo. It is created at install time or with "tzsetup" > utility. > IMHO, it is bad practice. For example, Russia changed rules > (cancelled Winter Time). Ok, our database was updated properly > (r223629 and MFCes), but "make buildworld installworld && mergemaster" > doesn't touch /etc/localtime! So, every administrator of every FreeBSD > server in Russia needs not to forget to update this file manually. > It looks not good. > IMHO, /etc/localtime should be symlink (in such case "installworld" > or "freebsd-update" will fix problem), or "mergemaster" should know > about this file and update it too... Recent tzsetup(8) (in 10.x, 9.x and recent 8.x but not in any release) stores the choice in /var/db/zoneinfo, allowing "tzsetup -r" to install the new version of the previous time zone. This happens automatically on installworld, but for some reason not on freebsd-update install. However, this only works if the new tzsetup(8) was run at least once to select the time zone (there is no code to create /var/db/zoneinfo from which /usr/share/zoneinfo file matches /etc/localtime). Code to create /var/db/zoneinfo could be something like if [ ! -s /var/db/zoneinfo ] && [ -s /etc/localtime ]; then zone=$(cd /usr/share/zoneinfo && for z in */* */*/* *; do if cmp -s "$z" /etc/localtime; then echo "$z"; break; fi done) if [ -n "$zone" ]; then echo "$zone" >/var/db/zoneinfo; fi fi It should be run against the old /usr/share/zoneinfo and assumes the /etc/localtime is up-to-date against that. -- Jilles Tjoelker