Bug #22828 _my_b_read() ignores return values for my_seek() calls
Submitted: 29 Sep 2006 15:20 Modified: 9 Nov 2006 15:44
Reporter: Mark Leith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:All OS:Any (All)
Assigned to: Kristofer Pettersson CPU Architecture:Any
Tags: my_b_read, my_seek

[29 Sep 2006 15:20] Mark Leith
Description:
_my_b_read() (within mysys/mf_iocache.cc) and others currently ignore the return value for my_seek() calls, even though there are possibilities for failures to the lseek() os function, through kernel bugs - such as:

  if (info->seek_not_done)
  {					/* File touched, do seek */
    VOID(my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)));
    info->seek_not_done=0;
  }

How to repeat:
No test case available.

Suggested fix:
Check the return value for my_seek() to ensure that files are read correctly.
[18 Oct 2006 7:55] Kristofer Pettersson
Note patch submitted for bug#23010 which 
* adds assertion to my_seek not to allow invalid file handles
* prevents one case where my_seek was called although the file handle was determined to be invalid.
[24 Oct 2006 8:46] Kristofer Pettersson
Probably related to this bug http://bugs.mysql.com/bug.php?id=4053
[31 Oct 2006 8:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/14590

ChangeSet@1.2543, 2006-10-31 09:26:16+01:00, thek@kpdesk.mysql.com +4 -0
  Bug#22828 _my_b_read() ignores return values for my_seek() calls
  - Because my_seek actually is capable of returning an error code we should
    exploit that in the best possible way.
  - There might be kernel errors or other errors we can't predict and capturing
    the return value of all system calls gives us better understanding of
    possible errors.
[2 Nov 2006 10:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/14735

ChangeSet@1.2342, 2006-11-02 11:55:41+01:00, thek@kpdesk.mysql.com +1 -0
  Bug#22828 complementary patch:
  - 'false' not defined in C, use FALSE instead.
[2 Nov 2006 12:33] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/14739

ChangeSet@1.2613, 2006-11-02 13:33:26+01:00, thek@kpdesk.mysql.com +1 -0
  Bug#22828 complementary patch:
  - 'false' not defined in C, use FALSE instead.
[9 Nov 2006 15:44] Paul DuBois
Noted in 4.1.23, 5.0.30 (not 5.0.29), 5.1.13 changelogs.

The return value from my_seek() was ignored.