public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Johannes Sixt <j6t@kdbg•org>
Cc: Jeff King <peff@peff•net>, Michael Blume <blume.mike@gmail•com>,
	git@vger•kernel.org
Subject: Re: [PATCH] t1410: fix breakage on case-insensitive filesystems
Date: Fri, 14 Nov 2014 12:03:03 -0800	[thread overview]
Message-ID: <xmqqoas935zc.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <546653D6.7040505@kdbg.org> (Johannes Sixt's message of "Fri, 14 Nov 2014 20:11:18 +0100")

Johannes Sixt <j6t@kdbg•org> writes:

> Not a comment, on this paragraph of yours, but while I was walking
> through the code with gdb, I was wondering why the reflog directory is
> being touched at all when core.logallrefupdates is off (in
> log_ref_setup via log_ref_write). With the patch below I now get the
> same unlink warning as on Linux.

I do not do Windows, but your analysis feels really sound and
explains the symptom well, and the change looks like the right fix
to the issue.

Thanks.

> --- 8< ---
> Subject: [PATCH] Windows: correct detection of EISDIR in mingw_open()
>
> According to the Linux open(2) man page, open() returns EISDIR if a
> directory was attempted to be opened for writing. Our emulation in
> mingw_open() does not get this right: it checks only for O_CREAT. Fix
> it to check for one of the write flags.
>
> This fixes a failure in reflog handling, which opens files with
> O_APPEND|O_WRONLY, but without O_CREAT, and expects EISDIR when the
> named file happens to be a directory.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg•org>
> ---
>  compat/mingw.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/compat/mingw.c b/compat/mingw.c
> index 2ee3fe3..fc64b73 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -312,7 +312,7 @@ int mingw_open (const char *filename, int oflags, ...)
>  		return -1;
>  	fd = _wopen(wfilename, oflags, mode);
>  
> -	if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
> +	if (fd < 0 && (oflags & (O_WRONLY|O_RDWR)) && errno == EACCES) {
>  		DWORD attrs = GetFileAttributesW(wfilename);
>  		if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
>  			errno = EISDIR;
> -- 
> 2.0.0.12.gbcf935e
>
> -- 

  parent reply	other threads:[~2014-11-14 20:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08 19:28 Test failure Michael Blume
2014-11-09  1:43 ` Jeff King
2014-11-09  1:59   ` [PATCH] t1410: fix breakage on case-insensitive filesystems Jeff King
2014-11-09 17:34     ` Michael Blume
2014-11-09 17:48       ` Junio C Hamano
2014-11-10  6:30         ` Jeff King
2014-11-10  6:47           ` Junio C Hamano
2014-11-10  7:04             ` Jeff King
2014-11-09 20:04       ` Torsten Bögershausen
2014-11-09 21:36         ` Michael Blume
2014-11-09 21:42           ` Torsten Bögershausen
2014-11-10  2:46             ` Michael Blume
2014-11-10  2:56     ` Junio C Hamano
2014-11-10  6:09       ` Jeff King
2014-11-12 20:20     ` Johannes Sixt
2014-11-12 21:59       ` Jeff King
2014-11-13  8:50         ` Johannes Sixt
2014-11-13  9:08           ` Jeff King
2014-11-13 16:30             ` Junio C Hamano
2014-11-14 19:11             ` Johannes Sixt
2014-11-14 19:23               ` Jeff King
2014-11-14 20:03               ` Junio C Hamano [this message]
2014-11-14 21:04               ` Andreas Schwab
2014-11-15  8:27                 ` Johannes Sixt
2014-11-16 21:06                   ` [PATCH v2] Windows: correct detection of EISDIR in mingw_open() Johannes Sixt
2014-11-09  5:44   ` Test failure Michael Blume

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=xmqqoas935zc.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=blume.mike@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=j6t@kdbg$(echo .)org \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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