Subject: bin/36537: sync(8) should not return until the buffers are flushed
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Greg A. Woods <woods@planix.com>
List: netbsd-bugs
Date: 06/23/2007 19:15:01
>Number:         36537
>Category:       bin
>Synopsis:       sync(8) should not return until the buffers are flushed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 23 19:15:00 +0000 2007
>Originator:     Greg A. Woods
>Release:        netbsd-4 2007/06/22
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
	
	
System: NetBSD
>Descriptionp:

	sync(8), the command, should not return until all the buffers
	are flushed.  It's just plain silly to expect users to remember
	to do three calls.

	the rationale for why three sync(2) calls is explained here:

	http://mail-index.netbsd.org/current-users/2003/06/23/0000.html

>Description:
 	
 	
>How-To-Repeat:
	
>Fix:

Index: bin/sync/sync.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/bin/sync/sync.c,v
retrieving revision 1.12
diff -u -r1.12 sync.c
--- bin/sync/sync.c	7 Aug 2003 09:05:43 -0000	1.12
+++ bin/sync/sync.c	7 Jun 2006 16:53:27 -0000
@@ -53,7 +53,11 @@
 main(int argc, char *argv[])
 {
 	setprogname(argv[0]);
+	/* see http://mail-index.netbsd.org/current-users/2003/06/23/0000.html for why three */
 	sync();
+	sync();
+	sync();
+
 	exit(0);
 	/* NOTREACHED */
 }