After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 500246 - Bug fixes for giowin32
Bug fixes for giowin32
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: win32
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks:
 
 
Reported: 2007-11-28 16:34 UTC by Marcus Brinkmann
Modified: 2008-08-20 01:31 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
bug fixes for giowin32. (830 bytes, patch)
2007-11-28 16:35 UTC, Marcus Brinkmann
none Details | Review

Description Marcus Brinkmann 2007-11-28 16:34:52 UTC
Please describe the problem:
There are a couple of bugs in giowin32 regarding error checking and write support.

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
nbytes should be signed, so it can grik negative results of system calls.  The condition needs to be checked after the thread id, as it may be IN or OUT.  See attached patch.
Comment 1 Marcus Brinkmann 2007-11-28 16:35:59 UTC
Created attachment 99785 [details] [review]
bug fixes for giowin32.
Comment 2 Tor Lillqvist 2008-02-13 11:49:48 UTC
I agree that nbytes obviously should be signed in those cases. Thanks.

For the other change, could you please attach some simple test program (a single C source file) that exhibits the problem the patch fixes?
Comment 3 Marcus Brinkmann 2008-06-25 23:52:40 UTC
Any program in the GPGME test suite will exhibit the problem, but I don't think GPGME qualifies as a simple test program.  :(  We use the patch for many years now in the Gpg4Win project, it's absolutely essential, as GPGME uses bidirectional communication over pipes heavily.  In particular, we developed the patch when porting GPA to Windows.  In fact, the whole "writing" side of giowin32.c was, as far as I recall, added to support GPA (previously, only the read direction was implemented).

The extended context of the patch makes the situation crystal clear:

-      if (win32_channel->thread_id == 0 && (condition & G_IO_IN))
+      if (win32_channel->thread_id == 0)
        {
          if (condition & G_IO_IN)
            create_thread (win32_channel, condition, read_thread);
          else if (condition & G_IO_OUT)
            create_thread (win32_channel, condition, write_thread);
        }

Note that the "else" branch inside the outer if-block is currently dead code, and only activated by the patch.

The patch is in fact just an errata on the previous patch which added the write direction.
Comment 4 Tor Lillqvist 2008-08-20 01:31:03 UTC
Thanks, patch committed to trunk.