-
Notifications
You must be signed in to change notification settings - Fork 27
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
Windows: Move temp files to Temp directory. #184
Conversation
e8f7c01
to
2b396ed
Compare
I noticed that this change breaks selftests in a way I don't completely understand. I suspect there might something wrong with wine configuration but I'm not sure.
Any ideas? |
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.
Hadn't seen this before I wrote #186
for (int i = 0; hFile == INVALID_HANDLE_VALUE && i < 16; ++i) { | ||
wcscat(_ultow(next_random(), tmpname, 36), L".tmp"); // yes, base 36 | ||
DWORD access = GENERIC_READ | GENERIC_WRITE; | ||
DWORD sharemode = FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE; | ||
DWORD creation = CREATE_NEW; | ||
DWORD flags = FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE; | ||
hFile = CreateFileW(tmpname, access, sharemode, &sa, creation, flags, NULL); | ||
|
||
if ((wcslen(tmppath) + wcslen(tmpname)) >= MAX_PATH) |
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.
That doesn't happen for all file names. The shortest file name we'll generate is "0.tmp" and the longest is "1z141z4.tmp". So there's a possibility that some paths will work.
Either way, either we handle GetTempPathW returning too long a string before the loop or we simply continue
here. Or both.
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.
Should be done now
@lukasz-tuz and I made some experiments about opendcdiag selftests failing:
|
I recreated the conditions on Wine by simply doing a |
Lack of full path to output log file is only part of this (albeit needs to be fixed). However:
Going to run a targeted test, where previously failing environment gets a Wine update (and just Wine, to rule out any other dependencies). |
I don't know where the environment came from in my ~/.wine/user.reg, but it does show: [Environment] 1632151948
#time=1d7ae34b87983e8
"PATH"="C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;C:\\windows\\system32\\WindowsPowershell\\v1.0;C:\\MinGW\\bin;C:\\Qt\\qtbase\\bin"
"QT_FORCE_STDERR_LOGGING"="1"
"TEMP"="C:\\users\\tjmaciei\\Temp"
"TMP"="C:\\users\\tjmaciei\\Temp" I don't remember setting them and I probably wouldn't have set them to the path that is shown there (I'd choose "Z:\tmp"), but the other two variables are definitely me. Another thing is that tracing its execution shows just how Wine executes GetTempPathW:
That is, the darned thing does a |
I've just tested this patch with Wine 7.22 on Arch Linux, with and without WINE_ROOT set. The selftests launch and (mostly) pass. I get a BATS failure on |
Well, it probably isn't. Quoting the documentation for GetTempPathW:
The last one probably just looks for
Same result here. |
Ah, the problem was right there, staring me in the face: // MinGW's ftruncate64 tries to check free disk space and that fails on Wine,
// so use the the 32-bit offset version (which calls _chsize) And the following typo: # undef fruncate After changing to # undef ftruncate
|
a5f7942
to
0eca7aa
Compare
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.
Approving to unblock, but my comment on tmpfile.c is unaddressed.
2b396ed
to
a830f07
Compare
For Windows compilations of OpenDCDiag, temp files were created in directory where the .exe is placed. The application doesn't always have access rights to do that. Changes here move all temp files to Windows designated area: C:\Users\%username\AppData\Local\Temp Signed-off-by: dawid-sabat <dawid.sabat@intel.com>
Signed-off-by: Lukasz Tuz <lukasz.tuz@intel.com>
a830f07
to
abd15dc
Compare
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.
LGTM.
For Windows compilations of OpenDCDiag, temp files were created in directory where the .exe is placed. The application doesn't always have access rights to do that.
Changes here move all temp files to Windows designated area: C:\Users%username\AppData\Local\Temp
Signed-off-by: dawid-sabat dawid.sabat@intel.com