A Lightweight SQL Database for Cloud Infrastructure and Web Applications

doStartTableScan() result not checked

Reported by Stewart Smith on 2010-06-01
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Medium
Stewart Smith
7.0
Medium
Stewart Smith
Maria
Fix Released
Low
Michael Widenius
MySQL Server
Unknown
Unknown

Bug 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.

Stewart Smith (stewart) wrote :

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");

Sergei (sergii) on 2010-06-28
Changed in maria:
importance: Undecided → Low
Michael Widenius (monty) on 2010-07-16
Changed in maria:
assignee: nobody → Michael Widenius (monty)

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?

Michael Widenius (monty) on 2010-07-16
Changed in maria:
status: New → Fix Committed
Michael Widenius (monty) wrote :

Fix committed to 5.2 branch

Stewart Smith (stewart) wrote :

On Fri, 16 Jul 2010 16:25:02 -0000, Monty Taylor <email address hidden> 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

Stewart Smith (stewart) on 2010-08-11
Changed in drizzle:
assignee: nobody → Stewart Smith (stewart-flamingspork)
Sergei (sergii) on 2010-11-30
Changed in maria:
milestone: none → 5.2
Michael Widenius (monty) on 2010-12-17
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.