All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Jason Riedy <ejr@EECS.Berkeley.EDU>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Solaris 5.8 returns ENOTDIR for inappropriate renames.
Date: Mon, 15 Jan 2007 18:56:22 -0800	[thread overview]
Message-ID: <7vslebznl5.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <17433.1168911059@lotus.CS.Berkeley.EDU> (Jason Riedy's message of "Mon, 15 Jan 2007 17:30:59 -0800")

Jason Riedy <ejr@EECS.Berkeley.EDU> writes:

> The reflog code clears empty directories when rename returns
> either EISDIR or ENOTDIR.  Seems to be the only place.
>
> Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>
> ---
>    Haven't been keeping up with the list, so I apologize if I've
>    missed discussions related to these changes.
>
>  refs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 689ac50..851b573 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -837,7 +837,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
>  
>   retry:
>  	if (log && rename(git_path("tmp-renamed-log"), git_path("logs/%s", newref))) {
> -		if (errno==EISDIR) {
> +		if (errno==EISDIR || errno==ENOTDIR) {
>  			if (remove_empty_directories(git_path("logs/%s", newref))) {
>  				error("Directory not empty: logs/%s", newref);
>  				goto rollback;

Sorry, I do not understand.

Before this codepath, we have done safe_create_directories() and
should have already errored out if the parent directory of
"logs/$newref" couldn't have been created for whatever reason.
So when this rename fails, we have a file ".git/tmp-renamed-log"
and a directory ".git/logs/foo", and we are trying to rename the
former to ".git/logs/foo/bar".

Now ".git/logs/foo/bar" might already exist as a directory, and
this error path is attempting to catch EISDIR that comes out
from it (and in that case, if there is nothing but empty
directories in the hierarchy under .git/logs/foo/bar, we 
remove them and retry).

Does Solaris give ENOTDIR in such a case?

  reply	other threads:[~2007-01-16  2:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16  1:30 [PATCH] Solaris 5.8 returns ENOTDIR for inappropriate renames Jason Riedy
2007-01-16  2:56 ` Junio C Hamano [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-01-16  3:16 Jason Riedy

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=7vslebznl5.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=ejr@EECS.Berkeley.EDU \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.