http://bugs.winehq.org/show_bug.cgi?id=21289
Summary: System call "dup2" returns 0 for negative inputs, thus behaving different from real Windows Product: Wine Version: 1.0.1 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: simon@josefsson.org
The program below when run under Wine will print:
rc 0
When I run the same binary on Windows XP, I get:
rc -1
The problem appears to be that the "dup2" system function doesn't do proper input checking.
This is causing self-tests errors for projects (including several GNU projects) that use some gnulib modules.
/Simon
jas@mocca:~$ cat foo.c #include <unistd.h> #include <stdio.h> #include <errno.h> #include <fcntl.h>
/* Get declarations of the Win32 API functions. */ # define WIN32_LEAN_AND_MEAN # include <windows.h>
int main (void) { const char *file = "test-dup2.tmp"; char buffer[1]; int fd = open (file, O_CREAT | O_TRUNC | O_RDWR, 0600); int rc;
rc = dup2 (fd, -2); printf ("rc %d\n", rc);
return 0; } jas@mocca:~$ i586-mingw32msvc-gcc -o foo.exe foo.c jas@mocca:~$ wine ./foo.exe rc 0 jas@mocca:~$ wine --version wine-1.0.1 jas@mocca:~$
http://bugs.winehq.org/show_bug.cgi?id=21289
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, testcase
--- Comment #1 from Austin English austinenglish@gmail.com 2010-01-08 16:31:00 --- Please retest in 1.1.36.
http://bugs.winehq.org/show_bug.cgi?id=21289
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com 2010-01-08 16:34:48 --- (In reply to comment #1)
Please retest in 1.1.36.
Also try 'winetricks vcrun6'.
http://bugs.winehq.org/show_bug.cgi?id=21289
Andrew Nguyen arethusa26@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #3 from Andrew Nguyen arethusa26@gmail.com 2010-01-08 16:58:42 --- I'm confirming in wine-1.1.36. With builtin msvcrt, I get:
rc 0
and native msvcrt yields:
rc -1
http://bugs.winehq.org/show_bug.cgi?id=21289
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |msvcrt
http://bugs.winehq.org/show_bug.cgi?id=21289
--- Comment #4 from Simon Josefsson simon@josefsson.org 2010-01-09 05:24:21 --- (In reply to comment #3)
I'm confirming in wine-1.1.36.
Thanks. Are you also able to test the winetricks suggestion? My 1.0.1 installation (debian testing) doesn't seem to have that tool, or I'm missing something.
/Simon
http://bugs.winehq.org/show_bug.cgi?id=21289
--- Comment #5 from Jeff Zaroyko jeffz@jeffz.name 2010-01-09 05:30:44 --- Please use a more recent version of Wine to report bugs against, 1.0.1 was released 14 months ago. See http://www.winehq.org/download for packages or use git.
For winetricks see here http://wiki.winehq.org/winetricks
http://bugs.winehq.org/show_bug.cgi?id=21289
--- Comment #6 from Simon Josefsson simon@josefsson.org 2010-01-11 16:42:10 --- (In reply to comment #5)
Please use a more recent version of Wine to report bugs against, 1.0.1 was released 14 months ago. See http://www.winehq.org/download for packages or use git.
Wine 1.0.1 is marked as the latest stable version as far as I can tell, and the bug was confirmed to be in the latest development version too. There doesn't seem to be updated debian/ubuntu packages available for the development versions, which makes it difficult for me to test anything other than the latest stable version.
Don't you want to track bugs for the latest stable release?
For winetricks see here http://wiki.winehq.org/winetricks
That seems to use non-free software, and says that it limits my ability to get help, so I'd prefer if other people can help with this aspect.
/Simon
http://bugs.winehq.org/show_bug.cgi?id=21289
--- Comment #7 from Jeff Zaroyko jeffz@jeffz.name 2010-01-11 21:28:47 --- I've sent a patch.
http://bugs.winehq.org/show_bug.cgi?id=21289
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dank@kegel.com
--- Comment #8 from Dan Kegel dank@kegel.com 2010-01-11 21:59:53 --- Which apps are failing their tests because of this? I might want to add them to http://wiki.winehq.org/UnitTestSuites
('winetricks msvcrt' is just a handy way to download and install native msvcrt safely on wine. We often use it when triaging bugs; we then do rm -rf ~/.wine to avoid leaving the native dlls installed by accident.)
http://bugs.winehq.org/show_bug.cgi?id=21289
Alexander Scott-Johns alexander.scott.johns+winebug@googlemail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alexander.scott.johns+wineb | |ug@googlemail.com
--- Comment #9 from Alexander Scott-Johns alexander.scott.johns+winebug@googlemail.com 2010-01-12 18:58:21 --- (In reply to comment #6)
(In reply to comment #5)
Please use a more recent version of Wine to report bugs against, 1.0.1 was released 14 months ago. See http://www.winehq.org/download for packages or use git.
Wine 1.0.1 is marked as the latest stable version as far as I can tell, and the bug was confirmed to be in the latest development version too. There doesn't seem to be updated debian/ubuntu packages available for the development versions, which makes it difficult for me to test anything other than the latest stable version.
The http://www.winehq.org/download page provides instructions for installing development packages. You can also compile from source - see the http://wiki.winehq.org/GitWine page.
Don't you want to track bugs for the latest stable release?
The 1.0.* branch is no longer being developed, so any bugs in it won't be fixed.
For winetricks see here http://wiki.winehq.org/winetricks
That seems to use non-free software, and says that it limits my ability to get help, so I'd prefer if other people can help with this aspect.
The "may limit your ability to get support though WineHQ" warning is there because we don't want bugs reported for problems caused by winetricks (packages like ie6 and directx9 often break Wine in weird and wonderful ways).
http://bugs.winehq.org/show_bug.cgi?id=21289
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #10 from Jeff Zaroyko jeffz@jeffz.name 2010-01-14 12:33:04 --- Fixed by commit c2459deefffaef80ea78faadeb9ab7fa66a67ff6.
http://bugs.winehq.org/show_bug.cgi?id=21289
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #11 from Alexandre Julliard julliard@winehq.org 2010-01-22 11:02:29 --- Closing bugs fixed in 1.1.37.