From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 13 19:09:28 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26E9E1065678 for ; Thu, 13 Nov 2008 19:09:28 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id E34BF8FC0C for ; Thu, 13 Nov 2008 19:09:27 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id mADJ9Ru9056135 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 13 Nov 2008 13:09:27 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id mADJ9Plr056132; Thu, 13 Nov 2008 13:09:25 -0600 (CST) (envelope-from dan) Date: Thu, 13 Nov 2008 13:09:25 -0600 From: Dan Nelson To: Charles Darwin Message-ID: <20081113190925.GA22629@dan.emsphone.com> References: <99926641-6491-4F76-B2D2-73B1C6D52033@gmail.com> <20081112234345.GL85407@dan.emsphone.com> <318554EF-A7A4-41B6-8B81-6C3B9AFF4013@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <318554EF-A7A4-41B6-8B81-6C3B9AFF4013@gmail.com> X-OS: FreeBSD 7.1-PRERELEASE User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-hackers@freebsd.org Subject: Re: Is chflags' "nodump + sunlnk" = "uchg" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Nov 2008 19:09:28 -0000 In the last episode (Nov 13), Charles Darwin said: > On 12-Nov-08, at 6:43 PM, Dan Nelson wrote: > > In the last episode (Nov 12), Charles Darwin said: > >> Hi all, > >> > >> Title is the question actually: Is chflags' "nodump + sunlnk" = > >> "uchg" > > > > No; why would it be? > > I mean as far as their effect on a directory; doesn't "Don't change" > for a directory mean "Don't add + Don't remove"? Ok, that's sort of a different question. "nodump" is only checked by /sbin/dump, so we'll skip that. "sunlnk" is a root-only flag, while "uchg" can be set or reset by the file's owner as well. So let's look at "uunlnk" and "uchg": $ mkdir lnk chg $ touch lnk/file1 chg/file1 $ chflags uunlnk lnk ; chflags uchg chg $ ls -lo total 8 drwxr-xr-x 4 dan wheel - 512 Nov 13 12:59 ./ drwxrwxrwt 24 root wheel - 1024 Nov 13 12:59 ../ drwxr-xr-x 2 dan wheel uchg 512 Nov 13 12:59 chg/ drwxr-xr-x 2 dan wheel uunlnk 512 Nov 13 12:59 lnk/ $ rm chg/file1 rm: chg/file1: Operation not permitted $ rm lnk/file1 $ touch chg/file2 touch: chg/file2: Operation not permitted $ touch lnk/file2 $ rm lnk/file2 $ mv chg chg1 mv: rename chg to chg1: Operation not permitted $ mv lnk lnk1 mv: rename lnk to lnk1: Operation not permitted $ rmdir chg rmdir: chg: Operation not permitted $ rmdir lnk rmdir: lnk: Operation not permitted So as far as directories are concerned, the only difference between uchg and uunlnk is that uchg prohibits creation and deletion of files inside it, and uunlnk allows it. You can also look at /sys/ufs/ufs/ufs_vnops.c and see what code looks at which flags. -- Dan Nelson dnelson@allantgroup.com