rpms/busybox/devel uClibc-0.9.30.1-etc_localtime.patch, NONE, 1.1 busybox.spec, 1.105, 1.106 uClibc.config, 1.3, 1.4

Denys Vlasenko vda at fedoraproject.org
Wed May 5 10:55:02 UTC 2010


Author: vda

Update of /cvs/extras/rpms/busybox/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv15849

Modified Files:
	busybox.spec uClibc.config 
Added Files:
	uClibc-0.9.30.1-etc_localtime.patch 
Log Message:
* Wed May  5 2010 Denys Vlasenko <dvlasenk at redhat.com> - 1:1.15.1-7
- teach uclibc to use /etc/localtime



uClibc-0.9.30.1-etc_localtime.patch:
 extra/Configs/Config.in |   11 +++++++++++
 libc/misc/time/time.c   |   41 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 51 insertions(+), 1 deletion(-)

--- NEW FILE uClibc-0.9.30.1-etc_localtime.patch ---
diff -urpN uClibc-0.9.30.1/extra/Configs/Config.in uClibc-0.9.30.1-etc_localtime/extra/Configs/Config.in
--- busybox-1.15.1/uClibc-0.9.30.1/extra/Configs/Config.in	2009-02-18 20:51:24.000000000 +0100
+++ busybox-1.15.1/uClibc-0.9.30.1-etc_localtime/extra/Configs/Config.in	2010-04-28 19:11:41.004458022 +0200
@@ -697,6 +697,17 @@ config UCLIBC_TZ_FILE_PATH
 
 	  Most people will use the default of '/etc/TZ'.
 
+config UCLIBC_FALLBACK_TO_ETC_LOCALTIME
+	bool "Use /etc/localtime as a fallback"
+	depends on UCLIBC_HAS_TZ_FILE
+	default y
+	help
+	  Answer Y to try to use /etc/localtime file.
+	  On glibc systems this file (if it is in TZif2 format)
+	  contains timezone string at the end.
+
+	  Most people will answer Y.
+
 endmenu
 
 menu "Advanced Library Settings"
diff -urpN uClibc-0.9.30.1/libc/misc/time/time.c uClibc-0.9.30.1-etc_localtime/libc/misc/time/time.c
--- busybox-1.15.1/uClibc-0.9.30.1/libc/misc/time/time.c	2008-09-25 18:12:29.000000000 +0200
+++ busybox-1.15.1/uClibc-0.9.30.1-etc_localtime/libc/misc/time/time.c	2010-04-28 19:12:16.823208385 +0200
@@ -1830,7 +1830,7 @@ static smallint TZ_file_read;		/* Let BS
 static char *read_TZ_file(char *buf)
 {
 	int fd;
-	ssize_t r;
+	int r;
 	size_t todo;
 	char *p = NULL;
 
@@ -1860,6 +1860,45 @@ ERROR:
 		}
 		close(fd);
 	}
+#ifdef __UCLIBC_FALLBACK_TO_ETC_LOCALTIME__
+	else {
+		fd = open("/etc/localtime", O_RDONLY);
+		if (fd >= 0) {
+			r = read(fd, buf, TZ_BUFLEN);
+			if (r != TZ_BUFLEN
+			 || strncmp(buf, "TZif", 4) != 0
+			 || (unsigned char)buf[4] < 2
+			 || lseek(fd, -TZ_BUFLEN, SEEK_END) < 0
+			) {
+				goto ERROR;
+			}
+			/* tzfile.h from tzcode database says about TZif2+ files:
+			**
+			** If tzh_version is '2' or greater, the above is followed by a second instance
+			** of tzhead and a second instance of the data in which each coded transition
+			** time uses 8 rather than 4 chars,
+			** then a POSIX-TZ-environment-variable-style string for use in handling
+			** instants after the last transition time stored in the file
+			** (with nothing between the newlines if there is no POSIX representation for
+			** such instants).
+			*/
+			r = read(fd, buf, TZ_BUFLEN);
+			if (r <= 0 || buf[--r] != '\n')
+				goto ERROR;
+			buf[r] = 0;
+			while (r != 0) {
+				if (buf[--r] == '\n') {
+					p = buf + r + 1;
+#ifndef __UCLIBC_HAS_TZ_FILE_READ_MANY__
+					TZ_file_read = 1;
+#endif
+					break;
+				}
+			} /* else ('\n' not found): p remains NULL */
+			close(fd);
+		}
+	}
+#endif /* __UCLIBC_FALLBACK_TO_ETC_LOCALTIME__ */
 	return p;
 }
 


Index: busybox.spec
===================================================================
RCS file: /cvs/extras/rpms/busybox/devel/busybox.spec,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -p -r1.105 -r1.106
--- busybox.spec	24 Feb 2010 15:55:55 -0000	1.105
+++ busybox.spec	5 May 2010 10:55:02 -0000	1.106
@@ -1,7 +1,7 @@
 Summary: Statically linked binary providing simplified versions of system commands
 Name: busybox
 Version: 1.15.1
-Release: 6%{?dist}
+Release: 7%{?dist}
 Epoch: 1
 License: GPLv2
 Group: System Environment/Shells
@@ -16,6 +16,7 @@ Patch22: uClibc-0.9.30.1-getline.patch
 Patch23: busybox-1.15.1-man.patch
 Patch24: uClibc-0.9.30.1-utmp.patch
 Patch25: busybox-1.15.1-uname.patch
+Patch26: uClibc-0.9.30.1-etc_localtime.patch
 Obsoletes: busybox-anaconda
 URL: http://www.busybox.net
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -52,6 +53,7 @@ cat %{SOURCE4} >uClibc-0.9.30.1/.config1
 %patch23 -b .man -p1
 %patch24 -b .utmp -p1
 %patch25 -b .uname -p1
+%patch26 -b .etc_localtime -p1
 
 %build
 # create static busybox - the executable is kept as busybox-static
@@ -131,6 +133,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/busybox.petitboot.1.gz
 
 %changelog
+* Wed May  5 2010 Denys Vlasenko <dvlasenk at redhat.com> - 1:1.15.1-7
+- teach uclibc to use /etc/localtime
+
 * Wed Feb 24 2010 Denys Vlasenko <dvlasenk at redhat.com> - 1:1.15.1-6
 - tweak installed docs
 


Index: uClibc.config
===================================================================
RCS file: /cvs/extras/rpms/busybox/devel/uClibc.config,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- uClibc.config	13 Sep 2009 00:26:45 -0000	1.3
+++ uClibc.config	5 May 2010 10:55:02 -0000	1.4
@@ -44,6 +44,7 @@ UCLIBC_HAS_TZ_CACHING=y
 UCLIBC_HAS_TZ_FILE=y
 UCLIBC_HAS_TZ_FILE_READ_MANY=y
 UCLIBC_TZ_FILE_PATH="/etc/TZ"
+UCLIBC_FALLBACK_TO_ETC_LOCALTIME=y
 
 #
 # Advanced Library Settings



More information about the scm-commits mailing list