{"thread":{"id":"53198","subject":"[PATCH] mingw: cope with the Isilon network file system","startedAt":"2020-04-09T10:24:17Z","lastAt":"2020-04-10T20:21:22Z","messageCount":5,"participants":["Johannes Schindelin via GitGitGadget","Martin Ågren","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"395112","messageId":"pull.756.git.git.1586427853403.gitgitgadget@gmail.com","threadId":"53198","inReplyTo":null,"subject":"[PATCH] mingw: cope with the Isilon network file system","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-09T10:24:13Z","receivedAt":"2020-04-09T10:24:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Nathan Sanders <spekbukkem@gmail.com>\n\nOn certain network filesystems (currently encounterd with Isilon, but in\ntheory more network storage solutions could be causing the same issue),\nwhen the directory in question is missing, `raceproof_create_file()`\nfails with an `ERROR_INVALID_PARAMETER` instead of an\n`ERROR_PATH_NOT_FOUND`.\n\nSince it is highly unlikely that we produce such an error by mistake\n(the parameters we pass are fairly benign), we can be relatively certain\nthat the directory is missing in this instance. So let's just translate\nthat error automagically.\n\nThis fixes https://github.com/git-for-windows/git/issues/1345.\n\nSigned-off-by: Nathan Sanders <spekbukkem@gmail.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    mingw: cope with the Isilon network file system\n    \n    Yet another patch that has lived in Git for Windows for a while. In\n    contrast to the other patches I submitted today, it is younger than a\n    year, but not by much: its author date is Independence Day 2019.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-756%2Fdscho%2Fwork-around-isilon-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-756/dscho/work-around-isilon-v1\nPull-Request: https://github.com/git/git/pull/756\n\n compat/mingw.c | 15 +++++++++++++--\n 1 file changed, 13 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex d14065d60ec..201e99292fd 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -460,8 +460,19 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)\n \thandle = CreateFileW(wfilename, FILE_APPEND_DATA,\n \t\t\tFILE_SHARE_WRITE | FILE_SHARE_READ,\n \t\t\tNULL, create, FILE_ATTRIBUTE_NORMAL, NULL);\n-\tif (handle == INVALID_HANDLE_VALUE)\n-\t\treturn errno = err_win_to_posix(GetLastError()), -1;\n+\tif (handle == INVALID_HANDLE_VALUE) {\n+\t\tDWORD err = GetLastError();\n+\t\t/*\n+\t\t * Some network storage solutions (e.g. Isilon) might return\n+\t\t * ERROR_INVALID_PARAMETER instead of expected error\n+\t\t * ERROR_PATH_NOT_FOUND, which results in a unknow error. If\n+\t\t * so, the error is now forced to be an ERROR_PATH_NOT_FOUND\n+\t\t * error instead.\n+\t\t */\n+\t\tif (err == ERROR_INVALID_PARAMETER)\n+\t\t\terr = ERROR_PATH_NOT_FOUND;\n+\t\treturn errno = err_win_to_posix(err), -1;\n+\t}\n \n \t/*\n \t * No O_APPEND here, because the CRT uses it only to reset the\n\nbase-commit: 9fadedd637b312089337d73c3ed8447e9f0aa775\n-- \ngitgitgadget\n"},{"id":"395114","messageId":"CAN0heSrvZb3z3JdYSXs4Dy4nBwPYBAQZ5Zf2f9RSeUnyQSLeeg@mail.gmail.com","threadId":"53198","inReplyTo":"pull.756.git.git.1586427853403.gitgitgadget@gmail.com","subject":"Re: [PATCH] mingw: cope with the Isilon network file system","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2020-04-09T10:57:03Z","receivedAt":"2020-04-09T10:57:19Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On Thu, 9 Apr 2020 at 12:26, Johannes Schindelin via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n\n>         handle = CreateFileW(wfilename, FILE_APPEND_DATA,\n>                         FILE_SHARE_WRITE | FILE_SHARE_READ,\n>                         NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);\n> -       if (handle == INVALID_HANDLE_VALUE)\n> -               return errno = err_win_to_posix(GetLastError()), -1;\n\n(This code, which is being removed, used \",\" to avoid having to introduce\nbraces. There's another instance of this pattern a bit above.)\n\n> +       if (handle == INVALID_HANDLE_VALUE) {\n\n(Adding a brace here.)\n\n> +               DWORD err = GetLastError();\n> +               /*\n> +                * Some network storage solutions (e.g. Isilon) might return\n> +                * ERROR_INVALID_PARAMETER instead of expected error\n> +                * ERROR_PATH_NOT_FOUND, which results in a unknow error. If\n\ns/ a / an /\ns/unknow/&n/\n\n> +                * so, the error is now forced to be an ERROR_PATH_NOT_FOUND\n> +                * error instead.\n> +                */\n\n\"is now forced\" sounds more like it describes this change/commit, rather\nthan this piece of code. Maybe this final sentence can be scrapped\nentirely, since the forcing/translating/mapping is obvious from the code\nanyway? The remainder of the comment goes into *why* and looks more\nuseful. Just my 2 cents.\n\n> +               if (err == ERROR_INVALID_PARAMETER)\n> +                       err = ERROR_PATH_NOT_FOUND;\n> +               return errno = err_win_to_posix(err), -1;\n> +       }\n\nNow there's no need to avoid introducing braces, so maybe split this\ninto two lines for a lower huh-factor?\n\n  errno = err_win_to_posix(err);\n  return -1;\n\nMartin\n"},{"id":"395117","messageId":"nycvar.QRO.7.76.6.2004091356110.46@tvgsbejvaqbjf.bet","threadId":"53198","inReplyTo":"CAN0heSrvZb3z3JdYSXs4Dy4nBwPYBAQZ5Zf2f9RSeUnyQSLeeg@mail.gmail.com","subject":"Re: [PATCH] mingw: cope with the Isilon network file system","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-04-09T12:02:42Z","receivedAt":"2020-04-09T12:02:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Martin,\n\nOn Thu, 9 Apr 2020, Martin Ågren wrote:\n\n> On Thu, 9 Apr 2020 at 12:26, Johannes Schindelin via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n>\n> >         handle = CreateFileW(wfilename, FILE_APPEND_DATA,\n> >                         FILE_SHARE_WRITE | FILE_SHARE_READ,\n> >                         NULL, create, FILE_ATTRIBUTE_NORMAL, NULL);\n> > -       if (handle == INVALID_HANDLE_VALUE)\n> > -               return errno = err_win_to_posix(GetLastError()), -1;\n>\n> (This code, which is being removed, used \",\" to avoid having to introduce\n> braces. There's another instance of this pattern a bit above.)\n\nOh yes, that's an important point I had missed.\n\n> > +       if (handle == INVALID_HANDLE_VALUE) {\n>\n> (Adding a brace here.)\n>\n> > +               DWORD err = GetLastError();\n> > +               /*\n> > +                * Some network storage solutions (e.g. Isilon) might return\n> > +                * ERROR_INVALID_PARAMETER instead of expected error\n> > +                * ERROR_PATH_NOT_FOUND, which results in a unknow error. If\n>\n> s/ a / an /\n> s/unknow/&n/\n\nOh shucks. Usually I try to do a final review of the patches before I\n\"upstream\" them. Seems like the quality of my submission here is not what\nI want it to be.\n\n>\n> > +                * so, the error is now forced to be an ERROR_PATH_NOT_FOUND\n> > +                * error instead.\n> > +                */\n>\n> \"is now forced\" sounds more like it describes this change/commit, rather\n> than this piece of code. Maybe this final sentence can be scrapped\n> entirely, since the forcing/translating/mapping is obvious from the code\n> anyway? The remainder of the comment goes into *why* and looks more\n> useful. Just my 2 cents.\n>\n> > +               if (err == ERROR_INVALID_PARAMETER)\n> > +                       err = ERROR_PATH_NOT_FOUND;\n> > +               return errno = err_win_to_posix(err), -1;\n> > +       }\n>\n> Now there's no need to avoid introducing braces, so maybe split this\n> into two lines for a lower huh-factor?\n>\n>   errno = err_win_to_posix(err);\n>   return -1;\n\nAbsolutely.\n\nI updated the PR at https://github.com/git/git/pull/756 (also addressing\nissues with the commit message) and will wait for while before sending v2.\n\nThank you for your excellent review,\nDscho\n"},{"id":"395179","messageId":"pull.756.v2.git.git.1586518136956.gitgitgadget@gmail.com","threadId":"53198","inReplyTo":"pull.756.git.git.1586427853403.gitgitgadget@gmail.com","subject":"[PATCH v2] mingw: cope with the Isilon network file system","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-04-10T11:28:56Z","receivedAt":"2020-04-10T11:29:02Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Nathan Sanders <spekbukkem@gmail.com>\n\nOn certain network filesystems (currently encountered with Isilon, but\nin theory more network storage solutions could be causing the same\nissue), when the directory in question is missing,\n`raceproof_create_file()` fails with an `ERROR_INVALID_PARAMETER`\ninstead of an `ERROR_PATH_NOT_FOUND`.\n\nSince it is highly unlikely that we produce such an error by mistake\n(the parameters we pass are fairly benign), we can be relatively certain\nthat the directory is missing in this instance. So let's just translate\nthat error automagically.\n\nThis fixes https://github.com/git-for-windows/git/issues/1345.\n\nSigned-off-by: Nathan Sanders <spekbukkem@gmail.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    mingw: cope with the Isilon network file system\n    \n    Yet another patch that has lived in Git for Windows for a while.\n    \n    Changes since v1:\n    \n     * fixed a typo in the commit message (\"encounterd\")\n     * re-wrapped the first paragraph of the commit message to fit inside 72\n       columns/line\n     * fixed a typo in the code comment (\"a unknow\")\n     * reworded the code comment to read less like a commit message\n     * avoided the comma operator\n     * added some white-space to structure the code better\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-756%2Fdscho%2Fwork-around-isilon-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-756/dscho/work-around-isilon-v2\nPull-Request: https://github.com/git/git/pull/756\n\nRange-diff vs v1:\n\n 1:  e49df0e07fb ! 1:  c9b1d5c46cc mingw: cope with the Isilon network file system\n     @@ Metadata\n       ## Commit message ##\n          mingw: cope with the Isilon network file system\n      \n     -    On certain network filesystems (currently encounterd with Isilon, but in\n     -    theory more network storage solutions could be causing the same issue),\n     -    when the directory in question is missing, `raceproof_create_file()`\n     -    fails with an `ERROR_INVALID_PARAMETER` instead of an\n     -    `ERROR_PATH_NOT_FOUND`.\n     +    On certain network filesystems (currently encountered with Isilon, but\n     +    in theory more network storage solutions could be causing the same\n     +    issue), when the directory in question is missing,\n     +    `raceproof_create_file()` fails with an `ERROR_INVALID_PARAMETER`\n     +    instead of an `ERROR_PATH_NOT_FOUND`.\n      \n          Since it is highly unlikely that we produce such an error by mistake\n          (the parameters we pass are fairly benign), we can be relatively certain\n     @@ compat/mingw.c: static int mingw_open_append(wchar_t const *wfilename, int oflag\n      -\t\treturn errno = err_win_to_posix(GetLastError()), -1;\n      +\tif (handle == INVALID_HANDLE_VALUE) {\n      +\t\tDWORD err = GetLastError();\n     ++\n      +\t\t/*\n      +\t\t * Some network storage solutions (e.g. Isilon) might return\n      +\t\t * ERROR_INVALID_PARAMETER instead of expected error\n     -+\t\t * ERROR_PATH_NOT_FOUND, which results in a unknow error. If\n     -+\t\t * so, the error is now forced to be an ERROR_PATH_NOT_FOUND\n     -+\t\t * error instead.\n     ++\t\t * ERROR_PATH_NOT_FOUND, which results in an unknown error. If\n     ++\t\t * so, let's turn the error to ERROR_PATH_NOT_FOUND instead.\n      +\t\t */\n      +\t\tif (err == ERROR_INVALID_PARAMETER)\n      +\t\t\terr = ERROR_PATH_NOT_FOUND;\n     -+\t\treturn errno = err_win_to_posix(err), -1;\n     ++\n     ++\t\terrno = err_win_to_posix(err);\n     ++\t\treturn -1;\n      +\t}\n       \n       \t/*\n\n\n compat/mingw.c | 17 +++++++++++++++--\n 1 file changed, 15 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex d14065d60ec..0c71a223a97 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -460,8 +460,21 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)\n \thandle = CreateFileW(wfilename, FILE_APPEND_DATA,\n \t\t\tFILE_SHARE_WRITE | FILE_SHARE_READ,\n \t\t\tNULL, create, FILE_ATTRIBUTE_NORMAL, NULL);\n-\tif (handle == INVALID_HANDLE_VALUE)\n-\t\treturn errno = err_win_to_posix(GetLastError()), -1;\n+\tif (handle == INVALID_HANDLE_VALUE) {\n+\t\tDWORD err = GetLastError();\n+\n+\t\t/*\n+\t\t * Some network storage solutions (e.g. Isilon) might return\n+\t\t * ERROR_INVALID_PARAMETER instead of expected error\n+\t\t * ERROR_PATH_NOT_FOUND, which results in an unknown error. If\n+\t\t * so, let's turn the error to ERROR_PATH_NOT_FOUND instead.\n+\t\t */\n+\t\tif (err == ERROR_INVALID_PARAMETER)\n+\t\t\terr = ERROR_PATH_NOT_FOUND;\n+\n+\t\terrno = err_win_to_posix(err);\n+\t\treturn -1;\n+\t}\n \n \t/*\n \t * No O_APPEND here, because the CRT uses it only to reset the\n\nbase-commit: 9fadedd637b312089337d73c3ed8447e9f0aa775\n-- \ngitgitgadget\n"},{"id":"395239","messageId":"xmqqy2r3hz2a.fsf@gitster.c.googlers.com","threadId":"53198","inReplyTo":"pull.756.v2.git.git.1586518136956.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] mingw: cope with the Isilon network file system","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-04-10T20:21:17Z","receivedAt":"2020-04-10T20:21:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Nathan Sanders <spekbukkem@gmail.com>\n>\n> On certain network filesystems (currently encountered with Isilon, but\n> in theory more network storage solutions could be causing the same\n> issue), when the directory in question is missing,\n> `raceproof_create_file()` fails with an `ERROR_INVALID_PARAMETER`\n> instead of an `ERROR_PATH_NOT_FOUND`.\n\nQueued.\n"}]}