Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving ERROR_INVALID_PARAMETER issue with some network storage sol… #2253

Merged
merged 1 commit into from
Jul 8, 2019
Merged

Resolving ERROR_INVALID_PARAMETER issue with some network storage sol… #2253

merged 1 commit into from
Jul 8, 2019

Conversation

naatje80
Copy link

@naatje80 naatje80 commented Jul 4, 2019

Fix for unexpected error (ERROR_INVALID_PARAMETER) instead of ERROR_PATH_NOT_FOUND on certain network storage during creation of files for which the full path does not exist yet.

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much.

I added a couple of suggestions how to get this production-ready, and I think we're really, really close to having a solution. Great work, @naatje80!

compat/mingw.c Outdated
return errno = err_win_to_posix(GetLastError()), -1;

if (handle == INVALID_HANDLE_VALUE) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please lose the extra empty line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

compat/mingw.c Outdated

DWORD err = GetLastError();

// Some network storage solutions (e.g. Isilon) might return ERROR_INVALID_PARAMETER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Git's source code, there are only /* ... */ style comments, not C++/C99 ones. Please change this comment accordingly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I indeed should have used the same style that was already used in the existing code

@@ -661,8 +661,18 @@ static int mingw_open_append(wchar_t const *wfilename, int oflags, ...)
handle = CreateFileW(wfilename, FILE_APPEND_DATA,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message needs a little bit of work... Just imagine that you yourself stumble over this commit in six months from now, not remembering what you did, but wanting to figure it out.

To that end, the Git project tries to enforce very informative commit messages, in a somewhat idiomatic form.

In particular, the commit message should focus a bit more on the "Why?" and to a lesser extent the "What?" than the "How?".

In this case, I would strongly suggest something along those lines:

mingw: cope with the Isilon network file system

On certain network filesystems (*cough* Isilon), 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: ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will reuse most of your example, if you are fine by that. I do not what to re-invent the wheel as we say in Dutch :). I personally only work on small scale projects, but I fully understand the more verbose commit.

compat/mingw.c Outdated Show resolved Hide resolved
@naatje80
Copy link
Author

naatje80 commented Jul 5, 2019

The requested changes should have been pushed.

@dscho
Copy link
Member

dscho commented Jul 5, 2019

The requested changes should have been pushed.

Could you please squash the two commits into one, using the second commits' message? The easiest will be using git rebase -i HEAD~2, replacing the second pick by squash in the editor that pops up, then save and close the editor, and then removing the first commit message from the combined message that pops up in another editor, then save, close, and force-push.

Thank you!

@naatje80
Copy link
Author

naatje80 commented Jul 5, 2019

Done

@dscho
Copy link
Member

dscho commented Jul 5, 2019

Would you kindly use your real name in the Signed-off-by: line? It is required by the Git project, and I won't be able to upstream this patch without it. Thanks.

@naatje80
Copy link
Author

naatje80 commented Jul 6, 2019

I admire your patience with me. Done again.

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 #1345.

Signed-off-by: Nathan Sanders <spekbukkem@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Member

dscho commented Jul 8, 2019

I admire your patience with me.

May I return the compliment? You analyzed this really well, and I have seen few Git for Windows contributors with your amount of grit.

Done again.

Thank you. I amended this with my Sign-off after aligning the white-space, and will merge now.

Thanks so much!

@dscho dscho added this to the v2.22.0(2) milestone Jul 8, 2019
@dscho dscho merged commit fcf334e into git-for-windows:master Jul 8, 2019
git-for-windows-ci pushed a commit that referenced this pull request Jul 8, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 8, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 8, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 8, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 9, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 10, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 11, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
dscho added a commit that referenced this pull request Jul 11, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 11, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
dscho added a commit that referenced this pull request Jul 12, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 12, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Jul 12, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
dscho added a commit that referenced this pull request Jul 15, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 8, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 8, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 8, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 9, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 9, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 9, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 12, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 12, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 12, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 12, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 14, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 14, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 16, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
dscho added a commit that referenced this pull request Aug 22, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Aug 23, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Sep 2, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
dscho added a commit that referenced this pull request Sep 24, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Sep 30, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
dscho added a commit that referenced this pull request Oct 2, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Oct 7, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
git-for-windows-ci pushed a commit that referenced this pull request Oct 17, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
dscho added a commit that referenced this pull request Oct 21, 2019
Resolving ERROR_INVALID_PARAMETER issue with some network storage sol…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants