bin/144411: [patch] mtree(8) doesn't reject non-regular files for -X

Garrett Cooper gcooper at FreeBSD.org
Wed Mar 31 06:50:09 UTC 2010


The following reply was made to PR bin/144411; it has been noted by GNATS.

From: Garrett Cooper <gcooper at FreeBSD.org>
To: Garrett Cooper <gcooper at freebsd.org>
Cc: Bruce Evans <brde at optusnet.com.au>, bug-followup <bug-followup at freebsd.org>
Subject: Re: bin/144411: [patch] mtree(8) doesn't reject non-regular files for 
	-X
Date: Tue, 30 Mar 2010 23:47:08 -0700

 --005045016abd7713880483131dc3
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 On Tue, Mar 30, 2010 at 11:46 PM, Garrett Cooper <gcooper at freebsd.org> wrot=
 e:
 > On Tue, Mar 30, 2010 at 11:35 PM, Garrett Cooper <gcooper at freebsd.org> wr=
 ote:
 >> On Tue, Mar 30, 2010 at 5:40 PM, Garrett Cooper <gcooper at freebsd.org> wr=
 ote:
 >>> On Tue, Mar 30, 2010 at 12:12 PM, Bruce Evans <brde at optusnet.com.au> wr=
 ote:
 >>>> On Wed, 31 Mar 2010, Bruce Evans wrote:
 >>>>
 >>>>> On Tue, 30 Mar 2010, Garrett Cooper wrote:
 >>>>>
 >>>>>> Hi,
 >>>>>> =A0 =A0I'm not 100% satisfied with this patch now. Looking back it f=
 ails
 >>>>>> the following case:
 >>>>>>
 >>>>>> =A0 =A0 -P =A0 =A0Do not follow symbolic links in the file hierarchy=
 , instead
 >>>>>> con-
 >>>>>> =A0 =A0 =A0 =A0 =A0 sider the symbolic link itself in any comparison=
 s. =A0This is the
 >>>>>> =A0 =A0 =A0 =A0 =A0 default.
 >>>>>
 >>>>> -P should have the same semantics and description in all utilities. =
 =A0The
 >>>>> description should not have grammar errors like the above (comma spli=
 ce).
 >>>>> ...
 >>>>> I now see that the grammar error is from the original version of mtre=
 e(1),
 >>>>> and is probably one of the things you don't like. =A0mtree also has -=
 L, but
 >>>>> not -R or -P or -h. =A0It is not clear how any utility that traverses=
  trees
 >>>>> can work without a full complement of -[HLPR] or how any utility that
 >>>>> ...
 >>>>
 >>>> Looking at the actual patch, I now see that it is about a completely
 >>>> different problem. =A0You would only need to understand the amount of
 >>>> brokenness of -P to see if you need to use lstat(). =A0I think -P is s=
 o
 >>>> broken that mtree on symlinks doesn't work at all and not using lstat(=
 )
 >>>> would be safest.
 >>>
 >>> Hmmm... so I take it that this is actually the first step in many to
 >>> fixing this underlying problem? I suppose I should be opening bugs for
 >>> all of the itemized issues that you see in mtree(8) so someone can
 >>> submit patches to fix the utility?
 >>>
 >>>> The patch has some style bugs.
 >>>
 >>> Please expound on this -- I want to improve my style (without having
 >>> to rewrite the entire program of course) -- so that it conforms more
 >>> to the projects overall style rules; of course there are some cases
 >>> where I can't readily do that (like pkg_install -- ugh), but I'll do
 >>> my best to make sure that the rules are withheld.
 >>
 >> s/withheld/held/
 >>
 >> I guess the problem was the fact that I didn't use 8-space tabs for
 >> first-level tabs? Hard tabs are fine, correct?
 >
 > =A0 =A0Ah, the braces for the single line conditional. Yes, I see what
 > you mean now (fixed).
 > =A0 =A0Also, I see what you mean about -P being broken; mtree(8) uses
 > chmod instead of lchmod, chown instead of lchown, etc. This definitely
 > needs fixing and I'll assign separate PRs for it.
 
 Sorry -- forgot the patch.
 -Garrett
 
 --005045016abd7713880483131dc3
 Content-Type: text/plain; charset=US-ASCII; name="bin.144411.diff.txt"
 Content-Disposition: attachment; filename="bin.144411.diff.txt"
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_g7frx53q0
 
 CkluZGV4OiBleGNsdWRlcy5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIGV4Y2x1ZGVzLmMJKHJldmlzaW9uIDIw
 NDUzMikKKysrIGV4Y2x1ZGVzLmMJKHdvcmtpbmcgY29weSkKQEAgLTMxLDYgKzMxLDcgQEAKIF9f
 RkJTRElEKCIkRnJlZUJTRCQiKTs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