[Pkg-sysvinit-devel] Bug#542515: sysvinit: bootlogd does not flush output buffer

Scott Gifford sgifford at suspectclass.com
Thu Aug 20 00:41:28 UTC 2009


Package: sysvinit
Version: 2.86.ds1-61
Severity: important
Tags: patch


Debian-specific patches to bootlogd introduce a bug where it does not 
flush the standard output buffer at all unless the "-d" flag is passed.  
This often causes single-line messages to be missing from the boot log 
for a long time.

The solution is to call fflush(3) after a full line is retrieved from 
the console, but not call fdatasync(2) unless the "-d" option is given.

This patch may fix the problem; it compiles but is not well-tested yet.

----Scott.


-- System Information:
Debian Release: 5.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages sysvinit depends on:
ii  initscripts                  2.86.ds1-61 Scripts for initializing and shutt
ii  libc6                        2.7-18      GNU C Library: Shared libraries
ii  libselinux1                  2.0.65-5    SELinux shared libraries
ii  libsepol1                    2.0.30-2    Security Enhanced Linux policy lib
ii  sysv-rc                      2.86.ds1-61 System-V-like runlevel change mech
ii  sysvinit-utils               2.86.ds1-61 System-V-like utilities

sysvinit recommends no packages.

sysvinit suggests no packages.

-- no debconf information
-------------- next part --------------
--- bootlogd.c.orig	2009-08-19 20:26:35.000000000 -0400
+++ bootlogd.c	2009-08-19 20:26:56.000000000 -0400
@@ -338,7 +338,7 @@
 				break;
 			case '\n':
 				didnl = 1;
-				dosync = syncalot;
+				dosync = 1;
 				break;
 			case '\t':
 				line.pos += (line.pos / 8 + 1) * 8;
@@ -370,7 +370,9 @@
 
 	if (dosync) {
 		fflush(fp);
-		fdatasync(fileno(fp));
+		if (syncalot) {
+			fdatasync(fileno(fp));
+		}
 	}
 
 	outptr += olen;


More information about the Pkg-sysvinit-devel mailing list