Re: Why O_EXCL would make this difference? I am puzzled..
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Jul 14, 2005, 16:52 UTC
- Message-ID
- <Pine.LNX.4.58.0507140944580.19183@g5.osdl.org>
- In-Reply-To
- <Pine.LNX.4.58.0507140904440.19183@g5.osdl.org>
On Thu, 14 Jul 2005, Linus Torvalds wrote:
> > I'll strace the dang thing.
It's the "Adding" case in git-merge-one-file-script, which does
git-checkout-cache -u -f -- "$4"
and it's because of this:
lstat64("DF", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
unlink("DF") = -1 EISDIR (Is a directory)
.. unpack the object ..
open("DF", O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0666) = -1 EEXIST (File exists)ie the problem is that we actually _have_ a test for this, but it's:
if (errno == EISDIR && force) {but if the directory already exists, we do that wrong.
Btw, this also shows a different problem: the symlink handling doesn't do any of this, so you cannot even force a directory to become a symlink.
I think both problems can be fixed by just moving the (EISDIR && force) test down to the "unlink()".
Will try.
Linus