Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Oct 2002 06:06:53 -0700 (PDT)
From:      Jason Li <delphij@frontfree.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/43928: [PATCH]mergemaster in -STABLE produces unnecessary output
Message-ID:  <200210111306.g9BD6r9f055035@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         43928
>Category:       misc
>Synopsis:       [PATCH]mergemaster in -STABLE produces unnecessary output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 11 06:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210111306.g9BD6r9f055035>