From rwsys!sneaky.lonestar.org!gordon@lerami.lerctr.org  Tue Jul 18 21:15:00 1995
Received: from news.onramp.net (news.onramp.net [199.1.11.7])
          by freefall.cdrom.com (8.6.11/8.6.6) with ESMTP id VAA02837
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 18 Jul 1995 21:14:58 -0700
Received: from rwsys!sneaky.lonestar.org (uucp@localhost) 
	by news.onramp.net (8.6.12/8.6.9) with UUCP id XAA07817 for FreeBSD-gnats-submit@freebsd.org; Tue, 18 Jul 1995 23:14:56 -0500
Received: by lerami.lerctr.org (/\oo/\ Smail3.1.29.1 #29.2)
	id <m0sYQCF-0000H2C@lerami.lerctr.org>; Tue, 18 Jul 95 22:53 CDT
Received: by rwsys.lonestar.org (Smail3.1.27.1 #1)
	id m0sYOqX-00004IC; Tue, 18 Jul 95 21:26 CDT
Received: by hammy.lonestar.org (Smail3.1.29.0 #1)
	id m0sYOI6-0001hSC; Tue, 18 Jul 95 20:51 CDT
Message-Id: <m0sYOI6-0001hSC@hammy.lonestar.org>
Date: Tue, 18 Jul 95 20:51 CDT
From: gordon@sneaky.lonestar.org
Reply-To: gordon@sneaky.lonestar.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: mtree(8) changes file modes and owners it shouldn't
X-Send-Pr-Version: 3.2

>Number:         623
>Category:       bin
>Synopsis:       mtree(8) changes file modes and owners it shouldn't
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 18 21:20:00 1995
>Closed-Date:    Sun Jul 23 20:54:52 PDT 1995
>Last-Modified:
>Originator:     Gordon Burditt
>Release:        FreeBSD 2.0-BUILT-19950603 i386
>Organization:
what organization? 
>Environment:

	FreeBSD 2.0.5

>Description:

	mtree(8) seems to change modes and owners of files not contained in
	the description file if files with the same last component are 
	described elsewhere in the description.

	This was originally discovered when it appeared that a 
	slightly modified BSD.local.dist and BSD.usr.dist were fighting 
	over the permissions of /usr/local/bin when BSD.usr.dist contained
	no specification for them.

>How-To-Repeat:
% su root
# cat > /tmp/mtree
# This is a cut-down version of BSD.usr.dist
/set type=dir uname=bin gname=bin mode=0755
.               uname=root gname=wheel
    bin
    ..
/set type=dir uname=bin gname=bin mode=0755
    include
    ..
/set type=dir uname=bin gname=bin mode=0775
# you can get around the problem by putting "ignore" on the local line.
    local	mode=0775
    ..
..
^D
# mkdir /tmp/test
# cd /tmp/test
# mtree -e -U -f ../mtree -p /tmp/test
	(mtree creates 3 directories, bin, include, and local, as it should)
# mkdir local/bin local/include local/lib local/libexec
# chmod 0 local/*
# chown root.wheel local/*
	(these 4 directories are NOT described in the mtree description)
# mtree -e -U -f ../mtree -p /tmp/test
local/bin: 
	user (3, 0, modified)
	gid (7, 0, modified)
	permissions (0755, 0, modified)
local/include: 
	user (3, 0, modified)
	gid (7, 0, modified)
	permissions (0755, 0, modified)
# ls -l local
total 8
drwxr-xr-x  2 bin   bin    512 Jul 18 20:23 bin
drwxr-xr-x  2 bin   bin    512 Jul 18 20:23 include
d---------  2 root  wheel  512 Jul 18 20:23 lib
d---------  2 root  wheel  512 Jul 18 20:23 libexec

Why is it changing modes and owners on these files which have no specified
permissions?  It seems to be using the permissions for ./bin and ./include
to change ./local/bin and ./local/include .

>Fix:
	
	You can work around this by putting "ignore" on directories whose
	substructure you don't want changed.

	

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Sun Jul 23 20:54:52 PDT 1995 
State-Changed-Why:  
Fixed in revision 1.4 of mtree/verify.c.  The spec depth 
was one too small for searching for extra in directories 
with no files in the spec. 
>Unformatted:



