From nobody Wed Jan 07 00:24:18 2026 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dm81F6BpGz6MxW2 for ; Wed, 07 Jan 2026 00:24:33 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dm81F47yZz44LB for ; Wed, 07 Jan 2026 00:24:33 +0000 (UTC) (envelope-from delphij@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-34c708702dfso1255273a91.1 for ; Tue, 06 Jan 2026 16:24:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767745470; x=1768350270; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=/TN7UGnfphndaVKHQtMwrLE9va7c77GtVw3k67bMCPc=; b=LOgK6KJ1K9FxKoM4R/CTspHi3EhPv6Drt2pFISMIjGv8rsqy742yjHmdex/xYcXXoj nps2xiLS0Zt5Ku90enNLH0rNXEYgfM6Oeangqt53GDq1N0RkHeSd6Lxguh/3EdwXp0IK t2Atvt9sj0mcE/qY0u+Yl/6ndHB9DFMxw8bW/QXhJFVgny2WqZaBpjFPH3GfybR7qU51 4y1zBKOXqx9jGMkIJwjjuYE+wxR+Skf6sQFCbp6wcQZ+4zdYD57ZGazkkoWF3GxGhCRG 9idfpZtxnLBIcYuexT7X/3R3ZEj8r3g9f1ygHCPeNeaMFe6+26aMBC65/hEk9MnuVS/S CUfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767745470; x=1768350270; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/TN7UGnfphndaVKHQtMwrLE9va7c77GtVw3k67bMCPc=; b=xSfpY44Jog+L+pCNnZix6kIuyMpdgEgYVW3ssVKDGdNJLDWjzv+OR/iCBbKTv7TB5F 601EXML1GP+7RRoHOS7WcySqydgfyMU6nAepoc9MNSHOtB+Uiu1jfpJh/kRdbFyrjcyg uOk4mBG6uG0knAD7zFcQxmzo/xA/T0L0VpmUevgHJIvsMDqYdFuc7bsZzq37xf6pgxjj 87dNPKlDBL6DR+QL5jc7Iuc6OW8hmxvbZdqRAZXO+eOUVVnZTpatul/bWSjJdxsCS6JY Y8qwFLcarJEZBSx5XCyentYdYpL/pzY3WwZKptkSg6t0jU93iGhsKzECJeHvY2KDcW4H ct1Q== X-Forwarded-Encrypted: i=1; AJvYcCXi8G1tm/X1mTTSqIEp7oRCqXP2dWwnF9MevcbZKEMshnGbS+4xJIYxQn4kw0iLZ3wnuqlO/g19@freebsd.org X-Gm-Message-State: AOJu0YwuXlqdcVZsQ0RDL4J4rN3I1W4FaXFvIl8NIYq3CVXP9360heI1 Y/WOoQH3kWX06gH7gM7s+4YRomb9k+EYJ3ztIoNTJY+EgH3FdYh/pLhXbOSmnbRF19x3Qz/iIdb DHaWgCWPx0BPL7/+Pilk6XJAOAyN1HWk= X-Gm-Gg: AY/fxX5BK7aZBBhMUQ0LUDoY/95yPxsvhpKDqtEplrINgcAehq88La4LRIgKXs98FNK P5c2fqMJj4OaVG9EilOPtG55Nj1pMwA51ZwdrYaW+H7icIfYowAbOKK5ml2IQzR/MLnJ9BfqzAV Zy420WMg60Mw9ftFLIFfjIxljAUmcj3UWYZ0x3xvvZUV40tpXb1H6goBnVFJb5BweqFlv1RXONb HAOH4GpnkFS2K5/A3tIaWoUKVY6A3WschPb8CcFtjqffMBqWUGrBrpu2dHhLrnbknidfyHdZHq1 IelqzbIzFjt/mjmBjvG0uqEm2w== X-Google-Smtp-Source: AGHT+IHbL8A7t2W3zRxL1k6lBovHkye3rkmOS1imTpsIpIQWgTiB4XkWP3fY2PI+12HOz3TIFotvZBVqdf+m3p+0/6c= X-Received: by 2002:a17:90b:2d82:b0:349:19a8:e00e with SMTP id 98e67ed59e1d1-34f68cb968bmr705713a91.31.1767745470298; Tue, 06 Jan 2026 16:24:30 -0800 (PST) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: Xin LI Date: Tue, 6 Jan 2026 16:24:18 -0800 X-Gm-Features: AQt7F2q3HJAA10SLrcVTguHyFUZk4t09kPaKmld1H4Wwcl6lxpWvQQjXQqCas48 Message-ID: Subject: Re: mtree(1) recent POLA violation To: jlduran@freebsd.org Cc: Gleb Smirnoff , current@freebsd.org, christos@netbsd.org, Ngie Cooper Content-Type: multipart/alternative; boundary="000000000000cf806f0647c150eb" X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dm81F47yZz44LB --000000000000cf806f0647c150eb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 6, 2026 at 4:21=E2=80=AFPM Jose Luis Duran wrote: > On Tue, Jan 6, 2026 at 9:08=E2=80=AFPM Xin LI wrote: > > > > > > > > On Tue, Jan 6, 2026 at 3:47=E2=80=AFPM Jose Luis Duran > wrote: > >> > >> On Tue, Jan 6, 2026 at 8:37=E2=80=AFPM Xin LI wrot= e: > >> > > >> > (Adding ngie@ who reported PR 219467 and Christos for visibility) > >> > > >> > On Tue, Jan 6, 2026 at 3:05=E2=80=AFPM Jose Luis Duran > wrote: > >> >> > >> >> On Tue, Jan 6, 2026 at 7:37=E2=80=AFPM Gleb Smirnoff > wrote: > >> >> > > >> >> > Hi, > >> >> > > >> >> > the recent mtree(1) import from NetBSD brought one change, that i= s > a POLA > >> >> > violation and I would also question if the new behavior is desire= d. > >> >> > >> >> The change stems from: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D219467 > >> >> > >> >> > Before the import 'mtree -c -R all' would leave 'type=3D' keyword= s, > despite '-R > >> >> > all' asks for removing all keywords. The 'type=3D' is special, > since this > >> >> > keyword is required to reconstruct a new spec. > >> >> > > >> >> > In other words before the import this was working: > >> >> > > >> >> > mtree -c -R all | mtree -C > >> >> > > >> >> > Now this is broken. The above was standard idiom to compare > installed to tree > >> >> > to a specification. Now the correct syntax to get the same > behavior is this: > >> >> > > >> >> > mtree -c -k type | mtree -C > >> >> > > >> >> > I'll let other to decide do we want to fix this POLA violation or > not. At least > >> >> > this needs to be recorded in Release notes. > >> >> > >> >> Right, according to the manual page: > >> >> > >> >> -k : Use the "type" keyword plus the specified (whitespac= e > >> >> or comma separated) keywords instead of the current set of keywords= . > >> >> If "all" is specified, use all of the other keywords. If the "type= " > >> >> keyword is not desired, suppress it with "-R type". > >> >> -R : Remove the specified (whitespace or comma separated) > >> >> keywords from the current set of keywords. If "all" is specified, > >> >> remove all of the other keywords. > >> >> > >> >> So, the previous behavior was bugged. It now does what it says it > should. > >> > > >> > > >> > If we look at when the keyword feature was initially implemented > (CSRG r51884, 34 years ago), it's quite clear that "type" was special: > F_TYPE is always set regardless of what's specified with '-k' (mtree.c), > and in create.c the flag is the only one not being checked. IMHO "type" > represents a material difference in a file hierarchy specification, and > should always be present for non-plain files. > >> > > >> > It has been there for 34 years and legitimate users evidently rely o= n > this feature and the historical behavior should not be considered a bug. = I > think we should restore the historical behavior and amend the documentati= on > to reflect it instead. > >> > >> I'm not opposed to reverting it, if we also change (something along th= e > lines): > >> > >> 1. Remove: "If the type keyword is not desired, suppress it with -R > >> type." from the "-k" flag description. > > > > > > Yes I think NetBSD mtree.8,v 1.44 ( > https://mail-index.netbsd.org/source-changes/2006/09/12/0034.html ) > should be reverted. > > > >> > >> 2. Add: "If 'all' is specified, remove all of the other keywords with > >> the exception of 'type'." > > > > > > In fact the current wording already mentions it: > > > > Use the type keyword plus the specified (whitespace or comma separated) > keywords instead of the current set of keywords. If =E2=80=98all=E2=80=99= is specified, use > all of the other keywords. > > > > I'd probably change the '-k' part to: > > > > =3D=3D=3D=3D=3D > > .It Fl k Ar keywords > > Use the mandatory > > .Sy type > > keyword plus the specified (whitespace or comma separated) > > .Ar keywords > > to replace the current set of keywords. > > If > > .Ql all > > is specified, use all of the available keywords. > > =3D=3D=3D=3D=3D > > > > and the '-R' part to: > > > > =3D=3D=3D=3D=3D > > .It Fl R Ar keywords > > Remove the specified (whitespace or comma separated) keywords from the > current > > set of keywords. > > The > > .Sy type > > keyword is mandatory and is always retained. > > If > > .Ql all > > is specified, remove all keywords except > > .Sy type . > > =3D=3D=3D=3D=3D > > to make it more clear. > > > > That would render as: > > > > -k keywords > > Use the mandatory type keyword plus the specified > (whitespace > > or comma separated) keywords to replace the current se= t > of > > keywords. If =E2=80=98all=E2=80=99 is specified, use = all of the > available > > keywords. > > > > [...] > > > > -R keywords > > Remove the specified (whitespace or comma separated) > keywords > > from the current set of keywords. The type keyword is > > mandatory and is always retained. If =E2=80=98all=E2= =80=99 is > specified, > > remove all keywords except type. > > > > > > as attached. > > > > > > > >> > >> > >> > Cheers, > >> > >> > >> Regards, > >> > >> -- > >> Jose Luis Duran > > > Yes, number 2 was for the -R flag, as you noted. > > The code "fix" is to revert: > > https://github.com/NetBSD/src/commit/2163af1bb7ee561f0ab2251ddd2693a84909= a7db > > Let's wait for ngie, otherwise, I'll submit the patch to GNATS. > Thanks! There is no rush, let's wait for ngie to chime in in case my reasonaing wasn't convincing enough :) Cheers, --000000000000cf806f0647c150eb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, Jan 6= , 2026 at 4:21=E2=80=AFPM Jose Luis Duran <jlduran@freebsd.org> wrote:
On Tue, Jan 6, 2026 at 9:08=E2=80=AFPM Xin LI = <delphij@gmail.co= m> wrote:
>
>
>
> On Tue, Jan 6, 2026 at 3:47=E2=80=AFPM Jose Luis Duran <jlduran@freebsd.org> w= rote:
>>
>> On Tue, Jan 6, 2026 at 8:37=E2=80=AFPM Xin LI <delphij@gmail.com> wrote:
>> >
>> > (Adding ngie@ who reported PR 219467 and Christos for visibil= ity)
>> >
>> > On Tue, Jan 6, 2026 at 3:05=E2=80=AFPM Jose Luis Duran <jlduran@freebsd.org<= /a>> wrote:
>> >>
>> >> On Tue, Jan 6, 2026 at 7:37=E2=80=AFPM Gleb Smirnoff <= glebius@freebsd.or= g> wrote:
>> >> >
>> >> >=C2=A0 =C2=A0Hi,
>> >> >
>> >> > the recent mtree(1) import from NetBSD brought one c= hange, that is a POLA
>> >> > violation and I would also question if the new behav= ior is desired.
>> >>
>> >> The change stems from: h= ttps://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D219467
>> >>
>> >> > Before the import 'mtree -c -R all' would le= ave 'type=3D' keywords, despite '-R
>> >> > all' asks for removing all keywords.=C2=A0 The &= #39;type=3D' is special, since this
>> >> > keyword is required to reconstruct a new spec.
>> >> >
>> >> > In other words before the import this was working: >> >> >
>> >> > mtree -c -R all | mtree -C
>> >> >
>> >> > Now this is broken.=C2=A0 The above was standard idi= om to compare installed to tree
>> >> > to a specification.=C2=A0 Now the correct syntax to = get the same behavior is this:
>> >> >
>> >> > mtree -c -k type | mtree -C
>> >> >
>> >> > I'll let other to decide do we want to fix this = POLA violation or not. At least
>> >> > this needs to be recorded in Release notes.
>> >>
>> >> Right, according to the manual page:
>> >>
>> >> -k <keywords>: Use the "type" keyword plu= s the specified (whitespace
>> >> or comma separated) keywords instead of the current set o= f keywords.
>> >> If "all" is specified, use all of the other key= words.=C2=A0 If the "type"
>> >> keyword is not desired, suppress it with "-R type&qu= ot;.
>> >> -R <keywords>: Remove the specified (whitespace or = comma separated)
>> >> keywords from the current set of keywords.=C2=A0 If "= ;all" is specified,
>> >> remove all of the other keywords.
>> >>
>> >> So, the previous behavior was bugged. It now does what it= says it should.
>> >
>> >
>> > If we look at when the keyword feature was initially implemen= ted (CSRG r51884, 34 years ago), it's quite clear that "type"= was special: F_TYPE is always set regardless of what's specified with = '-k' (mtree.c), and in create.c the flag is the only one not being = checked.=C2=A0 IMHO "type" represents a material difference in a = file hierarchy specification, and should always be present for non-plain fi= les.
>> >
>> > It has been there for 34 years and legitimate users evidently= rely on this feature and the historical behavior should not be considered = a bug.=C2=A0 I think we should restore the historical behavior and amend th= e documentation to reflect it instead.
>>
>> I'm not opposed to reverting it, if we also change (something = along the lines):
>>
>> 1. Remove: "If the type keyword is not desired, suppress it w= ith -R
>> type." from the "-k" flag description.
>
>
> Yes I think NetBSD mtree.8,v 1.44 ( https://mail-index.netbsd.org/source-changes/2006/09/12/0034.html= ) should be reverted.
>
>>
>> 2. Add: "If 'all' is specified, remove all of the oth= er keywords with
>> the exception of 'type'."
>
>
> In fact the current wording already mentions it:
>
> Use the type keyword plus the specified (whitespace or comma separated= ) keywords instead of the current set of keywords. If =E2=80=98all=E2=80=99= is specified, use all of the other keywords.
>
> I'd probably change the '-k' part to:
>
> =3D=3D=3D=3D=3D
> .It Fl k Ar keywords
> Use the mandatory
> .Sy type
> keyword plus the specified (whitespace or comma separated)
> .Ar keywords
> to replace the current set of keywords.
> If
> .Ql all
> is specified, use all of the available keywords.
> =3D=3D=3D=3D=3D
>
> and the '-R' part to:
>
> =3D=3D=3D=3D=3D
> .It Fl R Ar keywords
> Remove the specified (whitespace or comma separated) keywords from the= current
> set of keywords.
> The
> .Sy type
> keyword is mandatory and is always retained.
> If
> .Ql all
> is specified, remove all keywords except
> .Sy type .
> =3D=3D=3D=3D=3D
> to make it more clear.
>
> That would render as:
>
>=C2=A0 =C2=A0 =C2=A0 -k keywords
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Use the = mandatory type keyword plus the specified (whitespace
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 or comma= separated) keywords to replace the current set of
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 keywords= .=C2=A0 If =E2=80=98all=E2=80=99 is specified, use all of the available
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 keywords= .
>
> [...]
>
>=C2=A0 =C2=A0 =C2=A0 -R keywords
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Remove t= he specified (whitespace or comma separated) keywords
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 from the= current set of keywords.=C2=A0 The type keyword is
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 mandator= y and is always retained.=C2=A0 If =E2=80=98all=E2=80=99 is specified,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 remove a= ll keywords except type.
>
>
> as attached.
>
>
>
>>
>>
>> > Cheers,
>>
>>
>> Regards,
>>
>> --
>> Jose Luis Duran


Yes, number 2 was for the -R flag, as you noted.

The code "fix" is to revert:
https://github.com/NetB= SD/src/commit/2163af1bb7ee561f0ab2251ddd2693a84909a7db

Let's wait for ngie, otherwise, I'll submit the patch to GNATS.
=

Thanks!=C2=A0 There is no rush, let's wait for = ngie to chime in in case my reasonaing wasn't convincing enough :)
Cheers,
--000000000000cf806f0647c150eb--