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

Bug#725307: tzdata: True "Zone" files are made into symlinks pointing to "Link" (alias) files.



Package: tzdata
Version: 2013b-2
Severity: minor
Tags: patch

Dear Maintainer,
*** Please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these lines ***


-- System Information:
Debian Release: 7.0
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.9.3-x86_64-linode33 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages tzdata depends on:
ii  debconf [debconf-2.0]  1.5.49

tzdata recommends no packages.

tzdata suggests no packages.

-- debconf information excluded

In observing the symlinks in /usr/share/zoneinfo (2013b-2 and 2013d-0wheezy1), 
the "true" Zones from the original Olson files are not kept as the hard files.
For example, America/Regina is a "true" Zone, with aliases Saskatchewan and
East-Saskatchewan.  However, on my system, it appears that either fdupes
or rdfind/symlinks find the duplicate files but arbitrarily choose one as 
the "true" zone to keep, and making all others relative symlinks to the
one chosen.  This looks strange to me since I expect the symlinks in the
installed /usr/share/zoneinfo/ dir to mirror the "Zone" and "Link" objects
from the Olson files.

I have demonstrated a modification to the 2013b-2 "rules" makefile which 
will query the Olson files and be sure to choose the "true" Zone as the one
to keep as a hard file, and making all others relative symlinks.

This was tested by me today using the new tzdata2013g Olson files from the upstream provider.

The following is the text of my tested makefile, but does not contain everything 
from the Debian "rules" file, from which it was derived:

#!/usr/bin/make -f
# Have the final files mirror Olson "Zone" and "Link" definitions.
# "Zone" definitions are kept as hard files.
# "Link" aliases are converted to symbolic links.

TZGEN := tzgen
TMP_ZNS := prizns.tmp
TIMEZONES := africa \
             antarctica \
             asia \
             australasia \
             europe \
             northamerica \
             southamerica \
             etcetera \
             factory \
             backward \
             systemv \
             pacificnew

ifeq ($(EMDEBIAN),)
TIMEZONES += solar87 \
             solar88 \
             solar89
endif

build-indep: build-indep-stamp
build-indep-stamp:

        # Build list of real Zones
        cat /dev/null > $(TMP_ZNS)
        for zone in $(TIMEZONES); do \
          grep ^Zone\s* $${zone} | while read line ; do  \
             echo $${line} | awk '{print $$2;}' >> $(TMP_ZNS) ; \
          done  \
        done

        # Build the "default" version
        for zone in $(TIMEZONES); do \
          /usr/sbin/zic -d $(TZGEN) -L /dev/null -y yearistype.sh $${zone} ; \
        done
        # Build the "posix" and "right" versions
ifeq ($(EMDEBIAN),)
        for zone in $(TIMEZONES); do \
          /usr/sbin/zic -d $(TZGEN)/posix -L /dev/null -y yearistype.sh $${zone} ; \
          /usr/sbin/zic -d $(TZGEN)/right -L leapseconds -y $(TZGEN)/yearistype.sh $${zone} ; \
        done
endif

        # Generate a posixrules file
        /usr/sbin/zic -d $(TZGEN) -p America/New_York

        # Find duplicates; from each list of dupes, keep the "real" Zone,
        # and make all the others relative links to it.
        # Replace hardlinks by symlinks
        cd $(TZGEN) ; \
        fdupes -1 -H -q -R . | sed -e 's,\./,,g' | while read line ; do \
           tgt="" ;  \
           for i in $${line} ; do \
              if [ $$(grep -c ^$${i}$$ ../$(TMP_ZNS)) = 1 ] ; \
              then \
                 tgt=$${i} ; \
              fi ; \
           done ; \
 #          if [ ! -z $${tgt} ] ; then \
 #             echo "True Zone: $${tgt}" ; \
 #          else \
 #            echo "Dups: No true Zone match: $${line}" ; \
 #          fi ; \
           if [ ! -z $${tgt} ] ; then \
              for link in $${line} ; do \
#                echo "  Alias: $${link}" ; \
                 if [ $${link} != $${tgt} ] ; then \
                    reltgt="$$(echo $${link} | \
                       sed -e 's,[^/]\+$$,,g' -e 's,[^/]\+,..,g' )$${tgt}" ; \
#                    echo "  RelTgt: $${reltgt}  Link: $${link}" ; \
                    ln -sf $${reltgt} $${link} ; \
                 fi ; \
              done ; \
           fi ; \
           done

        # Shorten and clean up the relative symlinks
        symlinks -r -s -c .

        touch $@

clean:
        -rm -rf $(TZGEN)
        rm -f build-indep-stamp
        rm -f $(TMP_ZNS)


Reply to: