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
[CABMAN] Fix a problem with creating temp files on some Windows system #514
Conversation
FileHandle = fopen(tmpnam(NULL) + 1, "wb"); | ||
if (FileHandle == NULL) | ||
return CAB_STATUS_CANNOT_CREATE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really know what causes this breakage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first tmpfile()
fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason tmpfile() fails. Only happens with GCC builds, only on some Windows 10 systems. This fixes it for me. Everything else is left as an exersize to the reader ;-)
I think merging this PR is still blocked by people not being able to reproduce the problem and not understanding the fix. And frankly spoken, it is hard to believe that tmpnam() always succeeds when tmpfile() fails. For the record, MinGW builds of cabman.exe link against the OS msvcrt.dll to import tmpfile(). Visual Studio builds on the other hand statically link tmpfile() from their shipped CRT. A minimal test to reproduce the tmpfile() problem may be the example code at https://msdn.microsoft.com/nl-nl/library/windows/desktop/x8x7sakw.aspx. @tkreuzer, does that trigger the problem for you as well? Furthermore, the proposed fix does not handle a possible failure of tmpnam(). We either need to understand the root cause and try to fix that. Or, if that is not possible or too boring, the code needs to be rewritten to not call tmp* CRT functions at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes (see my previous comment)
Hmm. Looks like this PR is only blocked by ... @ColinFinck :) |
Interesting! Diffing old VS crt vs new VS crt one could help knowing what happened there 😃 |
Reopening, since it is still not fixed for me, not sure how and why it succeeded in between. |
0955162
to
cfa0617
Compare
See CORE-14431