[arch-commits] Commit in sysvinit/repos (12 files)

Florian Pritz bluewind at archlinux.org
Fri Jun 15 23:09:01 UTC 2012


    Date: Friday, June 15, 2012 @ 19:09:01
  Author: bluewind
Revision: 161862

archrelease: copy trunk to testing-i686, testing-x86_64

Added:
  sysvinit/repos/testing-i686/PKGBUILD
    (from rev 161861, sysvinit/trunk/PKGBUILD)
  sysvinit/repos/testing-i686/simplify-writelog.patch
    (from rev 161861, sysvinit/trunk/simplify-writelog.patch)
  sysvinit/repos/testing-i686/sysvinit.install
    (from rev 161861, sysvinit/trunk/sysvinit.install)
  sysvinit/repos/testing-x86_64/PKGBUILD
    (from rev 161861, sysvinit/trunk/PKGBUILD)
  sysvinit/repos/testing-x86_64/simplify-writelog.patch
    (from rev 161861, sysvinit/trunk/simplify-writelog.patch)
  sysvinit/repos/testing-x86_64/sysvinit.install
    (from rev 161861, sysvinit/trunk/sysvinit.install)
Deleted:
  sysvinit/repos/testing-i686/PKGBUILD
  sysvinit/repos/testing-i686/Remove-handling-of-special-chars-fix-per-line-buffer.patch
  sysvinit/repos/testing-i686/sysvinit.install
  sysvinit/repos/testing-x86_64/PKGBUILD
  sysvinit/repos/testing-x86_64/Remove-handling-of-special-chars-fix-per-line-buffer.patch
  sysvinit/repos/testing-x86_64/sysvinit.install

---------------------------------------------------------------------------+
 testing-i686/PKGBUILD                                                     |   72 +--
 testing-i686/Remove-handling-of-special-chars-fix-per-line-buffer.patch   |  216 ----------
 testing-i686/simplify-writelog.patch                                      |  126 +++++
 testing-i686/sysvinit.install                                             |    6 
 testing-x86_64/PKGBUILD                                                   |   72 +--
 testing-x86_64/Remove-handling-of-special-chars-fix-per-line-buffer.patch |  216 ----------
 testing-x86_64/simplify-writelog.patch                                    |  126 +++++
 testing-x86_64/sysvinit.install                                           |    6 
 8 files changed, 330 insertions(+), 510 deletions(-)

Deleted: testing-i686/PKGBUILD
===================================================================
--- testing-i686/PKGBUILD	2012-06-15 23:08:23 UTC (rev 161861)
+++ testing-i686/PKGBUILD	2012-06-15 23:09:01 UTC (rev 161862)
@@ -1,36 +0,0 @@
-# $Id$
-# Maintainer: Eric Belanger <eric at archlinux.org>
-
-pkgname=sysvinit
-pkgver=2.88
-pkgrel=4
-pkgdesc="Linux System V Init"
-arch=('i686' 'x86_64')
-url="http://savannah.nongnu.org/projects/sysvinit"
-license=('GPL')
-groups=('base')
-depends=('util-linux' 'coreutils' 'glibc' 'awk')
-install=sysvinit.install
-source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2
-        "Remove-handling-of-special-chars-fix-per-line-buffer.patch")
-sha1sums=('f2ca149df1314a91f3007cccd7a0aa47d990de26'
-          'cb1180009cc2ff3ba1bc4fa5609f3d279fed9d0e')
-
-build() {
-  cd "${srcdir}/${pkgname}-${pkgver}dsf"
-
-  # FS#30005
-  patch -p1 -d "src" -i "${srcdir}/Remove-handling-of-special-chars-fix-per-line-buffer.patch"
-
-  make 
-}
-
-package() {
-  cd "${srcdir}/${pkgname}-${pkgver}dsf"
-  make ROOT="${pkgdir}" install
-
-  # mountpoint is now provided by util-linux instead
-  cd "${pkgdir}"
-  rm bin/mountpoint
-  rm usr/share/man/man1/mountpoint.1
-}

