Re: [PATCH v3 13/13] is_missing_file_error(): work around EINVAL on Windows
- From
Stefan Beller <sbeller@google.com>
- Date
- May 30, 2017, 19:13 UTC
- Message-ID
- <CAGZ79kZC4WM=aXPO9Rk1GQ7+XKUhoWUZefjM6Trk-11QcrhBYA@mail.gmail.com>
- In-Reply-To
- <20170526033510.1793-14-gitster@pobox.com>
On Thu, May 25, 2017 at 8:35 PM, Junio C Hamano <gitster@pobox.com> wrote:
> When asked to open/fopen a path, e.g. "a/b:/c", which does not exist > on the filesystem, Windows (correctly) fails to open it but sets > EINVAL to errno
errno to EINVAL (as of now it sounds as if it is a EINVAL = errno, which makes no sense to me)
Show 7 quoted lines
> because the pathname has characters that cannot be > stored in its filesystem. > > As this is an expected failure, teach is_missing_file_error() helper > about this case. > > This is RFC,
cc'd people knowledgeable of Windows.
Show 28 quoted lines
> as there may be a case where we get EINVAL from
> open/fopen for reasons other than "the filesystem does not like this
> pathname" that may be worth reporting to the user, and this change
> is sweeping such an error under the rug.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> wrapper.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/wrapper.c b/wrapper.c
> index f1c87ec7ea..74aa3b7803 100644
> --- a/wrapper.c
> +++ b/wrapper.c
> @@ -434,6 +434,10 @@ static void warn_on_inaccessible(const char *path)
> * see if the errno indicates a missing file that we can safely ignore.
> */
> static int is_missing_file_error(int errno_) {
> +#ifdef GIT_WINDOWS_NATIVE
> + if (errno_ == EINVAL)
> + return 1;
> +#endif
> return (errno_ == ENOENT || errno_ == ENOTDIR);
> }
>
> --
> 2.13.0-491-g71cfeddc25
>