From nobody Wed Jan 07 00:21:34 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 4dm7y64Z6Hz6MxMN for ; Wed, 07 Jan 2026 00:21:50 +0000 (UTC) (envelope-from jlduran@gmail.com) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 4dm7y62RdGz43JS for ; Wed, 07 Jan 2026 00:21:50 +0000 (UTC) (envelope-from jlduran@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-8be5acf6947so21037185a.0 for ; Tue, 06 Jan 2026 16:21:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767745309; x=1768350109; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5awhICZQ6OLl4CNRWima5Yi+eMeMUlvvX02ojPDzabo=; b=uMO5Epib5gjfx3trd9sFaiEzhNMGey7Ck3k5+zxVtMj8qQuC/y9T6iZg8SL8mk4KAA XuBpl+rU81c6Ak5hHx8SrLrXx/5TpGsQgwL0MU1q854IeTxpt/ULN13zh+vwZyH5ng+N n1xHWip+bMCKG+1hJf+tx9SXeCCnmX+LQW1uZFHuo5vxi9Nd7tQs+xC6QyvfCCQZFqAL LKlaN0hGxmE12JQ1KLmmWZBPQ5RVHfKSdPCEwJGB2JmRQ9zQ9KT864gGPC4xTgZIpmAt 0ukNNydNDQZQQdVcyXvef3byg99ziL4fRkVyQW0GAeZez7sHbzItuI/hthcdzBiA1HXD lo2Q== X-Forwarded-Encrypted: i=1; AJvYcCXRug/IpVe0FNJCZAXxTRsxj145lpGz66llYvy5RStlzatGGp0g8wKdXZxJ52zTTTi+ifwAg/tO@freebsd.org X-Gm-Message-State: AOJu0YzDwBRPxdbgd+Y/IZTLQcgFhIqjN6bXsBh8R/+br7A4GqgKjvUl byz88D5turA0UJgqjnkMmUczL8Df3BmiUvuropJYvz81av59DsP0NcJsSVETbo3Q X-Gm-Gg: AY/fxX4N5k3qlEuryPl0ftll9eoc+BJvb0m1gD1pjZlLGmlZzd4itE9IaFedAnbfMzM NV1PKwRDX7XQ1h+w7X4gcJCallvF4Qe85svtuCkCCyOBbRZ+GkNiBDaQowQSob5dT+lFp0j126K diPh3dlnRIPLsEs3GLeT6LUvBYoqzJJmg0AAALrJyCWzUqIja+nsxJn5H58laesoneuU2h64K/E Q1cxC9Hv3nqYS2tCAlZKKf8WdJVq9ElsxLmhDDI9tWMKAjl3vX3b6Yn/4oH+8HEHHOWDy4qVThq LJfnkw2XAyhdJbbkyB8EV7HhcJsFmzVGe00jNc8fubs/F7tXteKUoc0Kb4vFOfYVvtGq2VJqAbf JKQYqXUFtoDTerDf/3VOSA3BGRxOd9NN9+3j9siwHtnVHx4XjuW6/UxYpO2SEOKLOpKAZFUmZKo rhgHdRt5qQL8ypbxDuUE9ofTPqf16F5w2Nnv5CkEQmWv52124= X-Google-Smtp-Source: AGHT+IG/7g1rnx31KF/dxNM3VzupMF9xrW90UpIYyxqkrui1rWL+AysmOiSP1MKHNf2fYPX7AC8hUg== X-Received: by 2002:a05:620a:2804:b0:8b2:f090:b165 with SMTP id af79cd13be357-8c389388a4emr72832885a.4.1767745305523; Tue, 06 Jan 2026 16:21:45 -0800 (PST) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com. [209.85.219.54]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8c37f51b787sm266129685a.29.2026.01.06.16.21.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jan 2026 16:21:45 -0800 (PST) Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-88a2ad3a456so1188496d6.1 for ; Tue, 06 Jan 2026 16:21:45 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUMObFgQIc7o1BFTg8uz9BMlS6M00+lt5o6v32mQtjM/IoQH7Jp1kbHGZlQwS8pWfMU3LN714oK@freebsd.org X-Received: by 2002:a05:6214:76c:b0:88a:522e:f1aa with SMTP id 6a1803df08f44-89084257646mr8810736d6.4.1767745305121; Tue, 06 Jan 2026 16:21:45 -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: Reply-To: jlduran@freebsd.org From: Jose Luis Duran Date: Tue, 6 Jan 2026 21:21:34 -0300 X-Gmail-Original-Message-ID: X-Gm-Features: AQt7F2pGJGWZlj1sYHdn-7Zq-dizHV6NS2dlLEiNxJHtEVDNg-sNEgnN8enFpOI Message-ID: Subject: Re: mtree(1) recent POLA violation To: Xin LI Cc: Gleb Smirnoff , current@freebsd.org, christos@netbsd.org, Ngie Cooper Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dm7y62RdGz43JS 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 wrote: >> > >> > (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 is = a POLA >> >> > violation and I would also question if the new behavior is desired. >> >> >> >> 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' keywords,= despite '-R >> >> > all' asks for removing all keywords. The 'type=3D' is special, sin= ce 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 instal= led to tree >> >> > to a specification. Now the correct syntax to get the same behavio= r is this: >> >> > >> >> > mtree -c -k type | mtree -C >> >> > >> >> > I'll let other to decide do we want to fix this POLA violation or n= ot. At least >> >> > this needs to be recorded in Release notes. >> >> >> >> Right, according to the manual page: >> >> >> >> -k : Use the "type" keyword plus the specified (whitespace >> >> 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 sho= uld. >> > >> > >> > 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 crea= te.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 on = this feature and the historical behavior should not be considered a bug. I= think we should restore the historical behavior and amend the documentatio= n 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 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) k= eywords 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 cu= rrent > 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 (white= space > or comma separated) keywords to replace the current set = of > keywords. If =E2=80=98all=E2=80=99 is specified, use al= l of the available > keywords. > > [...] > > -R keywords > Remove the specified (whitespace or comma separated) key= words > 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/2163af1bb7ee561f0ab2251ddd2693a84909a7= db Let's wait for ngie, otherwise, I'll submit the patch to GNATS. --=20 Jose Luis Duran