Copied: sysvinit/repos/testing-i686/PKGBUILD (from rev 161861, sysvinit/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD	                        (rev 0)
+++ testing-i686/PKGBUILD	2012-06-15 23:09:01 UTC (rev 161862)
@@ -0,0 +1,36 @@
+# $Id$
+# Maintainer: Eric Belanger <eric at archlinux.org>
+
+pkgname=sysvinit
+pkgver=2.88
+pkgrel=5
+pkgdesc="Linux System V Init"
+arch=('i686' 'x86_64')
+url="http://savannah.nongnu.org/projects/sysvinit"
+license=('GPL')
+groups=('base')
+depends=('util-linux' 'coreutils' 'glibc' 'awk')
+install=sysvinit.install
+source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2
+        "simplify-writelog.patch")
+sha1sums=('f2ca149df1314a91f3007cccd7a0aa47d990de26'
+          'd970e44e8b5574b3b6be709c7682845a974ed1ed')
+
+build() {
+  cd "${srcdir}/${pkgname}-${pkgver}dsf"
+
+  # FS#30005
+  patch -p1 -d "src" -i "${srcdir}/simplify-writelog.patch"
+
+  make 
+}
+
+package() {
+  cd "${srcdir}/${pkgname}-${pkgver}dsf"
+  make ROOT="${pkgdir}" install
+
+  # mountpoint is now provided by util-linux instead
+  cd "${pkgdir}"
+  rm bin/mountpoint
+  rm usr/share/man/man1/mountpoint.1
+}

