Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 2006 07:22:54 GMT
From:      skv@FreeBSD.org
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/99531: [patch] mtree: import "optional" keyword from NetBSD
Message-ID:  <200606270722.k5R7MsDC033479@freefall.freebsd.org>
Resent-Message-ID: <200606270730.k5R7UJbL033703@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         99531
>Category:       bin
>Synopsis:       [patch] mtree: import "optional" keyword from NetBSD
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 27 07:30:18 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Sergey Skvortsov
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
<Organization of PR author (multiple lines)>
>Environment:

>Description:

Import very useful "optional" keyword:

http://netbsd.gw.com/cgi-bin/man-cgi?mtree++NetBSD-current

>How-To-Repeat:

>Fix:

Index: misc.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mtree/misc.c,v
retrieving revision 1.16
diff -u -r1.16 misc.c
--- misc.c	29 Mar 2005 11:44:17 -0000	1.16
+++ misc.c	27 Jun 2006 06:57:36 -0000
@@ -66,6 +66,7 @@
 	{"mode",	F_MODE,		NEEDVALUE},
 	{"nlink",	F_NLINK,	NEEDVALUE},
 	{"nochange",	F_NOCHANGE,	0},
+	{"optional",	F_OPT,		0},
 #ifdef RMD160
 	{"ripemd160digest", F_RMD160,	NEEDVALUE},
 #endif
Index: mtree.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mtree/mtree.8,v
retrieving revision 1.53
diff -u -r1.53 mtree.8
--- mtree.8	31 Jul 2005 03:30:47 -0000	1.53
+++ mtree.8	27 Jun 2006 06:53:30 -0000
@@ -221,6 +221,9 @@
 The number of hard links the file is expected to have.
 .It Cm nochange
 Make sure this file or directory exists but otherwise ignore all attributes.
+.It Sy optional
+The file is optional; don't complain about the file if it's
+not in the file hierarchy.
 .It Cm uid
 The file owner as a numeric value.
 .It Cm uname
Index: mtree.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mtree/mtree.h,v
retrieving revision 1.7
diff -u -r1.7 mtree.h
--- mtree.h	29 Mar 2005 11:44:17 -0000	1.7
+++ mtree.h	27 Jun 2006 06:56:36 -0000
@@ -78,6 +78,7 @@
 #define	F_RMD160 0x40000			/* RIPEMD160 digest */
 #define	F_FLAGS	0x80000				/* file flags */
 #define	F_SHA256	0x100000				/* SHA-256 digest */
+#define F_OPT	0x200000			/* existence optional */
 	u_int	flags;				/* items set */
 
 #define	F_BLOCK	0x001				/* block special */
Index: spec.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mtree/spec.c,v
retrieving revision 1.22
diff -u -r1.22 spec.c
--- spec.c	29 Mar 2005 11:44:17 -0000	1.22
+++ spec.c	27 Jun 2006 07:02:42 -0000
@@ -236,6 +236,9 @@
 				errx(1, "line %d: invalid link count %s",
 				lineno,  val);
 			break;
+		case F_OPT:
+			/* just set flag bit */
+			break;
 		case F_SIZE:
 			ip->st_size = strtoq(val, &ep, 10);
 			if (*ep)
Index: verify.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mtree/verify.c,v
retrieving revision 1.24
diff -u -r1.24 verify.c
--- verify.c	11 Aug 2005 15:43:55 -0000	1.24
+++ verify.c	27 Jun 2006 07:00:48 -0000
@@ -158,6 +158,8 @@
 	int serr;
 
 	for (; p; p = p->next) {
+		if (p->flags & F_OPT && !(p->flags & F_VISIT))
+			continue;
 		if (p->type != F_DIR && (dflag || p->flags & F_VISIT))
 			continue;
 		(void)strcpy(tail, p->name);
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606270722.k5R7MsDC033479>