[Bug 51813] New: python fatal error redirecting stdout to file
https://bugs.winehq.org/show_bug.cgi?id=51813 Bug ID: 51813 Summary: python fatal error redirecting stdout to file Product: Wine Version: 6.16 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs(a)winehq.org Reporter: xantares09(a)hotmail.com Distribution: ArchLinux python exits with a fatal error when the output is redirected to a file $ wget https://www.python.org/ftp/python/3.9.5/python-3.9.5-embed-win32.zip $ unzip python-3.9.5-embed-win32.zip $ wine python -c 'print("hello world")' > out.txt wine: created the configuration directory '/home/devel/.wine' ... wine: configuration in L"/home/devel/.wine" has been updated. Fatal Python error: init_sys_streams: can't initialize sys standard streams Python runtime state: core initialized OSError: [WinError 6] Invalid handle Current thread 0x000000d4 (most recent call first): <no Python frame> whereas it succeeds on stdout or /dev/null: $ wine python -c 'print("hello world")' hello world I also tried python 3.8.6 and wine 6.15/6.14 without luck see also topic https://forum.winehq.org/viewtopic.php?f=8&t=33992 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #1 from xantares <xantares09(a)hotmail.com> --- curiously it works through tee: $ wine python -c 'print("hello world")' | tee > out.txt -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, source CC| |austinenglish(a)gmail.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Bernhard Übelacker <bernhardu(a)mailbox.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernhardu(a)mailbox.org --- Comment #2 from Bernhard Übelacker <bernhardu(a)mailbox.org> --- Created attachment 71237 --> https://bugs.winehq.org/attachment.cgi?id=71237 Workaround for redirection at linux side. As far as I see does python query GetFileType for the handle from stdin which returns in the redirected case FILE_TYPE_DISK. Therefore it looks like python calls GetFileInformationByHandle and expects this to succeed. In the case of a redirection created by cmd in native or wine this works as expected. But GetFileInformationByHandle fails if the redirection is done at linux side because fd->unix_name gets not set. Attached patch should demonstrate the issue and possible workaround. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #3 from Bernhard Übelacker <bernhardu(a)mailbox.org> --- Created attachment 71238 --> https://bugs.winehq.org/attachment.cgi?id=71238 GetFileInformationByHandle test program with some test outputs. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 xantares <xantares09(a)hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|6.16 |7.22 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #4 from xantares <xantares09(a)hotmail.com> --- I submitted the patch on gitlab: https://gitlab.winehq.org/wine/wine/-/merge_requests/1626 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Eric Pouech <eric.pouech(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech(a)gmail.com Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Assignee|wine-bugs(a)winehq.org |eric.pouech(a)gmail.com --- Comment #5 from Eric Pouech <eric.pouech(a)gmail.com> --- Created attachment 73605 --> https://bugs.winehq.org/attachment.cgi?id=73605 alternative patch could you test this alternative patch? - we can do better than returning an empty BY_HANDLE_FILE_INFORMATION buffer - and doesn't require heuristics to return empty buffer -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #6 from xantares <xantares09(a)hotmail.com> --- your patch fixes the issue, I close my MR and let you submit it -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #7 from xantares <xantares09(a)hotmail.com> --- new MR: https://gitlab.winehq.org/wine/wine/-/merge_requests/1665 hope it gets there for the next version -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 xantares <xantares09(a)hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bunglehead(a)gmail.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 temp82(a)luukku.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |temp82(a)luukku.com --- Comment #8 from temp82(a)luukku.com --- (In reply to xantares from comment #7)
new MR:
https://gitlab.winehq.org/wine/wine/-/merge_requests/1665
hope it gets there for the next version
fixed? cde092dd35463fff95a22f27256f6fe5fb06e1c6 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #9 from xantares <xantares09(a)hotmail.com> --- no, seems its not merged because they did not agree yet -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Joel Holdsworth <joel(a)airwebreathe.org.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joel(a)airwebreathe.org.uk -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #10 from Joel Holdsworth <joel(a)airwebreathe.org.uk> --- This bug is a duplicate of #46070 https://bugs.winehq.org/show_bug.cgi?id=46070 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #11 from Eric Pouech <eric.pouech(a)gmail.com> --- (In reply to xantares from comment #9)
no, seems its not merged because they did not agree yet
does it still happen with wine-9.0-rc1? (a better implemen of what has been proposed in #5 should be in) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #12 from Joel Holdsworth <joel(a)airwebreathe.org.uk> --- In my testing, still a problem: $ wine --version wine-9.0-rc1 $ wine python.exe -c 'print("Hello World")' > out.txt 007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 007c:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 007c:fixme:wineusb:query_id Unhandled ID query type 0x5. 007c:fixme:wineusb:query_id Unhandled ID query type 0x5. 007c:fixme:wineusb:query_id Unhandled ID query type 0x5. 007c:fixme:wineusb:query_id Unhandled ID query type 0x5. 007c:fixme:wineusb:query_id Unhandled ID query type 0x5. Fatal Python error: init_sys_streams: can't initialize sys standard streams Python runtime state: core initialized OSError: [WinError 6] Invalid handle Current thread 0x00000024 (most recent call first): <no Python frame> As a workaround, I have cherry-picked your fix into my branch: https://gitlab.winehq.org/epo/wine/-/commit/cde092dd35463fff95a22f27256f6fe5... For other readers: This patch fixes the issue in kernelbase by removing unnecessary call to NtQueryInformationFile with FileAllInformation in GetFileInformationByHandle, which fails to retrieve the name (FileNameInformation) of the pipe-file. Instead it queries FileBaicInformation, FileStandardInformation and FileInternalInformation which provide sufficient information without failing. Alternatively, there is also this patch: https://www.winehq.org/pipermail/wine-devel/2020-September/174029.html This patch solves the issue in wineserver implementing NtQueryInformationFile FileNameInformation for pipes. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #13 from Joel Holdsworth <joel(a)airwebreathe.org.uk> ---
(a better implemen of what has been proposed in #5 should be in)
I don't see any change to GetFileInformationByHandle. It still uses FileAllInformation. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 --- Comment #14 from Eric Pouech <eric.pouech(a)gmail.com> --- (In reply to Joel Holdsworth from comment #13)
(a better implemen of what has been proposed in #5 should be in)
I don't see any change to GetFileInformationByHandle. It still uses FileAllInformation.
sorry, looks like I updated wrong bug entry. Nothing has changed here. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Bernhard Übelacker <bernhardu(a)mailbox.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |1b0d8428dfc13b0fa5ea7d576df | |ef7aaf8a8c927 Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #15 from Bernhard Übelacker <bernhardu(a)mailbox.org> --- $ wine python -c 'print("hello world")' > out.txt $ cat out.txt hello world $ Got fixed by: https://gitlab.winehq.org/wine/wine/-/commit/1b0d8428dfc13b0fa5ea7d576dfef7a... (And the three commits before.) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Nikolay Sivov <bunglehead(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|bunglehead(a)gmail.com | -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #16 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 9.3. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=51813 Michael Stefaniuc <mstefani(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |9.0.x -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=51813 Michael Stefaniuc <mstefani(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|9.0.x |--- --- Comment #17 from Michael Stefaniuc <mstefani(a)winehq.org> --- Removing the 9.0.x milestone from bug fixes included in 9.0.1. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla