From 56c041b88979bcdc3cf0f995f47bba9393cdfbb3 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 24 Sep 2017 13:43:50 -0500 Subject: [PATCH] Work around WSL access(2) EINVAL bug See Microsoft/BashOnWindows#2522, Microsoft/BashOnWindows#2448 --- src/path.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/path.cpp b/src/path.cpp index c8e8b6af7..a5ad76b2d 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -86,6 +86,13 @@ static bool path_get_path_core(const wcstring &cmd, wcstring *out_path, case ENOTDIR: { break; } + //WSL has a bug where access(2) can return EINVAL + //See https://github.com/Microsoft/BashOnWindows/issues/2522 + //The only other way EINVAL can happen is if the wrong + //mode was specified, but we have X_OK hard-coded above. + case EINVAL: { + break; + } default: { debug(1, MISSING_COMMAND_ERR_MSG, next_path.c_str()); wperror(L"access");