From owner-freebsd-bugs@FreeBSD.ORG Tue Jun 27 07:30:20 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 84E1F16A408 for ; Tue, 27 Jun 2006 07:30:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3DE6445C2 for ; Tue, 27 Jun 2006 07:30:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k5R7UJgO033707 for ; Tue, 27 Jun 2006 07:30:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k5R7UJbL033703; Tue, 27 Jun 2006 07:30:19 GMT (envelope-from gnats) Resent-Date: Tue, 27 Jun 2006 07:30:19 GMT Resent-Message-Id: <200606270730.k5R7UJbL033703@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, skv@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 25D1616A403 for ; Tue, 27 Jun 2006 07:22:55 +0000 (UTC) (envelope-from skv@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA70F445C2 for ; Tue, 27 Jun 2006 07:22:54 +0000 (GMT) (envelope-from skv@FreeBSD.org) Received: from freefall.freebsd.org (skv@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k5R7MsUk033480 for ; Tue, 27 Jun 2006 07:22:54 GMT (envelope-from skv@freefall.freebsd.org) Received: (from skv@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k5R7MsDC033479; Tue, 27 Jun 2006 07:22:54 GMT (envelope-from skv) Message-Id: <200606270722.k5R7MsDC033479@freefall.freebsd.org> Date: Tue, 27 Jun 2006 07:22:54 GMT From: skv@FreeBSD.org To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.2 Cc: Subject: bin/99531: [patch] mtree: import "optional" keyword from NetBSD X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: skv@FreeBSD.org List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2006 07:30:20 -0000 >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: >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: