Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Mar 2012 18:05:51 -0500
From:      Lowell Gilbert <lgfbsd@be-well.ilk.org>
To:        freebsd-hackers@freebsd.org
Subject:   Re: mtree(8) reporting of file modes
Message-ID:  <44fwdlz5ww.fsf@lowell-desk.lan>
In-Reply-To: <20120306204101.GE1730@albert.catwhisker.org> (David Wolfskill's message of "Tue, 6 Mar 2012 12:41:01 -0800")
References:  <20120306204101.GE1730@albert.catwhisker.org>

next in thread | previous in thread | raw e-mail | index | archive | help
David Wolfskill <david@catwhisker.org> writes:

> * mode is set to the (masked) mode of the (immediately) enclosing
>   directory when it is visited in pre-order.  (This is done in statd().)

Not quite. It looks like when statd() is called on the enclosing
directory itself, it walks all of the children to find the most common
values, and issues a "/set" line to establish defaults. When it is
subsequently called for each of the children in their own right, it only
needs to list the properties that differ.

Which isn't really illogical: it substantially reduces the size of the
output (and vastly improves the readability-by-humans) in exchange for
having to traverse the list of file entries twice.

> Maybe I'm confused, but certainly for my present purposes, and likely in
> general, I'd think it would make sense to just always report the file
> mode.

> Another alternative, in case there are use cases for the existing
> behavior, would be to provide either another "key" or a command-line
> flag that says "give me all the modes".

> Am I the only one who would find such a change useful?

Well, it's definitely only useful if you're using something besides
mtree itself to parse the output file. I like having the defaults,
because most of the time all of the files in a directory have the same
permissions, and there are fewer distractions for my eye.

I guess the question is why do *you* find the "/set" lines to (even just
occasionally) not be useful?

Be well.



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