Fixed bug in TinderboxDS.pm _doQuery()

Ade Lovett ade at FreeBSD.org
Tue Oct 23 22:54:37 EDT 2007


Hi folks,

Just found (and fixed) the previously reported bug.  It was actually  
nothing to do with tinderd, and looks like it's a long standing  
problem (I haven't checked the 2.x branch).

Basically, _doQuery() can be called with an SQL statement where there  
are no parameters.  The one that triggered it in this case was:

	DELETE FROM build_ports_queue WHERE enqueue_date<=NOW()-25200 AND  
status != 'ENQUEUED'

at the end of a tinderd queue run.  You'll notice that there are  
no ?'s, thus no additional parameters to be passed.

_doQuery() makes the assumption that $params will in fact always  
contain some data and thus falls over in the debug statement (if you  
have that turned on), or later on when it comes to figuring out the  
actual SQL commit (without debugging turned on).  Joe, I'll leave  
this to you as to whether to MFH it (if it needs it, I'm pretty sure  
it does, since _doQuery() was never part of the removal and re- 
addition of tinderd in tinderbox-HEAD).


There is also one more issue to deal with, though it's more cosmetic  
than anything.  If there are no entries in a buildPortsQueue, a  
somewhat misleading error message is returned:

	ERROR: There is no BuildPortsQueue configured in the datastore.

The code should probably be fixed to deal with the difference between  
a non-existent and empty build queue, but I don't have time right now  
to look at that.

	my @buildportsqueue = $ds->getBuildPortsQueueByStatus($status);
	[...]

in lib/tc_command.pl is a good place to start.   It's probably the  
same for other cases too.

-aDe



More information about the tinderbox-list mailing list