Per mtree(8), passing `-R type -k flags` should clear omit type keywords from the spec created via mtree: -k keywords 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. Trying this though, demonstrates that that is not the case: $ sudo mtree -cn -R type -k flags -p /usr/bin/ -x | grep type= /set type=file flags=uarch . type=dir chfn type=link chsh type=link cpio type=link mailq type=link newaliases type=link perl type=link perl5 type=link pgrep type=link pkill type=link stelnet type=link tar type=link ypchfn type=link ypchpass type=link ypchsh type=link yppasswd type=link
(In reply to Ngie Cooper from comment #0) *clear omit -> omit
Created attachment 266206 [details] Initial proposed fix mtree: Fix parsing 'K', 'k', and 'R' flags Move the parsing of the keywords for the 'K', 'k', and 'R' flags outside the getopt loop, so that the order of the flags does not matter. Also, check for the presence of the F_TYPE flag before printing the type keyword.
Submitted a bug report (bin/59838) upstream.
Created attachment 266329 [details] Initial proposed fix Remove leftovers.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f8cee1f2c2dfba6223385fd711cce9faeca76451 commit f8cee1f2c2dfba6223385fd711cce9faeca76451 Merge: fe53a8a82c81 eb2ccba0c11b Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2025-12-19 20:14:35 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2025-12-19 20:14:35 +0000 Import latest mtree from NetBSD Merge commit 'eb2ccba0c11b405ac613c3046997765317cc8b5c' PR: 192839 PR: 219467 MFC after: 1 week contrib/mtree/compare.c | 16 ++++++---------- contrib/mtree/create.c | 7 ++++--- contrib/mtree/mtree.c | 36 ++++++++++++++++++++++-------------- contrib/mtree/spec.c | 25 +++++++++++-------------- 4 files changed, 43 insertions(+), 41 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=791fb098c9e84282b7d061c5708569757e6c65a3 commit 791fb098c9e84282b7d061c5708569757e6c65a3 Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2025-12-19 20:14:35 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2025-12-27 16:28:01 +0000 Import latest mtree from NetBSD Merge commit 'eb2ccba0c11b405ac613c3046997765317cc8b5c' PR: 192839 PR: 219467 MFC after: 1 week (cherry picked from commit f8cee1f2c2dfba6223385fd711cce9faeca76451) contrib/mtree/compare.c | 16 ++++++---------- contrib/mtree/create.c | 7 ++++--- contrib/mtree/mtree.c | 36 ++++++++++++++++++++++-------------- contrib/mtree/spec.c | 25 +++++++++++-------------- 4 files changed, 43 insertions(+), 41 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f9d671f726ac2199b906fc406b46b57cd2a11cf7 commit f9d671f726ac2199b906fc406b46b57cd2a11cf7 Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2025-12-19 20:14:35 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2025-12-27 16:28:35 +0000 Import latest mtree from NetBSD Merge commit 'eb2ccba0c11b405ac613c3046997765317cc8b5c' PR: 192839 PR: 219467 MFC after: 1 week (cherry picked from commit f8cee1f2c2dfba6223385fd711cce9faeca76451) contrib/mtree/compare.c | 16 ++++++---------- contrib/mtree/create.c | 7 ++++--- contrib/mtree/mtree.c | 36 ++++++++++++++++++++++-------------- contrib/mtree/spec.c | 25 +++++++++++-------------- 4 files changed, 43 insertions(+), 41 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5ea3ad01e6f511ee573e993e89810c27a7cf4198 commit 5ea3ad01e6f511ee573e993e89810c27a7cf4198 Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2025-12-19 20:14:35 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2025-12-27 16:29:02 +0000 Import latest mtree from NetBSD Merge commit 'eb2ccba0c11b405ac613c3046997765317cc8b5c' PR: 192839 PR: 219467 MFC after: 1 week (cherry picked from commit f8cee1f2c2dfba6223385fd711cce9faeca76451) contrib/mtree/compare.c | 16 ++++++---------- contrib/mtree/create.c | 7 ++++--- contrib/mtree/mtree.c | 36 ++++++++++++++++++++++-------------- contrib/mtree/spec.c | 25 +++++++++++-------------- 4 files changed, 43 insertions(+), 41 deletions(-)
Thank you for the bug report!
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=4250d2ad991b7bb9915e4c6b6d93b17369747ff0 commit 4250d2ad991b7bb9915e4c6b6d93b17369747ff0 Merge: 717ae163919e 7e59b238fcf3 Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2026-01-11 16:42:18 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2026-01-11 16:42:18 +0000 Import latest mtree from NetBSD Merge commit '7e59b238fcf32f3d365e78ddc702ca494e1ff68d' This commit partially reverts the previous vendor import, given that the "type" keyword has been historically mandatory and should not be removed by "-R all". This was clarified in the man page. Reported by: glebius PR: 219467 MFC after: 1 week contrib/mtree/create.c | 7 +++---- contrib/mtree/mtree.8 | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e2e7269461e94c56792801a6447ddee18baab52f commit e2e7269461e94c56792801a6447ddee18baab52f Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2026-01-11 16:42:18 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2026-01-18 03:56:23 +0000 Import latest mtree from NetBSD Merge commit '7e59b238fcf32f3d365e78ddc702ca494e1ff68d' This commit partially reverts the previous vendor import, given that the "type" keyword has been historically mandatory and should not be removed by "-R all". This was clarified in the man page. Reported by: glebius PR: 219467 MFC after: 1 week (cherry picked from commit 4250d2ad991b7bb9915e4c6b6d93b17369747ff0) contrib/mtree/create.c | 7 +++---- contrib/mtree/mtree.8 | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f957857c48351396dbd0127bc0fdd47f69e82f6d commit f957857c48351396dbd0127bc0fdd47f69e82f6d Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2026-01-11 16:42:18 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2026-01-18 03:55:38 +0000 Import latest mtree from NetBSD Merge commit '7e59b238fcf32f3d365e78ddc702ca494e1ff68d' This commit partially reverts the previous vendor import, given that the "type" keyword has been historically mandatory and should not be removed by "-R all". This was clarified in the man page. Reported by: glebius PR: 219467 MFC after: 1 week (cherry picked from commit 4250d2ad991b7bb9915e4c6b6d93b17369747ff0) contrib/mtree/create.c | 7 +++---- contrib/mtree/mtree.8 | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fc614b08ef6cce1568f449de1bf562d0b2d5f777 commit fc614b08ef6cce1568f449de1bf562d0b2d5f777 Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2026-01-11 16:42:18 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2026-01-18 03:57:12 +0000 Import latest mtree from NetBSD Merge commit '7e59b238fcf32f3d365e78ddc702ca494e1ff68d' This commit partially reverts the previous vendor import, given that the "type" keyword has been historically mandatory and should not be removed by "-R all". This was clarified in the man page. Reported by: glebius PR: 219467 MFC after: 1 week (cherry picked from commit 4250d2ad991b7bb9915e4c6b6d93b17369747ff0) contrib/mtree/create.c | 7 +++---- contrib/mtree/mtree.8 | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-)