{"thread":{"id":"6393","subject":"[PATCH] Solaris 5.8 returns ENOTDIR for inappropriate renames.","startedAt":"2007-01-16T01:30:59Z","lastAt":"2007-01-16T02:56:22Z","messageCount":2,"participants":["Jason Riedy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"31789","messageId":"17433.1168911059@lotus.CS.Berkeley.EDU","threadId":"6393","inReplyTo":null,"subject":"[PATCH] Solaris 5.8 returns ENOTDIR for inappropriate renames.","fromName":"Jason Riedy","fromEmail":"ejr@eecs.berkeley.edu","sentAt":"2007-01-16T01:30:59Z","receivedAt":"2007-01-16T01:30:59Z","isPatch":true,"sender":{"key":"ejr@eecs.berkeley.edu","avatar":"https://gravatar.com/avatar/547fa56f887cab01599edab4e9f813c949c1269e02714f20e0496c56185d9837?d=mp&s=160"},"body":"The reflog code clears empty directories when rename returns\neither EISDIR or ENOTDIR.  Seems to be the only place.\n\nSigned-off-by: Jason Riedy <ejr@cs.berkeley.edu>\n---\n   Haven't been keeping up with the list, so I apologize if I've\n   missed discussions related to these changes.\n\n refs.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/refs.c b/refs.c\nindex 689ac50..851b573 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -837,7 +837,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)\n \n  retry:\n \tif (log && rename(git_path(\"tmp-renamed-log\"), git_path(\"logs/%s\", newref))) {\n-\t\tif (errno==EISDIR) {\n+\t\tif (errno==EISDIR || errno==ENOTDIR) {\n \t\t\tif (remove_empty_directories(git_path(\"logs/%s\", newref))) {\n \t\t\t\terror(\"Directory not empty: logs/%s\", newref);\n \t\t\t\tgoto rollback;\n-- \n1.5.0.rc1.gf4b6c\n"},{"id":"31795","messageId":"7vslebznl5.fsf@assigned-by-dhcp.cox.net","threadId":"6393","inReplyTo":"17433.1168911059@lotus.CS.Berkeley.EDU","subject":"Re: [PATCH] Solaris 5.8 returns ENOTDIR for inappropriate renames.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-16T02:56:22Z","receivedAt":"2007-01-16T02:56:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jason Riedy <ejr@EECS.Berkeley.EDU> writes:\n\n> The reflog code clears empty directories when rename returns\n> either EISDIR or ENOTDIR.  Seems to be the only place.\n>\n> Signed-off-by: Jason Riedy <ejr@cs.berkeley.edu>\n> ---\n>    Haven't been keeping up with the list, so I apologize if I've\n>    missed discussions related to these changes.\n>\n>  refs.c |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/refs.c b/refs.c\n> index 689ac50..851b573 100644\n> --- a/refs.c\n> +++ b/refs.c\n> @@ -837,7 +837,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)\n>  \n>   retry:\n>  \tif (log && rename(git_path(\"tmp-renamed-log\"), git_path(\"logs/%s\", newref))) {\n> -\t\tif (errno==EISDIR) {\n> +\t\tif (errno==EISDIR || errno==ENOTDIR) {\n>  \t\t\tif (remove_empty_directories(git_path(\"logs/%s\", newref))) {\n>  \t\t\t\terror(\"Directory not empty: logs/%s\", newref);\n>  \t\t\t\tgoto rollback;\n\nSorry, I do not understand.\n\nBefore this codepath, we have done safe_create_directories() and\nshould have already errored out if the parent directory of\n\"logs/$newref\" couldn't have been created for whatever reason.\nSo when this rename fails, we have a file \".git/tmp-renamed-log\"\nand a directory \".git/logs/foo\", and we are trying to rename the\nformer to \".git/logs/foo/bar\".\n\nNow \".git/logs/foo/bar\" might already exist as a directory, and\nthis error path is attempting to catch EISDIR that comes out\nfrom it (and in that case, if there is nothing but empty\ndirectories in the hierarchy under .git/logs/foo/bar, we \nremove them and retry).\n\nDoes Solaris give ENOTDIR in such a case?\n"}]}