Fix tzdata update tools for 'backzone'.
To maintain the status quo, we need to pull in backzone file. This file
can't be built on its own, so the easiest fix is to give zic(1) all the
files at once.
We also now have a situation where we have links to links, so we need to
dereference them until we find actual data.
Bug: 18330681
Change-Id: I03f4aa8e6e23802dc35cbff2f74f325eb17d7b2b
diff --git a/libc/tools/zoneinfo/ZoneCompactor.java b/libc/tools/zoneinfo/ZoneCompactor.java
index bf3153e..2d598fe 100644
--- a/libc/tools/zoneinfo/ZoneCompactor.java
+++ b/libc/tools/zoneinfo/ZoneCompactor.java
@@ -132,9 +132,15 @@
throw new RuntimeException("zone filename too long: " + zoneName.length());
}
+ // Follow the chain of links to work out where the real data for this zone lives.
+ String actualZoneName = zoneName;
+ while (links.get(actualZoneName) != null) {
+ actualZoneName = links.get(actualZoneName);
+ }
+
f.write(toAscii(new byte[MAXNAME], zoneName));
- f.writeInt(offsets.get(zoneName));
- f.writeInt(lengths.get(zoneName));
+ f.writeInt(offsets.get(actualZoneName));
+ f.writeInt(lengths.get(actualZoneName));
f.writeInt(0); // Used to be raw GMT offset. No longer used.
}