http://bugs.winehq.org/show_bug.cgi?id=34174
Bug #: 34174 Summary: Error cleaning log file when installing mingw Product: Wine Version: 1.6-rc5 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: b7.10110111@gmail.com Classification: Unclassified
Created attachment 45459 --> http://bugs.winehq.org/attachment.cgi?id=45459 Terminal log
How to reproduce: 0. (Clean wine prefix after running winecfg was used for this) 1. Install mingw-get-inst-20120426.exe with default settings (but accept license of course :) ) 2. See a message "Encountered an error cleaning log file (1)" 3. Then after you press OK and click next with a tick "show log file" enabled see empty log file opened in notepad.
http://bugs.winehq.org/show_bug.cgi?id=34174
Ruslan Kabatsayev b7.10110111@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
http://bugs.winehq.org/show_bug.cgi?id=34174
Ruslan Kabatsayev b7.10110111@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- URL| |http://downloads.sourceforg | |e.net/project/mingw/Install | |er/mingw-get-inst/mingw-get | |-inst-20120426/mingw-get-in | |st-20120426.exe
https://bugs.winehq.org/show_bug.cgi?id=34174
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net, | |super_man@post.com
https://bugs.winehq.org/show_bug.cgi?id=34174
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |Installer Status|UNCONFIRMED |NEW Component|-unknown |cmd Summary|Error cleaning log file |MinGW installer |when installing mingw |0.5-beta-20120426-1 fails | |to process log files | |(sharing violation on temp | |file used for piped output) Ever confirmed|0 |1
--- Comment #1 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming.
--- snip --- $ WINEDEBUG=+tid,+seh,+relay,+cmd,+file wine ./mingw-get-inst-20120426.exe
log.txt 2>&1
... 0025:Call KERNEL32.CreateProcessA(00000000,00430334 ""C:\users\focht\Temp\is-PM9P2.tmp\mingw-get-inst-20120426.tmp" /SL5="$6005C,386497,87552,Z:\home\focht\Downloads\mingw-get-inst-20120426.exe" ",00000000,00000000,00000000,00000000,00000000,00000000,0032fd84,0032fd74) ret=00409a19 ... 0030:Call KERNEL32.__wine_kernel_init() ret=7bc688f1 ... 0025:Ret KERNEL32.CreateProcessA() retval=00000001 ret=00409a19 ... 0030:Call KERNEL32.CreateProcessA(00000000,005224a8 ""C:\windows\system32\cmd.exe" /c mingw-get.exe install mingw-get pkginfo base gcc-core 2>&1 | "C:\MinGW\libexec\mingw-get\tee.exe" "C:\MinGW\var\log\mingw-get-log.orig.txt"",00000000,00000000,00000000,04000000,00000000,00526818 "C:\MinGW\bin",0033edc4,0033edb4) ret=00451ea1 ... 000d:Call KERNEL32.__wine_kernel_init() ret=7bc688f1 ... 0030:Ret KERNEL32.CreateProcessA() retval=00000001 ret=00451ea1 ... 000d:trace:cmd:WCMD_DumpCommands Parsed line: 000d:trace:cmd:WCMD_DumpCommands 0x1329a8 0 00 0x132bd0 L"mingw-get.exe install mingw-get pkginfo base gcc-core " Redir:L"2>&1 " 000d:trace:cmd:WCMD_DumpCommands 0x132bd0 3 00 (nil) L""C:\MinGW\libexec\mingw-get\tee.exe" "C:\MinGW\var\log\mingw-get-log.orig.txt"" Redir:L"" 000d:trace:cmd:WCMD_process_commands Executing command: 'L"mingw-get.exe install mingw-get pkginfo base gcc-core "' 000d:Call KERNEL32.GetStdHandle(fffffff6) ret=7ecb2a12 000d:Ret KERNEL32.GetStdHandle() retval=0000000f ret=7ecb2a12 000d:Call KERNEL32.GetStdHandle(fffffff5) ret=7ecb2a25 000d:Ret KERNEL32.GetStdHandle() retval=00000010 ret=7ecb2a25 000d:Call KERNEL32.GetStdHandle(fffffff4) ret=7ecb2a38 000d:Ret KERNEL32.GetStdHandle() retval=00000014 ret=7ecb2a38 000d:trace:cmd:WCMD_execute command on entry:L"mingw-get.exe install mingw-get pkginfo base gcc-core " (0x33b3d0) 000d:trace:cmd:WCMD_execute Output needs to be piped ... 000d:trace:cmd:WCMD_execute Using temporary file of L"C:\users\focht\Temp\CMD5c00.tmp" ... 000d:trace:cmd:WCMD_execute Redirects now L"2>&1 > C:\users\focht\Temp\CMD5c00.tmp" 000d:Call KERNEL32.GetStdHandle(fffffff5) ret=7ecb308f 000d:Ret KERNEL32.GetStdHandle() retval=00000010 ret=7ecb308f 000d:Call KERNEL32.DuplicateHandle(ffffffff,00000010,ffffffff,0033b2dc,00000000,00000001,00000002) ret=7ecb30ae 000d:Ret KERNEL32.DuplicateHandle() retval=00000001 ret=7ecb30ae 000d:Call KERNEL32.GetStdHandle(fffffff5) ret=7ecb3143 000d:Ret KERNEL32.GetStdHandle() retval=00000010 ret=7ecb3143 000d:trace:cmd:WCMD_execute Redirect 2 (0x10) to 1 (0x38) 000d:Call KERNEL32.SetStdHandle(fffffff4,00000038) ret=7ecb3283 000d:Ret KERNEL32.SetStdHandle() retval=00000001 ret=7ecb3283 000d:Call KERNEL32.CreateFileW(7ed6ea60 L"C:\users\focht\Temp\CMD5c00.tmp",40000000,00000000,0033b2d0,00000002,00000080,00000000) ret=7ecb31b0 000d:trace:file:CreateFileW L"C:\users\focht\Temp\CMD5c00.tmp" GENERIC_WRITE creation 2 attributes 0x80 ... 000d:trace:file:CreateFileW returning 0x40 000d:Ret KERNEL32.CreateFileW() retval=00000040 ret=7ecb31b0 000d:Call KERNEL32.SetFilePointer(00000040,00000000,00000000,00000002) ret=7ecb31fc 000d:Ret KERNEL32.SetFilePointer() retval=00000000 ret=7ecb31fc 000d:trace:cmd:WCMD_execute Redirect 1 to 'L"C:\users\focht\Temp\CMD5c00.tmp"' (0x40) 000d:Call KERNEL32.SetStdHandle(fffffff5,00000040) ret=7ecb3283 000d:Ret KERNEL32.SetStdHandle() retval=00000001 ret=7ecb3283 000d:trace:cmd:WCMD_execute Command: 'L"mingw-get.exe install mingw-get pkginfo base gcc-core "' ... 000d:Call KERNEL32.CreateProcessW(00332748 L"C:\MinGW\bin\mingw-get.exe",00132ea0 L"mingw-get.exe install mingw-get pkginfo base gcc-core ",00000000,00000000,00000001,00000000,00000000,00000000,00332704,00332c08) ret=7ecb2843 ... 0032:Call KERNEL32.__wine_kernel_init() ret=7bc688f1 ... 000d:Ret KERNEL32.CreateProcessW() retval=00000001 ret=7ecb2843 ... 0032:Call KERNEL32.GetStdHandle(fffffff4) ret=7ed02ec2 0032:Ret KERNEL32.GetStdHandle() retval=00000038 ret=7ed02ec2 0032:Call KERNEL32.GetFileType(00000038) ret=7ed02ed3 0032:Ret KERNEL32.GetFileType() retval=00000001 ret=7ed02ed3 0032:Call KERNEL32.SetStdHandle(fffffff4,00000038) ret=7ed028ca 0032:Ret KERNEL32.SetStdHandle() retval=00000001 ret=7ed028ca ... 0032:trace:file:WriteFile 0x38 0x242440 62 0x61f43c (nil) installing mingw-get-0.5-mingw32-beta-20120426-1-bin.tar.xz 0032:Ret KERNEL32.WriteFile() retval=00000001 ret=7ed097df ... 000d:trace:cmd:WCMD_process_commands Executing command: 'L""C:\MinGW\libexec\mingw-get\tee.exe" "C:\MinGW\var\log\mingw-get-log.orig.txt""' ... 000d:trace:cmd:WCMD_execute command on entry:L""C:\MinGW\libexec\mingw-get\tee.exe" "C:\MinGW\var\log\mingw-get-log.orig.txt"" (0x33b3d0) ... 000d:trace:cmd:WCMD_execute Input coming from L"C:\users\focht\Temp\CMD5c00.tmp" ... 000d:Call KERNEL32.CreateFileW(00132be4 L"C:\users\focht\Temp\CMD5c00.tmp",80000000,00000001,0033b2d0,00000003,04000080,00000000) ret=7ecb2ef2 000d:trace:file:CreateFileW L"C:\users\focht\Temp\CMD5c00.tmp" GENERIC_READ FILE_SHARE_READ creation 3 attributes 0x4000080 ... 000d:trace:file:CreateFileW returning 0xffffffff 000d:Ret KERNEL32.CreateFileW() retval=ffffffff ret=7ecb2ef2 000d:Ret KERNEL32.CreateFileW() retval=ffffffff ret=7ecb2ef2 000d:Call KERNEL32.FormatMessageW(00001100,00000000,00000020,00000000,0033b074,00000000,00000000) ret=7ecb096a 000d:Ret KERNEL32.FormatMessageW() retval=00000014 ret=7ecb096a 000d:Call KERNEL32.GetStdHandle(fffffff4) ret=7ecb09d1 000d:Ret KERNEL32.GetStdHandle() retval=00000014 ret=7ecb09d1 000d:Call KERNEL32.WriteConsoleW(00000014,0013b0b8,00000014,0033b040,00000000) ret=7ecb02e3 000d:Ret KERNEL32.WriteConsoleW() retval=00000000 ret=7ecb02e3 ... 000d:trace:file:WriteFile 0x14 0x13c160 20 0x33b040 (nil) Sharing violation. ... 0030:Call KERNEL32.CreateProcessA(00000000,00526944 ""C:\MinGW\libexec\mingw-get\cleanfile.exe" "C:\MinGW\var\log\mingw-get-log.orig.txt" "C:\MinGW\var\log\mingw-get-log.txt"",00000000,00000000,00000000,04000000,00000000,00526824 "C:\MinGW\libexec\mingw-get",0033edc4,0033edb4) ret=00451ea1 ... 0034:Call KERNEL32.__wine_kernel_init() ret=7bc688f1 ... 0030:Ret KERNEL32.CreateProcessA() retval=00000001 ret=00451ea1 ... 0034:Call KERNEL32.CreateFileW(00241368 L"C:\MinGW\var\log\mingw-get-log.orig.txt",80000000,00000003,0060fba4,00000003,00000001,00000000) ret=7ed14772 ... 0034:Ret KERNEL32.CreateFileW() retval=ffffffff ret=7ed14772 ... 0030:Call user32.MessageBoxA(0001009a,0051d0c0 "Encountered an error cleaning log file (1)",004e1d60 "Setup",00000030) ret=0042f20e --- snip ---
Looks like the temp file used for capturing piped output doesn't have proper sharing set up hence 'tee' fails.
Make sure you don't fall into the common sharing fallacy. The sharing flags don't control what the calling process can do - they control what another process can do with the file ;-)
Creator/producer of temp "pipe" file must specify 'FILE_SHARE_READ' *and* 'FILE_SHARE_DELETE' since the consumer will use 'FILE_FLAG_DELETE_ON_CLOSE' semantics.
The consumer of temp "pipe" file must specify 'FILE_SHARE_WRITE' since the producer obviously needs to write to it.
Source: http://source.winehq.org/git/wine.git/blob/05bc632add5f6bc56de62632612eb10a1...
--- snip --- 1262 void WCMD_execute (const WCHAR *command, const WCHAR *redirects, 1263 CMD_LIST **cmdList, BOOL retrycall) 1264 { ... 1363 /* STDIN could come from a preceding pipe, so delete on close if it does */ 1364 if (cmdList && (*cmdList)->pipeFile[0] != 0x00) { 1365 WINE_TRACE("Input coming from %s\n", wine_dbgstr_w((*cmdList)->pipeFile)); 1366 h = CreateFileW((*cmdList)->pipeFile, GENERIC_READ, 1367 FILE_SHARE_READ, &sa, OPEN_EXISTING, 1368 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, NULL); 1369 if (h == INVALID_HANDLE_VALUE) { 1370 WCMD_print_error (); 1371 heap_free(cmd); 1372 heap_free(new_redir); 1373 return; 1374 } 1375 SetStdHandle (STD_INPUT_HANDLE, h); 1376 1377 /* No need to remember the temporary name any longer once opened */ 1378 (*cmdList)->pipeFile[0] = 0x00; ... 1412 /* Add support for 2>&1 */ 1413 redir = p; 1414 if (*p == '&') { 1415 int idx = *(p+1) - '0'; 1416 1417 if (DuplicateHandle(GetCurrentProcess(), 1418 GetStdHandle(idx_stdhandles[idx]), 1419 GetCurrentProcess(), 1420 &h, 1421 0, TRUE, DUPLICATE_SAME_ACCESS) == 0) { 1422 WINE_FIXME("Duplicating handle failed with gle %d\n", GetLastError()); 1423 } 1424 WINE_TRACE("Redirect %d (%p) to %d (%p)\n", handle, GetStdHandle(idx_stdhandles[idx]), idx, h); 1425 1426 } else { 1427 WCHAR *param = WCMD_parameter(p, 0, NULL, FALSE, FALSE); 1428 h = CreateFileW(param, GENERIC_WRITE, 0, &sa, creationDisposition, 1429 FILE_ATTRIBUTE_NORMAL, NULL); 1430 if (h == INVALID_HANDLE_VALUE) { 1431 WCMD_print_error (); 1432 heap_free(cmd); 1433 heap_free(new_redir); 1434 return; 1435 } 1436 if (SetFilePointer (h, 0, NULL, FILE_END) == 1437 INVALID_SET_FILE_POINTER) { 1438 WCMD_print_error (); 1439 } 1440 WINE_TRACE("Redirect %d to '%s' (%p)\n", handle, wine_dbgstr_w(param), h); 1441 } 1442 1443 SetStdHandle (idx_stdhandles[handle], h); 1444 } ... --- snip ---
--- snip --- -=[ ProtectionID v0.6.6.7 DECEMBER]=- (c) 2003-2015 CDKiLLER & TippeX Build 24/12/14-22:48:13 Ready... Scanning -> Z:\home\focht\Downloads\mingw-get-inst-20120426.exe File Type : 32-Bit Exe (Subsystem : Win GUI / 2), Size : 662689 (0A1CA1h) Byte(s) Compilation TimeStamp : 0x2A425E19 -> Fri 19th Jun 1992 22:22:17 (GMT) [TimeStamp] 0x2A425E19 -> Fri 19th Jun 1992 22:22:17 (GMT) | PE Header | - | Offset: 0x00000108 | VA: 0x00400108 | - -> File has 575137 (08C6A1h) bytes of appended data starting at offset 015600h [File Heuristics] -> Flag #1 : 00000000000001001100000000100100 (0x0004C024) [Entrypoint Section Entropy] : 6.58 (section #0) "CODE " | Size : 0x9364 (37732) byte(s) [DllCharacteristics] -> Flag : (0x8000) -> TSA [SectionCount] 8 (0x8) | ImageSize 0x1C000 (114688) byte(s) [VersionInfo] Company Name : MinGW [VersionInfo] Product Name : MinGW-Get [VersionInfo] Product Version : 0.5-beta-20120426-1 [VersionInfo] File Description : MinGW-Get Setup [VersionInfo] Version Comments : This installation was built with Inno Setup. [-= Installer =-] Inno Setup v5.4.2 Module [CompilerDetect] -> Borland Delphi (unknown version) - 40% probability - Scan Took : 0.166 Second(s) [0000000A6h (166) tick(s)] [558 of 573 scan(s) done]
Scanning -> C:\MinGW\bin\mingw-get.exe File Type : 32-Bit Exe (Subsystem : Win CUI / 3), Size : 45568 (0B200h) Byte(s) Compilation TimeStamp : 0x4F98896D -> Wed 25th Apr 2012 23:31:57 (GMT) [TimeStamp] 0x4F98896D -> Wed 25th Apr 2012 23:31:57 (GMT) | PE Header | - | Offset: 0x00000088 | VA: 0x00400088 | - [!] Executable uses TLS callbacks (2 total... 0 invalid addresses) [File Heuristics] -> Flag #1 : 00000000001001011100000000100000 (0x0025C020) [Entrypoint Section Entropy] : 6.27 (section #0) ".text " | Size : 0x8254 (33364) byte(s) [DllCharacteristics] -> Flag : (0x0000) -> NONE [SectionCount] 7 (0x7) | ImageSize 0x11000 (69632) byte(s) [CompilerDetect] -> Visual C/C++ [!] File appears to have no protection or is using an unknown protection - Scan Took : 0.137 Second(s) [000000089h (137) tick(s)] [499 of 573 scan(s) done] --- snip ---
$ sha1sum mingw-get-inst-20120426.exe 1f0f7b9eeaa8c13f9b5b2d2bd489e78b3e168605 mingw-get-inst-20120426.exe
$ du -sh mingw-get-inst-20120426.exe 648K mingw-get-inst-20120426.exe
$ wine --version wine-1.8-rc4
Regards
https://bugs.winehq.org/show_bug.cgi?id=34174
--- Comment #2 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Anastasius Focht from comment #1)
Make sure you don't fall into the common sharing fallacy. The sharing flags don't control what the calling process can do - they control what another process can do with the file ;-)
Not really related to the investigation, but there are the tests that show that access/sharing does affect the owner process just like any other: http://source.winehq.org/git/wine.git/blob/HEAD:/dlls/kernel32/tests/file.c#...
https://bugs.winehq.org/show_bug.cgi?id=34174
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |STAGED CC| |erich.e.hoover@wine-staging | |.com, michael@fds-team.de, | |sebastian@fds-team.de Staged patchset| |https://github.com/wine-com | |pholio/wine-staging/tree/ma | |ster/patches/cmd-Fix_Sharin | |g
https://bugs.winehq.org/show_bug.cgi?id=34174
Sebastian Lackner sebastian@fds-team.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |c634f34aae0d35d3fe9a687abd8 | |6e8c0832b7d17 Status|STAGED |RESOLVED CC| |mstefani@redhat.com Resolution|--- |FIXED Target Milestone|--- |1.8.x
--- Comment #3 from Sebastian Lackner sebastian@fds-team.de --- This was fixed a while ago with: http://source.winehq.org/git/wine.git/commit/c634f34aae0d35d3fe9a687abd86e8c...
It looks easy enough to be a candidate for 1.8.x.
https://bugs.winehq.org/show_bug.cgi?id=34174
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.9.4.
https://bugs.winehq.org/show_bug.cgi?id=34174
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|1.8.x |---
--- Comment #5 from Michael Stefaniuc mstefani@redhat.com --- Removing 1.8.x milestone from bugs included in 1.8.2.