From nobody@FreeBSD.org  Tue Jun 26 16:20:47 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 7DE7137B407
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 26 Jun 2001 16:20:47 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.3/8.11.3) id f5QNKli86125;
	Tue, 26 Jun 2001 16:20:47 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200106262320.f5QNKli86125@freefall.freebsd.org>
Date: Tue, 26 Jun 2001 16:20:47 -0700 (PDT)
From: Voradesh Yenbut <yenbut@cs.washington.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mtree does not correctly compare files when one of which have flags set
X-Send-Pr-Version: www-1.0

>Number:         28430
>Category:       bin
>Synopsis:       mtree does not correctly compare files when one of which have flags set
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 26 16:30:06 PDT 2001
>Closed-Date:    Thu Aug 2 16:16:06 PDT 2001
>Last-Modified:  Thu Aug 02 16:20:15 PDT 2001
>Originator:     Voradesh Yenbut
>Release:        4.2BSD
>Organization:
U of Washington
>Environment:
FreeBSD orion.cs.washington.edu 4.2-RELEASE FreeBSD 4.2-RELEASE #1: Mon Dec 18 18:35:55 GMT 2000     root@orion.cs.washington.edu:/usr/src/sys/compile/ORION  i386

>Description:
Mtree does not correctly compare files against their specs if
one of the files has flags such as nodump set.  The files not
having the flags set show errors like the following:

za:     flags ("nodump" is not "none")
za/z:   flags ("nodump" is not "none")
za/z/a: flags ("nodump" is not "none")

>How-To-Repeat:
Running the following commands:
------
rm -rf /tmp/test

mkdir /tmp/test
mkdir /tmp/test/x
mkdir /tmp/test/x/y
mkdir /tmp/test/x/z
touch /tmp/test/x/z/b

touch /tmp/test/y
chflags nodump /tmp/test/y

ln -s /tmp/test/y /tmp/test/x/y/a

rm -rf /tmp/test/za
mkdir /tmp/test/za
mkdir /tmp/test/za/z
touch /tmp/test/za/z/a

mtree -cnxiK sha1digest -p /tmp/test > spec
mtree -xp /tmp/test < spec

>Fix:
The patch below on spec.c corrects the problem.  The patch
on create.c is a patch to what looks like another bug.  It
is unclear what the bug does.

--- spec.c      2001/06/26 21:59:06     1.1
+++ spec.c      2001/06/26 22:13:49
@@ -113,6 +113,7 @@
                        case 's':
                                if (strcmp(p + 1, "set"))
                                        break;
+                               bzero(&ginfo, sizeof(ginfo));
                                set(NULL, &ginfo);
                                continue;
                        case 'u':
--- create.c    2001/06/26 21:00:13     1.1
+++ create.c    2001/06/26 21:08:54
@@ -337,7 +337,7 @@
                        if (FLAGS2IDX(sflags) < MAXFLAGS &&
                            ++f[FLAGS2IDX(sflags)] > maxflags) {
                                saveflags = sflags;
-                               maxflags = u[FLAGS2IDX(sflags)];
+                               maxflags = f[FLAGS2IDX(sflags)];
                        }
                }
        }

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jon 
State-Changed-When: Thu Aug 2 16:16:06 PDT 2001 
State-Changed-Why:  
The problem and the "other bug" has since been corrected. 
4.3-RELEASE contains the fixed version. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28430 
>Unformatted:
