Bug 623 - mtree(8) changes file modes and owners it shouldn't
Summary: mtree(8) changes file modes and owners it shouldn't
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1995-07-18 21:20 UTC by gordon
Modified: 1995-07-18 21:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gordon 1995-07-18 21:20:00 UTC
	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.

Fix: 

You can work around this by putting "ignore" on directories whose
	substructure you don't want changed.
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 .
Comment 1 Bruce Evans freebsd_committer freebsd_triage 1995-07-24 04:54:52 UTC
State Changed
From-To: open->closed

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.