Deleted: testing-i686/Remove-handling-of-special-chars-fix-per-line-buffer.patch
===================================================================
--- testing-i686/Remove-handling-of-special-chars-fix-per-line-buffer.patch	2012-06-15 23:08:23 UTC (rev 161861)
+++ testing-i686/Remove-handling-of-special-chars-fix-per-line-buffer.patch	2012-06-15 23:09:01 UTC (rev 161862)
@@ -1,216 +0,0 @@
-From 4d2b17f47073e0491f9dfa62797cc727d4530f22 Mon Sep 17 00:00:00 2001
-From: Florian Pritz <bluewind at xinu.at>
-Date: Tue, 22 May 2012 22:14:52 +0200
-Subject: [PATCH] Remove handling of special chars; fix per line buffer
- problem
-
-The linebuffer was only 256 chars so longer lines were truncated.
-
-By removing the handling of special chars (for example: /n/r/t) and
-simply writing everything we read as is to the logfile we fix this bug,
-make the code much smaller and allow users to write userspace tools that
-correctly handle rendering.
-
-Signed-off-by: Florian Pritz <bluewind at xinu.at>
----
- bootlogd.c |  139 +++++++++---------------------------------------------------
- 1 file changed, 19 insertions(+), 120 deletions(-)
-
-diff --git a/bootlogd.c b/bootlogd.c
-index 570d382..5df8fb9 100644
---- a/bootlogd.c
-+++ b/bootlogd.c
-@@ -58,21 +58,10 @@ char *Version = "@(#) bootlogd 2.86 03-Jun-2004 miquels at cistron.nl";
- 
- #define LOGFILE	"/var/log/boot"
- 
--char ringbuf[32768];
--char *endptr = ringbuf + sizeof(ringbuf);
--char *inptr  = ringbuf;
--char *outptr = ringbuf;
--
- int got_signal = 0;
--int didnl = 1;
- int createlogfile = 0;
- int syncalot = 0;
- 
--struct line {
--	char buf[256];
--	int pos;
--} line;
--
- /*
-  *	Console devices as listed on the kernel command line and
-  *	the mapping to actual devices in /dev
-@@ -345,83 +334,6 @@ int consolename(char *res, int rlen)
- 	return -1;
- }
- 
--
--/*
-- *	Write data and make sure it's on disk.
-- */
--void writelog(FILE *fp, unsigned char *ptr, int len)
--{
--	time_t		t;
--	char		*s;
--	char		tmp[8];
--	int		olen = len;
--	int		dosync = 0;
--	int		tlen;
--
--	while (len > 0) {
--		tmp[0] = 0;
--		if (didnl) {
--			time(&t);
--			s = ctime(&t);
--			fprintf(fp, "%.24s: ", s);
--			didnl = 0;
--		}
--		switch (*ptr) {
--			case 27: /* ESC */
--				strcpy(tmp, "^[");
--				break;
--			case '\r':
--				line.pos = 0;
--				break;
--			case 8: /* ^H */
--				if (line.pos > 0) line.pos--;
--				break;
--			case '\n':
--				didnl = 1;
--				dosync = 1;
--				break;
--			case '\t':
--				line.pos += (line.pos / 8 + 1) * 8;
--				if (line.pos >= (int)sizeof(line.buf))
--					line.pos = sizeof(line.buf) - 1;
--				break;
--			case  32 ... 127:
--			case 161 ... 255:
--				tmp[0] = *ptr;
--				tmp[1] = 0;
--				break;
--			default:
--				sprintf(tmp, "\\%03o", *ptr);
--				break;
--		}
--		ptr++;
--		len--;
--
--		tlen = strlen(tmp);
--		if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
--			memcpy(line.buf + line.pos, tmp, tlen);
--			line.pos += tlen;
--		}
--		if (didnl) {
--			fprintf(fp, "%s\n", line.buf);
--			memset(&line, 0, sizeof(line));
--		}
--	}
--
--	if (dosync) {
--		fflush(fp);
--		if (syncalot) {
--			fdatasync(fileno(fp));
--		}
--	}
--
--	outptr += olen;
--	if (outptr >= endptr)
--		outptr = ringbuf;
--
--}
--
--
- /*
-  *	Print usage message and exit.
-  */
-@@ -481,7 +393,6 @@ int main(int argc, char **argv)
- 	int		ptm, pts;
- 	int		realfd;
- 	int		n, m, i;
--	int		todo;
- 
- 	fp = NULL;
- 	logfile = LOGFILE;
-@@ -615,13 +526,13 @@ int main(int argc, char **argv)
- 			/*
- 			 *	See how much space there is left, read.
- 			 */
--			if ((n = read(ptm, inptr, endptr - inptr)) >= 0) {
-+			if ((n = read(ptm, buf, sizeof(buf))) >= 0) {
- 				/*
- 				 *	Write data (in chunks if needed)
- 				 *	to the real output device.
- 				 */
- 				m = n;
--				p = inptr;
-+				p = buf;
- 				while (m > 0) {
- 					i = write(realfd, p, m);
- 					if (i >= 0) {
-@@ -641,43 +552,31 @@ int main(int argc, char **argv)
- 				}
- 
- 				/*
--				 *	Increment buffer position. Handle
--				 *	wraps, and also drag output pointer
--				 *	along if we cross it.
-+				 *	Perhaps we need to open the logfile.
- 				 */
--				inptr += n;
--				if (inptr - n < outptr && inptr > outptr)
--					outptr = inptr;
--				if (inptr >= endptr)
--					inptr = ringbuf;
--				if (outptr >= endptr)
--					outptr = ringbuf;
--			}
--		}
-+				if (fp == NULL && access(logfile, F_OK) == 0) {
-+					if (rotate) {
-+						snprintf(buf, sizeof(buf), "%s~", logfile);
-+						rename(logfile, buf);
-+					}
-+					fp = fopen(logfile, "a");
-+				}
-+				if (fp == NULL && createlogfile)
-+					fp = fopen(logfile, "a");
- 
--		/*
--		 *	Perhaps we need to open the logfile.
--		 */
--		if (fp == NULL && access(logfile, F_OK) == 0) {
--			if (rotate) {
--				snprintf(buf, sizeof(buf), "%s~", logfile);
--				rename(logfile, buf);
-+				if (fp) {
-+					write(fileno(fp), buf, n);
-+				}
-+
-+				if (syncalot) {
-+					fdatasync(fileno(fp));
-+				}
- 			}
--			fp = fopen(logfile, "a");
- 		}
--		if (fp == NULL && createlogfile)
--			fp = fopen(logfile, "a");
- 
--		if (inptr >= outptr)
--			todo = inptr - outptr;
--		else
--			todo = endptr - outptr;
--		if (fp && todo)
--			writelog(fp, (unsigned char *)outptr, todo);
- 	}
- 
- 	if (fp) {
--		if (!didnl) fputc('\n', fp);
- 		fclose(fp);
- 	}
- 
--- 
-1.7.10.2
-

