Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Oct 2003 11:34:55 -0700
From:      "Jin Guojun [NCS]" <j_guojun@lbl.gov>
To:        Kris Kennaway <kris@FreeBSD.org>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/48435: wierd file system behavior
Message-ID:  <3F884D4F.9B7E5500@lbl.gov>
References:  <200310110516.h9B5GOAw005036@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F884D4F.9B7E5500>