From: David Kastrup <dak@gnu.org>
To: git@vger.kernel.org
Subject: Re: "git clone" executed as root on solaris 10 shreds UFS (it is possible to create hardlinks for directories as root under solaris)
Date: Mon, 16 Jul 2007 18:29:07 +0200 [thread overview]
Message-ID: <86d4ys71nw.fsf@lola.quinscape.zz> (raw)
In-Reply-To: 20070716133602.GB26675@cip.informatik.uni-erlangen.de
Thomas Glanzmann <thomas@glanzmann.de> writes:
> Hello,
> might that be related to the problem:
>
>
> lstat64("profiles/icpc", 0xFFBFF350) Err#2 ENOENT
> => mkdir("profiles", 0777) = 0
> stat64(".git/objects/66/6197b02f46c92f0273f16ac77d34d76b28f4f0",
> 0xFFBFF088) = 0
> open64(".git/objects/66/6197b02f46c92f0273f16ac77d34d76b28f4f0",
> O_RDONLY) = 4
> mmap64(0x00000000, 284, PROT_READ, MAP_PRIVATE, 4, 0) = 0xFF230000
> close(4) = 0
> munmap(0xFF230000, 284) = 0
> open64("profiles/icpc", O_WRONLY|O_CREAT|O_EXCL, 0666) = 4
> open64("profiles/.gitattributes", O_RDONLY) Err#2 ENOENT
> write(4, " # I C P C P r o f i".., 420) = 420
> close(4) = 0
> lstat64("profiles/sithglan", 0xFFBFF350) Err#2 ENOENT
> => mkdir("profiles", 0777) Err#17 EEXIST
> => unlink("profiles") = 0
> => mkdir("profiles", 0777) = 0
>
> I think it is. Damn it. What seems to hapen here is that git does:
>
> - create a subdirectory
> - puts a file in
> - deletes a subdirectory (by call unlink - that would normally fail,
> but with solaris as root it does not fail)
>
> => here comes the dangling hard link counter
>
> - created the directory again
> - puts the file in
>
> That is why I only see one file in each subdirectory (the one that got
> checkedout last). So the fix for git should be straight forward. But I still
> think that Solaris is obviously broken. Because if you ask me it should not be
> possible to unlink a directory that has files in it?!
<URL:http://www.opengroup.org/onlinepubs/000095399/functions/unlink.html>
The path argument shall not name a directory unless the process has
appropriate privileges and the implementation supports using unlink()
on directories.
So Solaris has the right to do this.
APPLICATION USAGE
Applications should use rmdir() to remove a directory.
RATIONALE
Unlinking a directory is restricted to the superuser in many
historical implementations for reasons given in link() (see
also rename()).
In short: git should not call remove, ever. It may succeed, and is a
badly low-level call. If something is known to be a directory, then
it needs to be removed using rmdir, and if it is a nondirectory, with
unlink.
Hm, browsing through Posix indicates that unlink is probably the same
as remove. Pity. I thought that just "remove" was the potential
evildoer.
--
David Kastrup
next prev parent reply other threads:[~2007-07-16 16:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-16 10:08 "git clone" executed as root on solaris 10 shreds UFS (it is possible to create hardlinks for directories as root under solaris) Thomas Glanzmann
2007-07-16 10:43 ` Thomas Glanzmann
2007-07-16 10:48 ` David Kastrup
2007-07-16 12:35 ` Thomas Glanzmann
2007-07-16 10:51 ` David Kastrup
2007-07-16 12:39 ` Thomas Glanzmann
2007-07-16 12:58 ` David Kastrup
2007-07-16 13:15 ` Thomas Glanzmann
2007-07-16 16:40 ` Thomas Glanzmann
2007-07-16 12:46 ` Thomas Glanzmann
2007-07-16 13:36 ` Thomas Glanzmann
2007-07-16 16:29 ` David Kastrup [this message]
2007-07-16 17:03 ` Linus Torvalds
2007-07-16 17:07 ` Linus Torvalds
2007-07-16 17:17 ` Thomas Glanzmann
2007-07-16 18:09 ` Thomas Glanzmann
2007-07-18 8:50 ` Thomas Glanzmann
2007-07-18 15:45 ` Linus Torvalds
2007-07-18 18:15 ` Thomas Glanzmann
2007-07-16 13:45 ` Thomas Glanzmann
2007-07-16 14:35 ` "git clone" executed as root on solaris 10 shreds UFS (it ispossible " Johannes Sixt
2007-07-16 15:45 ` Brian Downing
2007-07-16 15:50 ` Brian Downing
2007-07-16 19:57 ` David Kastrup
2007-07-16 17:12 ` Thomas Glanzmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86d4ys71nw.fsf@lola.quinscape.zz \
--to=dak@gnu.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).