Work around WSL access(2) EINVAL bug

See Microsoft/BashOnWindows#2522, Microsoft/BashOnWindows#2448

(cherry picked from commit 56c041b889)
This commit is contained in:
Mahmoud Al-Qudsi 2017-09-24 13:43:50 -05:00
parent bcd9c39509
commit 93d352b809

View File

@ -86,6 +86,13 @@ static bool path_get_path_core(const wcstring &cmd, wcstring *out_path,
case ENOTDIR: { case ENOTDIR: {
break; 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: { default: {
debug(1, MISSING_COMMAND_ERR_MSG, next_path.c_str()); debug(1, MISSING_COMMAND_ERR_MSG, next_path.c_str());
wperror(L"access"); wperror(L"access");