Re: mtree and file names containing an asterisk

RVP <[email protected]> Fri, 15 Aug 2025 12:23:34 +0000 (UTC)
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
On Fri, 15 Aug 2025, Edgar Fuß wrote:

>> If the filename in the spec. contains a wildcard, it is treated as such:
> But the filename in the spec is foo\052bar, not foo*bar!
>

\052 is '*', and that substitution happens before the wildcard check--which is
what's causing your issue since it matches the next entry `foobar'.

>> But, maybe mtree(8) should not do wildcard expansion on the filenames read from
>> a directory entry. It should only do so if comes from a spec.:
> Err, what? Are you saying what it currently does is treating the
> on-filesystem filename foo*bar as a wildcard pattern?
>

Yes.

> But what should an on-filesystem filename "match"?
>

I consider it a bug. FreeBSD's got it too--but then, they're using NetBSD's
mtree implementation, I think.

> Whatever, I think the most basic requirement mtree should fulfil is that if
> I generate a spec from a path and then compare the spec to the path (without
> changing anything on-disc, of course), the comparison should succeed no
> matter which octets the on-disc filenames contain or what the phase of the
> moon is.
>

That's what the patch does. It also allows hand-crafted entries containing
wildcards in the spec., as reqd. per the man-page. Give it a try.

-RVP