Copied: sysvinit/repos/testing-i686/simplify-writelog.patch (from rev 161861, sysvinit/trunk/simplify-writelog.patch)
===================================================================
--- testing-i686/simplify-writelog.patch	                        (rev 0)
+++ testing-i686/simplify-writelog.patch	2012-06-15 23:09:01 UTC (rev 161862)
@@ -0,0 +1,126 @@
+From 5577552eb1344ddd661893564b1e628f8edcf13d Mon Sep 17 00:00:00 2001
+From: Florian Pritz <bluewind at xinu.at>
+Date: Fri, 15 Jun 2012 16:41:52 +0200
+Subject: [PATCH] simplify writelog()
+
+All we do is prepend the date and remove \r. We don't handle color
+codes, but the user can just cat the log file in a terminal and it will
+interpret the codes correctly.
+
+Signed-off-by: Florian Pritz <bluewind at xinu.at>
+---
+ bootlogd.c |   76 +++++++++++++++++-------------------------------------------
+ 1 file changed, 21 insertions(+), 55 deletions(-)
+
+diff --git a/bootlogd.c b/bootlogd.c
+index 570d382..e36e261 100644
+--- a/bootlogd.c
++++ b/bootlogd.c
+@@ -68,11 +68,6 @@ int didnl = 1;
+ int createlogfile = 0;
+ int syncalot = 0;
+ 
+-struct line {
+-	char buf[256];
+-	int pos;
+-} line;
+-
+ /*
+  *	Console devices as listed on the kernel command line and
+  *	the mapping to actual devices in /dev
+@@ -351,63 +346,34 @@ int consolename(char *res, int rlen)
+  */
+ void writelog(FILE *fp, unsigned char *ptr, int len)
+ {
+-	time_t		t;
+-	char		*s;
+-	char		tmp[8];
+-	int		olen = len;
+-	int		dosync = 0;
+-	int		tlen;
+-
+-	while (len > 0) {
+-		tmp[0] = 0;
+-		if (didnl) {
++	int dosync = 0;
++	int i;
++	static int first_run = 1;
++
++	for (i = 0; i < len; i++) {
++		int ignore = 0;
++
++		/* prepend date to every line */
++		if (*(ptr-1) == '\n' || first_run) {
++			time_t t;
++			char *s;
+ 			time(&t);
+ 			s = ctime(&t);
+ 			fprintf(fp, "%.24s: ", s);
+-			didnl = 0;
++			dosync = 1;
++			first_run = 0;
+ 		}
+-		switch (*ptr) {
+-			case 27: /* ESC */
+-				strcpy(tmp, "^[");
+-				break;
+-			case '\r':
+-				line.pos = 0;
+-				break;
+-			case 8: /* ^H */
+-				if (line.pos > 0) line.pos--;
+-				break;
+-			case '\n':
+-				didnl = 1;
+-				dosync = 1;
+-				break;
+-			case '\t':
+-				line.pos += (line.pos / 8 + 1) * 8;
+-				if (line.pos >= (int)sizeof(line.buf))
+-					line.pos = sizeof(line.buf) - 1;
+-				break;
+-			case  32 ... 127:
+-			case 161 ... 255:
+-				tmp[0] = *ptr;
+-				tmp[1] = 0;
+-				break;
+-			default:
+-				sprintf(tmp, "\\%03o", *ptr);
+-				break;
+-		}
+-		ptr++;
+-		len--;
+ 
+-		tlen = strlen(tmp);
+-		if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
+-			memcpy(line.buf + line.pos, tmp, tlen);
+-			line.pos += tlen;
++		if (*ptr == '\r') {
++			ignore = 1;
+ 		}
+-		if (didnl) {
+-			fprintf(fp, "%s\n", line.buf);
+-			memset(&line, 0, sizeof(line));
++
++		if (!ignore) {
++			fwrite(ptr, sizeof(char), 1, fp);
+ 		}
+-	}
+ 
++		ptr++;
++	}
+ 	if (dosync) {
+ 		fflush(fp);
+ 		if (syncalot) {
+@@ -415,7 +381,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
+ 		}
+ 	}
+ 
+-	outptr += olen;
++	outptr += len;
+ 	if (outptr >= endptr)
+ 		outptr = ringbuf;
+ 
+-- 
+1.7.10.4
+

Deleted: testing-i686/sysvinit.install
===================================================================
--- testing-i686/sysvinit.install	2012-06-15 23:08:23 UTC (rev 161861)
+++ testing-i686/sysvinit.install	2012-06-15 23:09:01 UTC (rev 161862)
@@ -1,3 +0,0 @@
-post_upgrade() {
-  [ -x sbin/init ] && sbin/init u
-}

Copied: sysvinit/repos/testing-i686/sysvinit.install (from rev 161861, sysvinit/trunk/sysvinit.install)
===================================================================
--- testing-i686/sysvinit.install	                        (rev 0)
+++ testing-i686/sysvinit.install	2012-06-15 23:09:01 UTC (rev 161862)
@@ -0,0 +1,3 @@
+post_upgrade() {
+  [ -x sbin/init ] && sbin/init u
+}

Deleted: testing-x86_64/PKGBUILD
===================================================================
--- testing-x86_64/PKGBUILD	2012-06-15 23:08:23 UTC (rev 161861)
+++ testing-x86_64/PKGBUILD	2012-06-15 23:09:01 UTC (rev 161862)
@@ -1,36 +0,0 @@
-# $Id$
-# Maintainer: Eric Belanger <eric at archlinux.org>
-
-pkgname=sysvinit
-pkgver=2.88
-pkgrel=4
-pkgdesc="Linux System V Init"
-arch=('i686' 'x86_64')
-url="http://savannah.nongnu.org/projects/sysvinit"
-license=('GPL')
-groups=('base')
-depends=('util-linux' 'coreutils' 'glibc' 'awk')
-install=sysvinit.install
-source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2
-        "Remove-handling-of-special-chars-fix-per-line-buffer.patch")
-sha1sums=('f2ca149df1314a91f3007cccd7a0aa47d990de26'
-          'cb1180009cc2ff3ba1bc4fa5609f3d279fed9d0e')
-
-build() {
-  cd "${srcdir}/${pkgname}-${pkgver}dsf"
-
-  # FS#30005
-  patch -p1 -d "src" -i "${srcdir}/Remove-handling-of-special-chars-fix-per-line-buffer.patch"
-
-  make 
-}
-
-package() {
-  cd "${srcdir}/${pkgname}-${pkgver}dsf"
-  make ROOT="${pkgdir}" install
-
-  # mountpoint is now provided by util-linux instead
-  cd "${pkgdir}"
-  rm bin/mountpoint
-  rm usr/share/man/man1/mountpoint.1
-}

Copied: sysvinit/repos/testing-x86_64/PKGBUILD (from rev 161861, sysvinit/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD	                        (rev 0)
+++ testing-x86_64/PKGBUILD	2012-06-15 23:09:01 UTC (rev 161862)
@@ -0,0 +1,36 @@
+# $Id$
+# Maintainer: Eric Belanger <eric at archlinux.org>
+
+pkgname=sysvinit
+pkgver=2.88
+pkgrel=5
+pkgdesc="Linux System V Init"
+arch=('i686' 'x86_64')
+url="http://savannah.nongnu.org/projects/sysvinit"
+license=('GPL')
+groups=('base')
+depends=('util-linux' 'coreutils' 'glibc' 'awk')
+install=sysvinit.install
+source=(http://download.savannah.gnu.org/releases/sysvinit/${pkgname}-${pkgver}dsf.tar.bz2
+        "simplify-writelog.patch")
+sha1sums=('f2ca149df1314a91f3007cccd7a0aa47d990de26'
+          'd970e44e8b5574b3b6be709c7682845a974ed1ed')
+
+build() {
+  cd "${srcdir}/${pkgname}-${pkgver}dsf"
+
+  # FS#30005
+  patch -p1 -d "src" -i "${srcdir}/simplify-writelog.patch"
+
+  make 
+}
+
+package() {
+  cd "${srcdir}/${pkgname}-${pkgver}dsf"
+  make ROOT="${pkgdir}" install
+
+  # mountpoint is now provided by util-linux instead
+  cd "${pkgdir}"
+  rm bin/mountpoint
+  rm usr/share/man/man1/mountpoint.1
+}

Deleted: testing-x86_64/Remove-handling-of-special-chars-fix-per-line-buffer.patch
===================================================================
--- testing-x86_64/Remove-handling-of-special-chars-fix-per-line-buffer.patch	2012-06-15 23:08:23 UTC (rev 161861)
+++ testing-x86_64/Remove-handling-of-special-chars-fix-per-line-buffer.patch	2012-06-15 23:09:01 UTC (rev 161862)
@@ -1,216 +0,0 @@
-From 4d2b17f47073e0491f9dfa62797cc727d4530f22 Mon Sep 17 00:00:00 2001
-From: Florian Pritz <bluewind at xinu.at>
-Date: Tue, 22 May 2012 22:14:52 +0200
-Subject: [PATCH] Remove handling of special chars; fix per line buffer
- problem
-
-The linebuffer was only 256 chars so longer lines were truncated.
-
-By removing the handling of special chars (for example: /n/r/t) and
-simply writing everything we read as is to the logfile we fix this bug,
-make the code much smaller and allow users to write userspace tools that
-correctly handle rendering.
-
-Signed-off-by: Florian Pritz <bluewind at xinu.at>
----
- bootlogd.c |  139 +++++++++---------------------------------------------------
- 1 file changed, 19 insertions(+), 120 deletions(-)
-
-diff --git a/bootlogd.c b/bootlogd.c
-index 570d382..5df8fb9 100644
---- a/bootlogd.c
-+++ b/bootlogd.c
-@@ -58,21 +58,10 @@ char *Version = "@(#) bootlogd 2.86 03-Jun-2004 miquels at cistron.nl";
- 
- #define LOGFILE	"/var/log/boot"
- 
--char ringbuf[32768];
--char *endptr = ringbuf + sizeof(ringbuf);
--char *inptr  = ringbuf;
--char *outptr = ringbuf;
--
- int got_signal = 0;
--int didnl = 1;
- int createlogfile = 0;
- int syncalot = 0;
- 
--struct line {
--	char buf[256];
--	int pos;
--} line;
--
- /*
-  *	Console devices as listed on the kernel command line and
-  *	the mapping to actual devices in /dev
-@@ -345,83 +334,6 @@ int consolename(char *res, int rlen)
- 	return -1;
- }
- 
--
--/*
-- *	Write data and make sure it's on disk.
-- */
--void writelog(FILE *fp, unsigned char *ptr, int len)
--{
--	time_t		t;
--	char		*s;
--	char		tmp[8];
--	int		olen = len;
--	int		dosync = 0;
--	int		tlen;
--
--	while (len > 0) {
--		tmp[0] = 0;
--		if (didnl) {
--			time(&t);
--			s = ctime(&t);
--			fprintf(fp, "%.24s: ", s);
--			didnl = 0;
--		}
--		switch (*ptr) {
--			case 27: /* ESC */
--				strcpy(tmp, "^[");
--				break;
--			case '\r':
--				line.pos = 0;
--				break;
--			case 8: /* ^H */
--				if (line.pos > 0) line.pos--;
--				break;
--			case '\n':
--				didnl = 1;
--				dosync = 1;
--				break;
--			case '\t':
--				line.pos += (line.pos / 8 + 1) * 8;
--				if (line.pos >= (int)sizeof(line.buf))
--					line.pos = sizeof(line.buf) - 1;
--				break;
--			case  32 ... 127:
--			case 161 ... 255:
--				tmp[0] = *ptr;
--				tmp[1] = 0;
--				break;
--			default:
--				sprintf(tmp, "\\%03o", *ptr);
--				break;
--		}
--		ptr++;
--		len--;
--
--		tlen = strlen(tmp);
--		if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
--			memcpy(line.buf + line.pos, tmp, tlen);
--			line.pos += tlen;
--		}
--		if (didnl) {
--			fprintf(fp, "%s\n", line.buf);
--			memset(&line, 0, sizeof(line));
--		}
--	}
--
--	if (dosync) {
--		fflush(fp);
--		if (syncalot) {
--			fdatasync(fileno(fp));
--		}
--	}
--
--	outptr += olen;
--	if (outptr >= endptr)
--		outptr = ringbuf;
--
--}
--
--
- /*
-  *	Print usage message and exit.
-  */
-@@ -481,7 +393,6 @@ int main(int argc, char **argv)
- 	int		ptm, pts;
- 	int		realfd;
- 	int		n, m, i;
--	int		todo;
- 
- 	fp = NULL;
- 	logfile = LOGFILE;
-@@ -615,13 +526,13 @@ int main(int argc, char **argv)
- 			/*
- 			 *	See how much space there is left, read.
- 			 */
--			if ((n = read(ptm, inptr, endptr - inptr)) >= 0) {
-+			if ((n = read(ptm, buf, sizeof(buf))) >= 0) {
- 				/*
- 				 *	Write data (in chunks if needed)
- 				 *	to the real output device.
- 				 */
- 				m = n;
--				p = inptr;
-+				p = buf;
- 				while (m > 0) {
- 					i = write(realfd, p, m);
- 					if (i >= 0) {
-@@ -641,43 +552,31 @@ int main(int argc, char **argv)
- 				}
- 
- 				/*
--				 *	Increment buffer position. Handle
--				 *	wraps, and also drag output pointer
--				 *	along if we cross it.
-+				 *	Perhaps we need to open the logfile.
- 				 */
--				inptr += n;
--				if (inptr - n < outptr && inptr > outptr)
--					outptr = inptr;
--				if (inptr >= endptr)
--					inptr = ringbuf;
--				if (outptr >= endptr)
--					outptr = ringbuf;
--			}
--		}
-+				if (fp == NULL && access(logfile, F_OK) == 0) {
-+					if (rotate) {
-+						snprintf(buf, sizeof(buf), "%s~", logfile);
-+						rename(logfile, buf);
-+					}
-+					fp = fopen(logfile, "a");
-+				}
-+				if (fp == NULL && createlogfile)
-+					fp = fopen(logfile, "a");
- 
--		/*
--		 *	Perhaps we need to open the logfile.
--		 */
--		if (fp == NULL && access(logfile, F_OK) == 0) {
--			if (rotate) {
--				snprintf(buf, sizeof(buf), "%s~", logfile);
--				rename(logfile, buf);
-+				if (fp) {
-+					write(fileno(fp), buf, n);
-+				}
-+
-+				if (syncalot) {
-+					fdatasync(fileno(fp));
-+				}
- 			}
--			fp = fopen(logfile, "a");
- 		}
--		if (fp == NULL && createlogfile)
--			fp = fopen(logfile, "a");
- 
--		if (inptr >= outptr)
--			todo = inptr - outptr;
--		else
--			todo = endptr - outptr;
--		if (fp && todo)
--			writelog(fp, (unsigned char *)outptr, todo);
- 	}
- 
- 	if (fp) {
--		if (!didnl) fputc('\n', fp);
- 		fclose(fp);
- 	}
- 
--- 
-1.7.10.2
-

Copied: sysvinit/repos/testing-x86_64/simplify-writelog.patch (from rev 161861, sysvinit/trunk/simplify-writelog.patch)
===================================================================
--- testing-x86_64/simplify-writelog.patch	                        (rev 0)
+++ testing-x86_64/simplify-writelog.patch	2012-06-15 23:09:01 UTC (rev 161862)
@@ -0,0 +1,126 @@
+From 5577552eb1344ddd661893564b1e628f8edcf13d Mon Sep 17 00:00:00 2001
+From: Florian Pritz <bluewind at xinu.at>
+Date: Fri, 15 Jun 2012 16:41:52 +0200
+Subject: [PATCH] simplify writelog()
+
+All we do is prepend the date and remove \r. We don't handle color
+codes, but the user can just cat the log file in a terminal and it will
+interpret the codes correctly.
+
+Signed-off-by: Florian Pritz <bluewind at xinu.at>
+---
+ bootlogd.c |   76 +++++++++++++++++-------------------------------------------
+ 1 file changed, 21 insertions(+), 55 deletions(-)
+
+diff --git a/bootlogd.c b/bootlogd.c
+index 570d382..e36e261 100644
+--- a/bootlogd.c
++++ b/bootlogd.c
+@@ -68,11 +68,6 @@ int didnl = 1;
+ int createlogfile = 0;
+ int syncalot = 0;
+ 
+-struct line {
+-	char buf[256];
+-	int pos;
+-} line;
+-
+ /*
+  *	Console devices as listed on the kernel command line and
+  *	the mapping to actual devices in /dev
+@@ -351,63 +346,34 @@ int consolename(char *res, int rlen)
+  */
+ void writelog(FILE *fp, unsigned char *ptr, int len)
+ {
+-	time_t		t;
+-	char		*s;
+-	char		tmp[8];
+-	int		olen = len;
+-	int		dosync = 0;
+-	int		tlen;
+-
+-	while (len > 0) {
+-		tmp[0] = 0;
+-		if (didnl) {
++	int dosync = 0;
++	int i;
++	static int first_run = 1;
++
++	for (i = 0; i < len; i++) {
++		int ignore = 0;
++
++		/* prepend date to every line */
++		if (*(ptr-1) == '\n' || first_run) {
++			time_t t;
++			char *s;
+ 			time(&t);
+ 			s = ctime(&t);
+ 			fprintf(fp, "%.24s: ", s);
+-			didnl = 0;
++			dosync = 1;
++			first_run = 0;
+ 		}
+-		switch (*ptr) {
+-			case 27: /* ESC */
+-				strcpy(tmp, "^[");
+-				break;
+-			case '\r':
+-				line.pos = 0;
+-				break;
+-			case 8: /* ^H */
+-				if (line.pos > 0) line.pos--;
+-				break;
+-			case '\n':
+-				didnl = 1;
+-				dosync = 1;
+-				break;
+-			case '\t':
+-				line.pos += (line.pos / 8 + 1) * 8;
+-				if (line.pos >= (int)sizeof(line.buf))
+-					line.pos = sizeof(line.buf) - 1;
+-				break;
+-			case  32 ... 127:
+-			case 161 ... 255:
+-				tmp[0] = *ptr;
+-				tmp[1] = 0;
+-				break;
+-			default:
+-				sprintf(tmp, "\\%03o", *ptr);
+-				break;
+-		}
+-		ptr++;
+-		len--;
+ 
+-		tlen = strlen(tmp);
+-		if (tlen && (line.pos + tlen < (int)sizeof(line.buf))) {
+-			memcpy(line.buf + line.pos, tmp, tlen);
+-			line.pos += tlen;
++		if (*ptr == '\r') {
++			ignore = 1;
+ 		}
+-		if (didnl) {
+-			fprintf(fp, "%s\n", line.buf);
+-			memset(&line, 0, sizeof(line));
++
++		if (!ignore) {
++			fwrite(ptr, sizeof(char), 1, fp);
+ 		}
+-	}
+ 
++		ptr++;
++	}
+ 	if (dosync) {
+ 		fflush(fp);
+ 		if (syncalot) {
+@@ -415,7 +381,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
+ 		}
+ 	}
+ 
+-	outptr += olen;
++	outptr += len;
+ 	if (outptr >= endptr)
+ 		outptr = ringbuf;
+ 
+-- 
+1.7.10.4
+

Deleted: testing-x86_64/sysvinit.install
===================================================================
--- testing-x86_64/sysvinit.install	2012-06-15 23:08:23 UTC (rev 161861)
+++ testing-x86_64/sysvinit.install	2012-06-15 23:09:01 UTC (rev 161862)
@@ -1,3 +0,0 @@
-post_upgrade() {
-  [ -x sbin/init ] && sbin/init u
-}

Copied: sysvinit/repos/testing-x86_64/sysvinit.install (from rev 161861, sysvinit/trunk/sysvinit.install)
===================================================================
--- testing-x86_64/sysvinit.install	                        (rev 0)
+++ testing-x86_64/sysvinit.install	2012-06-15 23:09:01 UTC (rev 161862)
@@ -0,0 +1,3 @@
+post_upgrade() {
+  [ -x sbin/init ] && sbin/init u
+}




More information about the arch-commits mailing list