From nobody@FreeBSD.org  Fri Oct 11 06:06:58 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1AD3C37B401
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Oct 2002 06:06:58 -0700 (PDT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 99F7443E91
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Oct 2002 06:06:57 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g9BD6r7R055036
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Oct 2002 06:06:53 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.6/8.12.6/Submit) id g9BD6r9f055035;
	Fri, 11 Oct 2002 06:06:53 -0700 (PDT)
Message-Id: <200210111306.g9BD6r9f055035@www.freebsd.org>
Date: Fri, 11 Oct 2002 06:06:53 -0700 (PDT)
From: Jason Li <delphij@frontfree.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH]mergemaster in -STABLE produces unnecessary output
X-Send-Pr-Version: www-1.0

>Number:         43928
>Category:       misc
>Synopsis:       [PATCH]mergemaster in -STABLE produces unnecessary output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 11 06:10:01 PDT 2002
>Closed-Date:    Fri Oct 25 01:01:43 PDT 2002
>Last-Modified:  Fri Oct 25 01:01:43 PDT 2002
>Originator:     Jason Li
>Release:        4.7-STABLE
>Organization:
Frontfree Technology Network
>Environment:
FreeBSD mail.frontfree.net 4.7-STABLE FreeBSD 4.7-STABLE #12: Fri Oct 11 14:50:12 CST 2002     delphij@mail.frontfree.net:/usr/obj/usr/src/sys/MAIL  i386
>Description:
The mergemaster(8) utility helps us to merge configuration files. There's the following code in the mergemaster program itself:

delete_temproot () {
  rm -rf "${TEMPROOT}"
  chflags -R 0 "${TEMPROOT}"
  rm -rf "${TEMPROOT}" 
}

When running the mergemaster utility, it will give the following message at the final stage of its execution

rm: /var/tmp/temproot/var/empty: Operation not permitted
rm: /var/tmp/temproot/var: Directory not empty
rm: /var/tmp/temproot: Directory not empty
 *** /var/tmp/temproot has been deleted

I think the first 3 lines are not desired, because in -CURRENT there's not such lines, while not outputing these lines doesn't produce any things which affects stablity.

My solution is to copy delete_temproot from -CURRENT code to -STABLE.

The difference between the -stable and -current(which is included below) is mainly about the output. In -current, no error message will go to user console, while if there's some error, the script will stop. This behavior is correct and the change won't affect stablity of -STABLE. The schg flag for temproot/empty will obviously cause rm to output error message, which is not what user need because the problem will soon solved by chflags.
>How-To-Repeat:
mergemaster under -STABLE
>Fix:
Here is a diff between my patched mergemaster script under src[src/usr.sbin/mergemaster/mergemaster.sh] and the original one:

--- mergemaster.sh.orig Fri Oct 11 21:00:21 2002
+++ mergemaster.sh      Fri Oct 11 21:00:57 2002
@@ -398,9 +398,9 @@
 CVS_ID_TAG=FreeBSD
 
 delete_temproot () {
-  rm -rf "${TEMPROOT}"
-  chflags -R 0 "${TEMPROOT}"
-  rm -rf "${TEMPROOT}"
+  rm -rf "${TEMPROOT}" 2>/dev/null          
+  chflags -R 0 "${TEMPROOT}" 2>/dev/null    
+  rm -rf "${TEMPROOT}" || exit 1
 }
 
 case "${RERUN}" in
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: johan 
Responsible-Changed-When: Fri Oct 11 10:58:53 PDT 2002 
Responsible-Changed-Why:  
Over to mergemaster maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43928 
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Fri Oct 25 01:01:02 PDT 2002 
State-Changed-Why:  

Thanks for your patch. I've committed the fix that I had 
in my own queue already though, that also has some other 
fixes included. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43928 
>Unformatted:
