diff options
author | Tom Giordano <tomgiordano83@gmail.com> | 2011-12-22 00:44:14 +1100 |
---|---|---|
committer | Lalit Maganti <lalitmaganti@gmail.com> | 2012-12-02 11:05:51 -0700 |
commit | 4f0cb4136f9f45014befb5ce37d68cef20bcb683 (patch) | |
tree | b92ff695af907f5deca68434069189d2127d1264 /libc/tools | |
parent | 3fa5ca8c673cd46fd4ee33fbc59891791bce5f71 (diff) | |
download | bionic-4f0cb4136f9f45014befb5ce37d68cef20bcb683.zip bionic-4f0cb4136f9f45014befb5ce37d68cef20bcb683.tar.gz bionic-4f0cb4136f9f45014befb5ce37d68cef20bcb683.tar.bz2 |
timezone: data file should be 32 bit aligned
The zoneinfo.dat file is memory mapped and then read as an int array.
On some platforms this is causing alignment errors (SIGBUS) because
the records are not 32 bit aligned.
My changes: Fixes for 4.2 and also updates zoneinfo to the latest version
Change-Id: Ieea8ef07e49ef86d139c52ebfccf4159c0ebd887
Diffstat (limited to 'libc/tools')
-rw-r--r-- | libc/tools/zoneinfo/ZoneCompactor.java | 7 | ||||
-rwxr-xr-x | libc/tools/zoneinfo/generate | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/libc/tools/zoneinfo/ZoneCompactor.java b/libc/tools/zoneinfo/ZoneCompactor.java index b657748..cc77c94 100644 --- a/libc/tools/zoneinfo/ZoneCompactor.java +++ b/libc/tools/zoneinfo/ZoneCompactor.java @@ -55,11 +55,13 @@ public class ZoneCompactor { InputStream in = new FileInputStream(inFile); byte[] buf = new byte[8192]; + int length = 0; while (true) { int nbytes = in.read(buf); if (nbytes == -1) { break; } + length += nbytes; out.write(buf, 0, nbytes); byte[] nret = new byte[ret.length + nbytes]; @@ -67,6 +69,8 @@ public class ZoneCompactor { System.arraycopy(buf, 0, nret, ret.length, nbytes); ret = nret; } + if (length%4 != 0) + out.write(new byte[] {00,00,00,00}, 0, 4 - length % 4); out.flush(); return ret; } @@ -105,6 +109,9 @@ public class ZoneCompactor { lengths.put(s, new Integer((int)length)); start += length; + if (start % 4 != 0) + start += 4 - start % 4; + byte[] data = copyFile(f, zoneInfo); TimeZone tz = ZoneInfo.make(s, data); diff --git a/libc/tools/zoneinfo/generate b/libc/tools/zoneinfo/generate index ab2617f..7017e90 100755 --- a/libc/tools/zoneinfo/generate +++ b/libc/tools/zoneinfo/generate @@ -92,7 +92,7 @@ def upgrade_to(ftp, filename): subprocess.check_call(['javac', '-d', '.', '%s/ZoneCompactor.java' % bionic_libc_tools_zoneinfo_dir, '%s/ZoneInfo.java' % bionic_libc_tools_zoneinfo_dir]) - subprocess.check_call(['java', 'ZoneCompactor', 'setup', 'data']) + subprocess.check_call(['java', '-classpath', '.', 'ZoneCompactor', 'setup', 'data']) print 'Updating bionic from %s to %s...' % (current_tzdata_version(), version) # Move the .dat and .idx files... @@ -116,7 +116,8 @@ ftp.cwd('tz/releases') tzdata_filenames = [] for filename in ftp.nlst(): if filename.startswith('tzdata20'): - tzdata_filenames.append(filename) + if filename.endswith('tar.gz'): + tzdata_filenames.append(filename) tzdata_filenames.sort() # If you're several releases behind, we'll walk you through the upgrades one by one. |