From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 27 18:29:11 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8597106564A for ; Sun, 27 Mar 2011 18:29:10 +0000 (UTC) (envelope-from david@catwhisker.org) Received: from albert.catwhisker.org (m209-73.dsl.rawbw.com [198.144.209.73]) by mx1.freebsd.org (Postfix) with ESMTP id C12CE8FC0A for ; Sun, 27 Mar 2011 18:29:10 +0000 (UTC) Received: from albert.catwhisker.org (localhost [127.0.0.1]) by albert.catwhisker.org (8.14.4/8.14.4) with ESMTP id p2RITADW016869 for ; Sun, 27 Mar 2011 11:29:10 -0700 (PDT) (envelope-from david@albert.catwhisker.org) Received: (from david@localhost) by albert.catwhisker.org (8.14.4/8.14.4/Submit) id p2RFcZm2089495 for hackers@freebsd.org; Sun, 27 Mar 2011 08:38:35 -0700 (PDT) (envelope-from david) Date: Sun, 27 Mar 2011 08:38:35 -0700 From: David Wolfskill To: hackers@freebsd.org Message-ID: <20110327153835.GA87420@albert.catwhisker.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: Keeping /etc/localtime up-to-date X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Mar 2011 18:29:11 -0000 --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Recent changes to /usr/share/zoneinfo have reminded me that my regular updates to my FreeBSD machines via source update /usr/share/zoneinfo, but /etc/localtime remains a copy of whatever was in /usr/share/zoneinfo for the selected zone at the time tzsetup(8) was last run -- and I certainly don't run tzsetup as often as I update my sources (nor would I want to). And while I (think I) recall that the equivalent of /etc/localtime was implemented in some version of SunOS many years ago as a symlink, I believe that approach could be problematic for FreeBSD, as it could impose some unintended requirements on some of the start-up scripts. I believe that it would be appropriate to have a facility to update /etc/localtime if the file to which it is supposed to correspond in /usr/share/zoneinfo (now) differs. Even if tzsetup is invoked with the -s flag and having the desired zoneinfo file specified on the command-line, it goes into full-screen mode and requests confirmation. Further, if the confirmation is given, it unconditionally overwrites /etc/localtime. It would (in principle) be possible to teach mergemaster(8) how to do this (possibly by including a cookie in ~/.mergemasterrc or /etc/mergemaster.rc to tell it what the "reference" zoneinfo pathname is), but this type of approach seems sufficiently different from (the bulk of?) what mergemaster does currently that I'm unconvinced that this is reasonable, let alone ideal. So it seems to me that requirements would be: * The content of /etc/localtime must provide the appropriate "zoneinfo" information, even when /usr/share/zoneinfo/* has been modified (or shortly thereafter, in concert with "make installworld"). * The content of /etc/localtime must be available when the only file system mounted is the root file system (and prior to any attempt to start any services (ref. {,/usr/local}/etc/rc.d)). * The process must be amenable to automation; to that end, it must be possible to perform it without requiring confirmation, and it must be doable from a command-line. * /etc/localtime should not be modified unless the content prior to modification differs from the selected specification in /usr/share/zoneinfo. * The process should not add unnecessary complexity to existing tools and procedures. =20 As a crude, brute-force hack, what I did (yesterday) was: * Create a symlink (which I called "/etc/tz") pointing to an appropriate zoneinfo entry. * Augment the commands I run on successful completion of "make installkernel" (from src/UPDATING): mergemaster -p make installworld mergemaster -i make delete-old by appending cmp -s /etc/tz /etc/localtime || cp -p /etc/tz /etc/localtime to the set. While I make no claim as to elegance, I believe it meets the requirements I listed. Of course, another approach -- which is likely to be fairly popular -- would be to run the machine on UTC, and let folks who want to care about TZ stuff set their own personal TZ environment variables. :-} Still, even that approach leads to the existence of /etc/localtime as being somewhat of an "attractive nuisance" (in that if it exists, it is likely to lead to a degree of mischief). Thoughts? Peace, david --=20 David H. Wolfskill david@catwhisker.org Depriving a girl or boy of an opportunity for education is evil. See http://www.catwhisker.org/~david/publickey.gpg for my public key. --9jxsPFA5p3P2qPhR Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iEYEARECAAYFAk2PWfoACgkQmprOCmdXAD1xMQCfb2DwphkVnGIX6+9sTeIp+skA jBsAn0+92sQPOoM0UD0eKFBdTt7/gZuv =1hFb -----END PGP SIGNATURE----- --9jxsPFA5p3P2qPhR--