git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] mingw: cope with the Isilon network file system

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 9, 2020, 10:24 UTC
Message-ID
<pull.756.git.git.1586427853403.gitgitgadget@gmail.com>
From: Nathan Sanders <spekbukkem@gmail.com>

On certain network filesystems (currently encounterd with Isilon, but in theory more network storage solutions could be causing the same issue), when the directory in question is missing, `raceproof_create_file()` fails with an `ERROR_INVALID_PARAMETER` instead of an `ERROR_PATH_NOT_FOUND`.

Since it is highly unlikely that we produce such an error by mistake (the parameters we pass are fairly benign), we can be relatively certain that the directory is missing in this instance. So let's just translate that error automagically.

This fixes https://github.com/git-for-windows/git/issues/1345.
Signed-off-by: Nathan Sanders <spekbukkem@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    mingw: cope with the Isilon network file system
    
    Yet another patch that has lived in Git for Windows for a while. In
    contrast to the other patches I submitted today, it is younger than a
    year, but not by much: its author date is Independence Day 2019.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-756%2Fdscho%2Fwork-around-isilon-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-756/dscho/work-around-isilon-v1
Pull-Request: https://github.com/git/git/pull/756
 compat/mingw.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index d14065d60ec..201e99292fd 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -460,8 +460,19 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)
 	handle = CreateFileW(wfilename, FILE_APPEND_DATA,
 			FILE_SHARE_WRITE | FILE_SHARE_READ,
 			NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);
-	if (handle == INVALID_HANDLE_VALUE)
-		return errno = err_win_to_posix(GetLastError()), -1;
+	if (handle == INVALID_HANDLE_VALUE) {
+		DWORD err = GetLastError();
+		/*
+		 * Some network storage solutions (e.g. Isilon) might return
+		 * ERROR_INVALID_PARAMETER instead of expected error
+		 * ERROR_PATH_NOT_FOUND, which results in a unknow error. If
+		 * so, the error is now forced to be an ERROR_PATH_NOT_FOUND
+		 * error instead.
+		 */
+		if (err == ERROR_INVALID_PARAMETER)
+			err = ERROR_PATH_NOT_FOUND;
+		return errno = err_win_to_posix(err), -1;
+	}
 
 	/*
 	 * No O_APPEND here, because the CRT uses it only to reset the

base-commit: 9fadedd637b312089337d73c3ed8447e9f0aa775
-- 
gitgitgadget
Next: Martin Ågren
Message 1 of 5 in “mingw: cope with the Isilon network file system”
  1. mingw: cope with the Isilon network file systemJohannes Schindelin via GitGitGadget, Apr 9, 2020
  2. Martin ÅgrenApr 9, 2020
  3. Johannes SchindelinApr 9, 2020
  4. mingw: cope with the Isilon network file systemJohannes Schindelin via GitGitGadget, Apr 10, 2020
  5. Junio C HamanoApr 10, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.