All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Jeff King <peff@peff.net>, Patrick Steinhardt <ps@pks.im>,
	git@vger.kernel.org
Subject: Re: What's cooking in git.git (Apr 2021, #04; Thu, 15)
Date: Fri, 16 Apr 2021 06:33:07 -0700	[thread overview]
Message-ID: <xmqq5z0mnylo.fsf@gitster.g> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.2104161320250.52@tvgsbejvaqbjf.bet> (Johannes Schindelin's message of "Fri, 16 Apr 2021 13:21:01 +0200 (CEST)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Seems that this fixes it for me:

I can see that we avoid passing X_OK to _waccess() for normal paths
(outside the post context of this hunk).  Hence, it is consistent to
answer "yes" if somebody ever asks if NUL (/dev/null) is executable.

IOW, unconditional return of 0 this patch adds is the right thing to
do.

Thanks for a quick turnaround.


> -- snipsnap --
> From 754593d6bda3754ab4afaa98b814351e922a1fe3 Mon Sep 17 00:00:00 2001
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> Date: Fri, 16 Apr 2021 13:11:05 +0200
> Subject: [PATCH] msvc: avoid calling `access("NUL", flags)`
>
> Apparently this is not supported with Microsoft's Universal C Runtime.
> So let's not actually do that.
>
> Instead, just return success because we _know_ that we expect the `NUL`
> device to be present.
>
> Side note: it is possible to turn off the "Null device driver" and
> thereby disable `NUL`. Too many things are broken if this driver is
> disabled, therefore it is not worth bothering to try to detect its
> presence when `access()` is called.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  compat/mingw.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/compat/mingw.c b/compat/mingw.c
> index a43599841c6c..aa647b367b0f 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -685,6 +685,8 @@ ssize_t mingw_write(int fd, const void *buf, size_t len)
>  int mingw_access(const char *filename, int mode)
>  {
>  	wchar_t wfilename[MAX_PATH];
> +	if (!strcmp("nul", filename) || !strcmp("/dev/null", filename))
> +		return 0;
>  	if (xutftowcs_path(wfilename, filename) < 0)
>  		return -1;
>  	/* X_OK is not supported by the MSVCRT version */
> --
> 2.31.1.windows.1

  reply	other threads:[~2021-04-16 13:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  0:04 What's cooking in git.git (Apr 2021, #04; Thu, 15) Junio C Hamano
2021-04-16  2:59 ` Jeff King
2021-04-16  3:04   ` Jeff King
2021-04-16 11:21   ` Johannes Schindelin
2021-04-16 13:33     ` Junio C Hamano [this message]
2021-04-17  8:47     ` Jeff King
2021-04-17 13:19 ` Ævar Arnfjörð Bjarmason
2021-04-18 16:55 ` Sergey Organov
2021-04-18 19:09   ` Junio C Hamano

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=xmqq5z0mnylo.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /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.