From owner-freebsd-bugs@FreeBSD.ORG Sat Oct 11 11:33:56 2003 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0A2FF16A4B3; Sat, 11 Oct 2003 11:33:56 -0700 (PDT) Received: from adsl-63-198-35-122.dsl.snfc21.pacbell.net (adsl-63-198-35-122.dsl.snfc21.pacbell.net [63.198.35.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 328A343F85; Sat, 11 Oct 2003 11:33:55 -0700 (PDT) (envelope-from j_guojun@lbl.gov) Received: from lbl.gov (localhost.pacbell.net [127.0.0.1]) ESMTP id h9BIYtiJ000394; Sat, 11 Oct 2003 11:34:55 -0700 (PDT) (envelope-from j_guojun@lbl.gov) Sender: jin@adsl-63-198-35-122.dsl.snfc21.pacbell.net Message-ID: <3F884D4F.9B7E5500@lbl.gov> Date: Sat, 11 Oct 2003 11:34:55 -0700 From: "Jin Guojun [NCS]" X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.8-RELEASE i386) X-Accept-Language: zh, zh-CN, en-US, en MIME-Version: 1.0 To: Kris Kennaway References: <200310110516.h9B5GOAw005036@freefall.freebsd.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-bugs@FreeBSD.org Subject: Re: kern/48435: wierd file system behavior X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Oct 2003 18:33:56 -0000 Kris Kennaway wrote: > Synopsis: wierd file system behavior > > State-Changed-From-To: open->closed > State-Changed-By: kris > State-Changed-When: Fri Oct 10 22:16:01 PDT 2003 > State-Changed-Why: > It has been determined that this is deliberate behaviour by tar. > > http://www.freebsd.org/cgi/query-pr.cgi?pr=48435 A truss of tar when the directory exists, but has no files: mkdir(0x809b070,0x1ed) ERR#17 'File exists' unlink(0x809b070) ERR#1 'Operation not permitted' rmdir(0x809b070) = 0 (0x0) mkdir(0x809b070,0x1ed) = 0 (0x0) But when a file exists in the directory: mkdir(0x809b070,0x1ed) ERR#17 'File exists' unlink(0x809b070) ERR#1 'Operation not permitted' rmdir(0x809b070) ERR#66 'Directory not empty' So it seems tar is removing then creating the directory if it is empty. -- Then the TAR is the bad guy. The entire logic in TAR is either lazy or silly. Can we change it to something simple stat(dir, &sb) if (dir exists but a file) { return error } if (dir not exist) mkdir(dir) -Jin