[Uim-bugs] [Bug 1477] New: wrong assumption about specification of read(2) in helper client

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Sep 27 13:21:03 EEST 2004


Please do not reply to this email: if you want to comment on the bug, go to          
the URL shown below and enter yourcomments there.   
 
https://freedesktop.org/bugzilla/show_bug.cgi?id=1477        
   
           Summary: wrong assumption about specification of read(2) in
                    helper client
           Product: UIM
           Version: unspecified
          Platform: All
               URL: http://freedesktop.org/pipermail/uim/2004-
                    June/000453.html
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: libuim
        AssignedTo: uim-bugs at freedesktop.org
        ReportedBy: yamaken at bp.iij4u.or.jp


Current implementation of helper clients attempt a sequence of
uim_helper_read_proc() uim_helper_get_message(). The sequence performs read(2)
only at once per message receiving. This is quite improper and invalid operation.

The read(2) in the uim_helper_read_proc() requires maximum buffersize as
receiving data size, but the received size is not ensured by specification. See
following man pages.

http://www.freebsd.org/cgi/man.cgi?query=read&apropos=0&sektion=2&manpath=FreeBSD+5.2.1-RELEASE+and+Ports&format=html
http://www.jp.freebsd.org/cgi/mroff.cgi?subdir=man&lc=1&cmd=&man=read&dir=jpman-5.2.0%2Fman&sect=2

This possibly causes partial message receiving (and it will be discarded by
uim_helper_get_message() because it does not contain "\n\n" sequence).
Subsequent uim_helper_get_message() will receive latter half of previous message
as garbage.

To avoid this condition, read(2) must be looped to fill buffer until
uim_helper_get_message() finds message terminator ("\n\n"). The
uim_helper_get_message() must be responsible for the looping, and user of the
function must not be required to call uim_helper_read_proc().

Following modification is required to resolve the problem.

- make uim_helper_read_proc() dummy function to keep API/ABI
- make uim_helper_get_message() calling read(2) properly (i.e. loop until
message termination)

Kazuki's another suggestion (see 'URL') that eliminates fd from helper client
API should not be performed before the fix of this bug.        
   
   
--         
Configure bugmail: https://freedesktop.org/bugzilla/userprefs.cgi?tab=email       
   
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the uim-bugs mailing list