NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

mtree: Partially revert PR/59838 mtree's type keyword is mandatory



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

From: jlduran%gmail.com@localhost
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: mtree: Partially revert PR/59838 mtree's type keyword is mandatory
Date: Thu,  8 Jan 2026 06:11:05 +0000 (UTC)

 >Submitter-Id:	net
 >Originator:	Jose Luis Duran
 >Organization:	FreeBSD
 >Confidential:	no
 >Synopsis:	mtree: Partially revert PR/59838 mtree's type keyword is mandatory
 >Severity:	non-critical
 >Priority:	low
 >Category:	bin
 >Class:		doc-bug
 >Release:	trunk
 >Environment:	
 >Description:
 It was reported on the FreeBSD current mailing list that the "type" keyword has been historically mandatory, and should not be removed by the -R flag.
 
 Partially revert PR/59838 (create.c,v 1.80) and fix the manual page to clarify this intention, effectively also reverting mtree.8,v 1.44.
 
 >How-To-Repeat:
 $ mtree -c -R all | mtree -C
 
 "-R all" should *not* remove the "type" keyword.
 >Fix:
 diff --git usr.sbin/mtree/create.c usr.sbin/mtree/create.c
 index 1a4f006bcfea..3ad592ba1173 100644
 --- usr.sbin/mtree/create.c
 +++ usr.sbin/mtree/create.c
 @@ -236,8 +236,7 @@ statf(FILE *fp, int indent, FTSENT *p)
  		offset += fprintf(fp, "%*s",
  		    (INDENTNAMELEN + indent) - offset, "");
  
 -	if (keys & F_TYPE &&
 -	    !S_ISREG(p->fts_statp->st_mode) && (flavor == F_NETBSD6 || !dflag))
 +	if (!S_ISREG(p->fts_statp->st_mode) && (flavor == F_NETBSD6 || !dflag))
  		output(fp, indent, &offset, "type=%s",
  		    inotype(p->fts_statp->st_mode));
  	if (keys & (F_UID | F_UNAME) && p->fts_statp->st_uid != uid) {
 diff --git usr.sbin/mtree/mtree.8 usr.sbin/mtree/mtree.8
 index 99e3199de943..a975403a6d20 100644
 --- usr.sbin/mtree/mtree.8
 +++ usr.sbin/mtree/mtree.8
 @@ -56,7 +56,7 @@
  .\"
  .\"     @(#)mtree.8	8.2 (Berkeley) 12/11/93
  .\"
 -.Dd December 2, 2023
 +.Dd January 8, 2026
  .Dt MTREE 8
  .Os
  .Sh NAME
 @@ -242,18 +242,14 @@ If
  is specified, add all of the other keywords.
  .
  .It Fl k Ar keywords
 -Use the
 +Use the mandatory
  .Sy type
  keyword plus the specified (whitespace or comma separated)
  .Ar keywords
 -instead of the current set of keywords.
 +to replace the current set of keywords.
  If
  .Ql all
 -is specified, use all of the other keywords.
 -If the
 -.Sy type
 -keyword is not desired, suppress it with
 -.Fl R Cm type .
 +is specified, use all of the available keywords.
  .
  .It Fl L
  Follow all symbolic links in the file hierarchy.
 @@ -338,9 +334,13 @@ This occurs when the directory is a symbolic link.
  .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 of the other keywords.
 +is specified, remove all keywords except
 +.Sy type .
  .
  .It Fl r
  Remove any files in the file hierarchy that are not described in the
 


Home | Main Index | Thread Index | Old Index