doStartTableScan() result not checked

Bug #588251 reported by Stewart Smith
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Medium
Stewart Smith
7.0
Fix Released
Medium
Stewart Smith
MariaDB
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.

Related branches

Revision history for this message
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");

Changed in maria:
importance: Undecided → Low
Michael Widenius (monty)
Changed in maria:
assignee: nobody → Michael Widenius (monty)
Revision history for this message
Monty Taylor (mordred) wrote : 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?

Michael Widenius (monty)
Changed in maria:
status: New → Fix Committed
Revision history for this message
Michael Widenius (monty) wrote :

Fix committed to 5.2 branch

Revision history for this message
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)
Changed in drizzle:
assignee: nobody → Stewart Smith (stewart-flamingspork)
Changed in maria:
milestone: none → 5.2
Michael Widenius (monty)
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
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.