[Bug 52743] New: regression cannot write to _fdopen'ed stdout
https://bugs.winehq.org/show_bug.cgi?id=52743 Bug ID: 52743 Summary: regression cannot write to _fdopen'ed stdout Product: Wine Version: 7.5 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: --- since wine 7.2, opening stdout with _fdopen and printing into it crashes ``` #include <stdio.h> #include <io.h> #include <fcntl.h> int main() { FILE * m_stdout = _fdopen(_fileno(stdout), "wb"); fprintf(m_stdout, "foo\n"); fclose(m_stdout); return 0; } $ x86_64-w64-mingw32-gcc main.c $ wine a.exe ... wine: Unhandled page fault on read access to 0000000000000050 at address 0000000170059685 (thread 0128), starting debugger... ... ``` For context, this is what qt-xmlpatterns does: https://github.com/qt/qtxmlpatterns/blob/dev/tools/xmlpatterns/main.cpp#L184 -- 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=52743 xantares <xantares09(a)hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Distribution|--- |ArchLinux -- 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=52743 --- Comment #1 from xantares <xantares09(a)hotmail.com> --- sorry wine 7.2 is ok, versions of wine>=7.3 are not -- 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=52743 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, regression Summary|regression cannot write to |cannot write to _fdopen'ed |_fdopen'ed stdout |stdout -- 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=52743 --- Comment #2 from Gijs Vermeulen <gijsvrm(a)gmail.com> --- It works fine for me with self-compiled wine-7.5 and wine-staging 7.5 from the ArchLinux repos as well. $ x86_64-w64-mingw32-gcc --version x86_64-w64-mingw32-gcc (GCC) 11.2.0 -- 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=52743 Fabian Maurer <dark.shadow4(a)web.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEEDINFO Ever confirmed|0 |1 CC| |dark.shadow4(a)web.de --- Comment #3 from Fabian Maurer <dark.shadow4(a)web.de> --- Works fine for me as well. Are you using a clean WINEPREFIX? Also on Arch, btw. -- 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=52743 --- Comment #4 from xantares <xantares09(a)hotmail.com> --- I failed to report that I was running it from a docker image (usually it behaves the same). FROM archlinux:latest RUN echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf RUN pacman -Sy wine mingw-w64-gcc strace --noconfirm WORKDIR /tmp ADD main.c /tmp RUN x86_64-w64-mingw32-gcc main.c ENV WINEARCH=win64 RUN wine a.exe I noticed that if I run it with the 64 bits exe right away it goes fine (something wrong with the preloader code ?): RUN wine64 a.exe if I run it with strace I notice that some mmap call fails: mmap2(NULL, 65536, PROT_NONE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0^[[0m^[[91m) = -1 EPERM (Operation not permitted) Actually this problem is a regression in 7.5 from 7.4 as another 7.3 bug fixed in 7.4 was hiding it: https://bugs.winehq.org/show_bug.cgi?id=52614 Bisecting yields https://github.com/wine-mirror/wine/commit/c7e87b536edb28bb48162690e0d42c9ba...: c7e87b536edb28bb48162690e0d42c9ba9ccb43c is the first bad commit commit c7e87b536edb28bb48162690e0d42c9ba9ccb43c Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Thu Mar 17 08:27:22 2022 +0100 start: Force no console creation when using start /exec. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> programs/start/start.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) bisect found first bad commitRemoving intermediate container b85bc621aa41 -- 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=52743 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |eric.pouech(a)orange.fr Regression SHA1| |c7e87b536edb28bb48162690e0d | |42c9ba9ccb43c Summary|cannot write to _fdopen'ed |cannot write to _fdopen'ed |stdout |stdout when running in | |docker -- 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=52743 Eric Pouech <eric.pouech(a)orange.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW --- Comment #5 from Eric Pouech <eric.pouech(a)orange.fr> --- 1) please update your test to check whether m_stdout is NULL (it will at least not segfault) 2) can you test if the proposed patch in https://bugs.winehq.org/show_bug.cgi?id=52761 changes the situation TIA -- 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=52743 Austin English <austinenglish(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |austinenglish(a)gmail.com Component|-unknown |programs --- Comment #6 from Austin English <austinenglish(a)gmail.com> --- (In reply to Eric Pouech from comment #5)
1) please update your test to check whether m_stdout is NULL (it will at least not segfault) 2) can you test if the proposed patch in https://bugs.winehq.org/show_bug.cgi?id=52761 changes the situation TIA
winetricks-test also fails because of c7e87b536edb28bb48162690e0d42c9ba9ccb43c; with https://bugs.winehq.org/attachment.cgi?id=72131 applied, things work again. -- 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=52743 --- Comment #7 from Austin English <austinenglish(a)gmail.com> --- (In reply to Austin English from comment #6)
(In reply to Eric Pouech from comment #5)
1) please update your test to check whether m_stdout is NULL (it will at least not segfault) 2) can you test if the proposed patch in https://bugs.winehq.org/show_bug.cgi?id=52761 changes the situation TIA
winetricks-test also fails because of c7e87b536edb28bb48162690e0d42c9ba9ccb43c; with https://bugs.winehq.org/attachment.cgi?id=72131 applied, things work again.
Forgot to add, this isn't using docker, just shell; but I suspect in the process of the test script calling winetricks calling wine, the stdin|stdout|stderr is lost.. -- 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=52743 --- Comment #8 from Eric Pouech <eric.pouech(a)orange.fr> ---
Forgot to add, this isn't using docker, just shell; but I suspect in the process of the test script calling winetricks calling wine, the stdin|stdout|stderr is lost..
that's what's the patch tries to tackle: create a dummy console when neither of stdin/stdout/stderr is opened on an unix tty (so mainly running from shell as: ./wine ... >& log < /dev/null will fall into this) -- 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=52743 --- Comment #9 from Austin English <austinenglish(a)gmail.com> --- (In reply to Austin English from comment #6)
(In reply to Eric Pouech from comment #5)
1) please update your test to check whether m_stdout is NULL (it will at least not segfault) 2) can you test if the proposed patch in https://bugs.winehq.org/show_bug.cgi?id=52761 changes the situation TIA
winetricks-test also fails because of c7e87b536edb28bb48162690e0d42c9ba9ccb43c; with https://bugs.winehq.org/attachment.cgi?id=72131 applied, things work again.
Still present in wine-7.6-100-gae9266992a5 (i.e., eff83cd4e00e8ccd4daad05bdd6d76e77664ddd1 from bug 52771 doesn't make a difference), for winetricks-test. @Eric, please let me know if you think this should be its own bug (or if it should be marked as a duplicate of bug 52761. -- 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=52743 Julian RĂ¼ger <jr98(a)gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jr98(a)gmx.net -- 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=52743 --- Comment #10 from Eric Pouech <eric.pouech(a)orange.fr> ---
@Eric, please let me know if you think this should be its own bug (or if it should be marked as a duplicate of bug 52761.
it should work when you give the exact path for the exec this should work: ./wine programs/cmd/cmd.exe /c echo 'hello' >& ~/test.txt < /dev/null while this doesn't (yet) ./wine cmd.exe /c echo 'hello' >& ~/test.txt < /dev/null I'll post to wine-devel this missing bit -- 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=52743 --- Comment #11 from Austin English <austinenglish(a)gmail.com> --- (In reply to Eric Pouech from comment #10)
I'll post to wine-devel this missing bit
Thanks, with wine-7.6-100-gae9266992a5 + https://source.winehq.org/patches/data/232396 winetricks-test seems to be working (still in progress, but all passing so far, instead of everything failing..). -- 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=52743 xantares <xantares09(a)hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|NEW |RESOLVED --- Comment #12 from xantares <xantares09(a)hotmail.com> --- this is now fixed in version 7.7 -- 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=52743 Alexandre Julliard <julliard(a)winehq.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED --- Comment #13 from Alexandre Julliard <julliard(a)winehq.org> --- Closing bugs fixed in 7.8. -- 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