From mboxrd@z Thu Jan 1 00:00:00 1970 From: Johannes Sixt Subject: Re: "git clone" executed as root on solaris 10 shreds UFS (it ispossible to create hardlinks for directories as root under solaris) Date: Mon, 16 Jul 2007 16:35:10 +0200 Organization: eudaptics software gmbh Message-ID: <469B821E.85E5EDA9@eudaptics.com> References: <20070716100803.GA24036@cip.informatik.uni-erlangen.de> <20070716134529.GC26675@cip.informatik.uni-erlangen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Linus Torvalds , Junio C Hamano To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Mon Jul 16 16:34:39 2007 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1IARel-0006Qw-K7 for gcvg-git@gmane.org; Mon, 16 Jul 2007 16:34:35 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759290AbXGPOec (ORCPT ); Mon, 16 Jul 2007 10:34:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759139AbXGPOec (ORCPT ); Mon, 16 Jul 2007 10:34:32 -0400 Received: from main.gmane.org ([80.91.229.2]:59033 "EHLO ciao.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757064AbXGPOec (ORCPT ); Mon, 16 Jul 2007 10:34:32 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IAReU-0008HI-Oq for git@vger.kernel.org; Mon, 16 Jul 2007 16:34:18 +0200 Received: from cm56-163-160.liwest.at ([86.56.163.160]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jul 2007 16:34:18 +0200 Received: from J.Sixt by cm56-163-160.liwest.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jul 2007 16:34:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: cm56-163-160.liwest.at X-Mailer: Mozilla 4.73 [en] (Windows NT 5.0; U) X-Accept-Language: en Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org Archived-At: Thomas Glanzmann wrote: > static void create_directories(const char *path, const struct checkout *state) > { > ... > if (mkdir(buf, 0777)) { > => if (errno == EEXIST) { > struct stat st; > => if (len > state->base_dir_len && state->force && !unlink(buf) && !mkdir(buf, 0777)) > continue; > if (!stat(buf, &st) && S_ISDIR(st.st_mode)) > continue; /* ok */ > } > die("cannot create directory at %s", buf); > } > ... > > I think here is the problem. I don't understand what the code should do > actually. Or why the directory is deleted and re-created (maybe something todo > with permissions)? It tries to remove a *file* that is in the way and create the directory in its place. But since your unlink() behaves incorrectly (it is supposed to *fail* for directories), the logic does not quite work as expected - it mistakes the directory for a file. Try swapping the two inner-most if-blocks. -- Hannes