← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1341710] Re: Comment placed inside of /etc/timezone

 

fixed in 0.7.6

** Changed in: cloud-init
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1341710

Title:
  Comment placed inside of /etc/timezone

Status in Init scripts for use on cloud images:
  Fix Released
Status in “cloud-init” package in Ubuntu:
  Fix Released

Bug description:
  Greetings!

  cloud-init v0.7.5 (trusty) is placing a comment in the /etc/timezone
  file, when that file isn't intended to contain a comment. This is
  confusing openjdk (and perhaps other programs?), which is unable to
  determine the correct timezone.

  Sample /etc/timezone from v0.7.5:
  ----
  # Created by cloud-init v. 0.7.5 on Mon, 14 Jul 2014 18:01:38 +0000
  US/Eastern
  ----

  
  Openjdk has been informed of this back in 2012, and decided that they won't change things on their end because comments in /etc/timezone aren't part of the "spec". https://bugs.openjdk.java.net/browse/JDK-7192951. Of course, there is no formal spec for /etc/timezone. The closest that I've seen to a spec is actually contained within the bug report at openjdk:

  =====================================================================
  I am not sure that a formal spec of /etc/timezone exists. The Debian
  tools for manipulating it (tzconfig and tzsetup) do basically the same
  thing.

  --- reading ---
  if [ -L /etc/localtime ] ; then
   current_timezone=$(readlink /etc/localtime | sed 's%^/usr/share/zoneinfo/%%')
  elif [ -f /etc/timezone ] && [ -f /etc/localtime ]; then
   current_timezone=$(cat /etc/timezone)
  fi

  --- setting ---
  echo $timezone > /etc/timezone

  It is the same in Ubuntu. So, in Debian-based distros it is just a
  LF-terminated line, with no spaces and extra characters. To be a
  little more general, I suggest ignoring all leading spaces (including
  new lines) and then reading consecutive non-space characters.
  =====================================================================

  
  For the record, cloud-init previously did not include a comment in /etc/timezone. Would it be possible to revert to the previous behavior of not including a comment in /etc/timezone? A quick skim of the source code tells me that the set_timezone() method would have to be changed to no longer include the line with util.make_header().

  Thanks!

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1341710/+subscriptions