[MDEV-2656] LP:588251 - doStartTableScan() result not checked Created: 2010-06-02  Updated: 2015-02-02  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Trivial
Reporter: Stewart Smith Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug588251.xml    

 Description   

In many places the error from doStartTableScan() is not checked. This can be spotted by adding warn_unused_result gcc attribute to it and seeing things fail.

It can also be spotted by returning an error from doStartTableScan() and instead seeing drizzled core instead of be sensible.



 Comments   
Comment by Stewart Smith [ 2010-06-02 ]

Re: doStartTableScan() result not checked
for MySQL/MariaDB this is rnd_init and this small patch produces about 10 warnings about actual bugs in mysql 5.1.46:

— ../mysql-5.1.46/sql/handler.h 2010-04-07 00:06:06.000000000 +1000
+++ sql/handler.h 2010-06-01 17:37:48.230727373 +1000
@@ -1188,7 +1188,7 @@
inited=NONE;
DBUG_RETURN(index_end());
}

  • int ha_rnd_init(bool scan)
    + int ha_rnd_init(bool scan) _attribute_ ((warn_unused_result))
    {
    int result;
    DBUG_ENTER("ha_rnd_init");
Comment by Rasmus Johansson (Inactive) [ 2010-07-16 ]

Re: [Bug 588251] [NEW] doStartTableScan() result not checked
On 06/01/2010 06:09 AM, Stewart Smith wrote:
> Public bug reported:
>
> In many places the error from doStartTableScan() is not checked. This
> can be spotted by adding warn_unused_result gcc attribute to it and
> seeing things fail.
>
> It can also be spotted by returning an error from doStartTableScan() and
> instead seeing drizzled core instead of be sensible.

We should really start adding in warn_unused_result attributes to things.

Should I perhaps make us a pandora-build test/define for it?

Comment by Michael Widenius [ 2010-07-16 ]

Re: doStartTableScan() result not checked
Fix committed to 5.2 branch

Comment by Stewart Smith [ 2010-07-17 ]

Re: [Bug 588251] [NEW] doStartTableScan() result not checked
On Fri, 16 Jul 2010 16:25:02 -0000, Monty Taylor <mordred@inaugust.com> wrote:
> We should really start adding in warn_unused_result attributes to
> things.
>
> Should I perhaps make us a pandora-build test/define for it?

yes. something that'll "just work" on non-gcc (apart from replacing them
with gcc)


Stewart Smith

Comment by Rasmus Johansson (Inactive) [ 2011-01-09 ]

Launchpad bug id: 588251

Generated at Thu Feb 08 06:43:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.