<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>5962</bug_id>
          
          <creation_ts>2014-03-13 13:51:45 +0000</creation_ts>
          <short_desc>The &quot;Local configuration variables&quot; filter returns an error when applied on top of search results</short_desc>
          <delta_ts>2014-04-10 18:06:05 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Toaster</product>
          <component>toaster</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.6 M5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Belen Barros Pena">belen.barros.pena</reporter>
          <assigned_to name="David Reyna">david.reyna</assigned_to>
          <cc>alexandru.damian</cc>
    
    <cc>belen.barros.pena</cc>
    
    <cc>cristiana.voicu</cc>
    
    <cc>jessica.zhang</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>41186</commentid>
    <comment_count>0</comment_count>
    <who name="Belen Barros Pena">belen.barros.pena</who>
    <bug_when>2014-03-13 13:51:45 +0000</bug_when>
    <thetext>Steps to reproduce:

1. In Toaster, select a build, go the Configuration page and click on the &quot;BitBake variables&quot; tab

2. Search for something that will return results (for example, &quot;kernel&quot;)

3. Click on the &quot;Set in file&quot; filter button and select the &quot;Local configuration variables&quot; option. Click &quot;Apply&quot;

You get this error:

Environment:


Request Method: GET
Request URL: http://localhost:8000/gui/build/65/configvars?filter=vhistory__file_name__regex%3Aconf%2F%28local%7Cbblayers%29.conf&amp;count=100&amp;search=kernel&amp;page=1&amp;orderby=variable_name%3A%2B

Django Version: 1.5
Python Version: 2.7.3
Installed Applications:
(&apos;django.contrib.staticfiles&apos;,
 &apos;django.contrib.humanize&apos;,
 &apos;orm&apos;,
 &apos;toastermain&apos;,
 &apos;toastergui&apos;,
 &apos;bldviewer&apos;,
 &apos;south&apos;)
Installed Middleware:
(&apos;django.middleware.common.CommonMiddleware&apos;,
 &apos;django.contrib.sessions.middleware.SessionMiddleware&apos;,
 &apos;django.middleware.csrf.CsrfViewMiddleware&apos;,
 &apos;django.contrib.auth.middleware.AuthenticationMiddleware&apos;,
 &apos;django.contrib.messages.middleware.MessageMiddleware&apos;)


Traceback:
File &quot;/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py&quot; in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File &quot;/home/yocto/poky/bitbake/lib/toaster/toastergui/views.py&quot; in configvars
  787.     queryset = _get_queryset(Variable, queryset, filter_string, search_term, ordering_string)
File &quot;/home/yocto/poky/bitbake/lib/toaster/toastergui/views.py&quot; in _get_queryset
  187.     if ordering_string and queryset:
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/query.py&quot; in __nonzero__
  141.         return type(self).__bool__(self)
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/query.py&quot; in __bool__
  135.             next(iter(self))
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/query.py&quot; in _result_iter
  123.                 self._fill_cache()
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/query.py&quot; in _fill_cache
  939.                     self._result_cache.append(next(self._iter))
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/query.py&quot; in _safe_iterator
  344.             for item in iterator:
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/query.py&quot; in iterator
  301.         for row in compiler.results_iter():
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py&quot; in results_iter
  775.         for rows in self.execute_sql(MULTI):
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py&quot; in execute_sql
  840.         cursor.execute(sql, params)
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py&quot; in execute
  41.             return self.cursor.execute(sql, params)
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py&quot; in execute
  366.             six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File &quot;/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py&quot; in execute
  362.             return Database.Cursor.execute(self, query, params)

Exception Type: DatabaseError at /gui/build/65/configvars
Exception Value: user-defined function raised exception</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41210</commentid>
    <comment_count>1</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2014-03-14 04:15:12 +0000</bug_when>
    <thetext>It is the &quot;regex&quot; filter returning an empty set to a search that leads to the error.

The filter in question is the &quot;vhistory__file_name__regex:conf/(local|bblayers).conf&quot;

If I change the filter to ...
  filter=vhistory__file_name__contains:conf/bblayers.con
... it leads to an empty table and no errors.

If I leave the filter but remove the &quot;search=kernel&quot; I get results returned and no error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41211</commentid>
    <comment_count>2</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2014-03-14 05:13:38 +0000</bug_when>
    <thetext>The bug is deeper than that, somewhere inside the handling of the lambda function from &quot;_get_search_results&quot; in the Django Q object filtering.

The regex filtering in &quot;_get_queryset&quot; returns a successful queryset with some 20 entries.

Then in &quot;_get_search_results&quot;, the Q object filter call for the search terms does return, but the resulting queryset object is damaged, in that any method call (&quot;exists&quot;, &quot;count&quot;, ...) will immediately cause the reported error. I find that if I replace the Q object with a simple filter (no lamba), there is no error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41521</commentid>
    <comment_count>3</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2014-03-20 12:20:25 +0000</bug_when>
    <thetext>Is this a bug in the Q() in Django itself ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41522</commentid>
    <comment_count>4</comment_count>
    <who name="Alexandru Damian">alexandru.damian</who>
    <bug_when>2014-03-20 12:32:26 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Is this a bug in the Q() in Django itself ?

No, this is an issue with Sqlite3 engine. reference:
http://www.gossamer-threads.com/lists/python/python/543700</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42476</commentid>
    <comment_count>5</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2014-04-09 23:15:23 +0000</bug_when>
    <thetext>commit 74e2f8501997143162855b970ffd9fdb33d24bd8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42562</commentid>
    <comment_count>6</comment_count>
    <who name="Belen Barros Pena">belen.barros.pena</who>
    <bug_when>2014-04-10 18:06:05 +0000</bug_when>
    <thetext>verified in master:db80f796e78746014a0f9497638e5c6fd2953ef0</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>