safe_eval prevents workflow execution with Python 2.7

Bug #673773 reported by Nicholas Henry
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
Low
OpenERP's Framework R&D

Bug Description

Environment:
-------------------------------------------------
OpenERP Web ; Version 6.0.0-rc1
Ubuntu 8.4 ; Linux scubuntu 2.6.24-28-server #1 SMP Sat Oct 16 18:09:42 UTC 2010 x86_64 GNU/Linux
Python-2.7
Google Chrome and Firefox

Latest versions of all dependencies (Let me know if you need me to list them with their versions)

Problem:
-------------------------------------------------
1. I installed OpenERP 6.0.0-rc1
2. I clicked on the "Start Configuration" button that appeared when I first logged in
3. I hit next (I've tried several times and it doesn't matter if I use the simple or the extended Interface)
4. I hit next (again, I have tried by entering in valid data and have tried with the defaults)
5. I select/check all of the applications and any of the "Industry Specific" applications and then hit "Install"

I then get the Following:

An Application Error has been reported.
Let me fix it
Fix it for me

I click on Let me fix it and I get the following:

Traceback (most recent call last):
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/service/web_services.py", line 586, in dispatch
    res = fn(db, uid, *params)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 57, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 140, in execute
    res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/osv/osv.py", line 130, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/addons/base/res/res_config.py", line 182, in action_next
    next = self.execute(cr, uid, ids, context=None)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/addons/base/res/res_config.py", line 420, in execute
    pooler.restart_pool(cr.dbname, update_module=True)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/pooler.py", line 60, in restart_pool
    return get_db_and_pool(db_name, force_demo, status, update_module=update_module)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/pooler.py", line 39, in get_db_and_pool
    addons.load_modules(db, force_demo, status, update_module)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/addons/__init__.py", line 852, in load_modules
    r = load_module_graph(cr, graph, status, report=report)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/addons/__init__.py", line 732, in load_module_graph
    load_demo(cr, m, idref, mode)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/addons/__init__.py", line 643, in load_demo
    _load_data(cr, module_name, id_map, mode, 'demo')
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/addons/__init__.py", line 675, in _load_data
    tools.convert_xml_import(cr, module_name, file, id_map, mode, noupdate)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/tools/convert.py", line 960, in convert_xml_import
    obj.parse(doc.getroot())
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/tools/convert.py", line 851, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/tools/convert.py", line 533, in _tag_workflow
    str(rec.get('action','')), cr)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/wkf_service.py", line 80, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/instance.py", line 48, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 61, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 174, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 182, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 41, in create
    process(cr, res, ident, stack=stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 61, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 174, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 182, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 41, in create
    process(cr, res, ident, stack=stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 61, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 174, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 182, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 41, in create
    process(cr, res, ident, stack=stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 53, in process
    result = _execute(cr, workitem, activity, ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 126, in _execute
    id_new = wkf_expr.execute(cr, ident, workitem, activity)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/wkf_expr.py", line 68, in execute
    return _eval_expr(cr, ident, workitem, activity['action'])
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/wkf_expr.py", line 58, in _eval_expr
    ret = eval(line, env, nocopy=True)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/tools/safe_eval.py", line 271, in safe_eval
    return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "", line 1, in <module>
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/osv/orm.py", line 177, in <lambda>
    return lambda *args, **argv: attr(self._cr, self._uid, [self._id], *args, **argv)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/addons/purchase/purchase.py", line 461, in action_picking_create
    wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/wkf_service.py", line 80, in trg_validate
    res2 = instance.validate(cr, id, ident, signal)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/instance.py", line 48, in validate
    workitem.process(cr, witem, ident, signal, force_running, stack=stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 61, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 174, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 182, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 41, in create
    process(cr, res, ident, stack=stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 61, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 174, in _split_test
    _join_test(cr, t[0], t[1], ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 182, in _join_test
    create(cr,[activity], inst_id, ident, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 41, in create
    process(cr, res, ident, stack=stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 61, in process
    ok = _split_test(cr, workitem, activity['split_mode'], ident, signal, stack)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/workitem.py", line 156, in _split_test
    if wkf_expr.check(cr, workitem, ident, transition,signal):
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/wkf_expr.py", line 81, in check
    return _eval_expr(cr, ident, workitem, transition['condition'])
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/workflow/wkf_expr.py", line 58, in _eval_expr
    ret = eval(line, env, nocopy=True)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/tools/safe_eval.py", line 271, in safe_eval
    return eval(test_expr(expr,_SAFE_OPCODES, mode=mode), globals_dict, locals_dict)
  File "/opt/standingcloud/stack/openerp-server-6.0.0-rc1/lib/python2.7/site-packages/openerp-server/tools/safe_eval.py", line 105, in test_expr
    raise ValueError("opcode %s not allowed (%r)" % (opname[code], expr))
ValueError: opcode JUMP_IF_FALSE_OR_POP not allowed (u'auto_picking and test_auto_picking()')

Revision history for this message
Nicholas Henry (nickh) wrote :
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello Nicholas,

The issue you see comes from the fact that you are using Python 2.7, which introduces new OPCODES during standard operations, which are not allowed by the current security mechanism (safe_eval) in OpenERP, designed for Python 2.5/2.6.

As a temporary workaround you may simply try to use Python 2.6 instead to run the server (this is not specific to the Web client in fact)

Thanks for the report!

affects: openobject-client-web → openobject-server
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
importance: Undecided → Low
status: New → Confirmed
milestone: none → 6.0-rc2
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Link to relevant Python bug and patch: http://bugs.python.org/issue4715

summary: - Application Error during "Configure Your Interface"
+ safe_eval prevents workflow execution with Python 2.7
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

The fix has landed in rev 3001 - <email address hidden> of server trunk.

Thank you for the detailed report!

Changed in openobject-server:
status: Confirmed → Fix Released
Revision history for this message
Daniel Blanco (daniel-blancomartin) wrote :

In my case, I had this problem running Openerp 5 over Python 2.7.

I have installed Python 2.6 making them both coexist. But the problem is that the 2.6 installation, doesn't have the needed addons installed. The key problem is PyUno ("uno") is an open office bridge, needed for the report_openoffice, which has some dependencies with other modules.

The problem comes from the old server which has been compromised, so I had to migrate in a rush to another server

Please, help. I'm not prepared yet for OE6, since a number of modules must be upgraded to 6 before I could migrate.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote : Re: [Bug 673773] Re: safe_eval prevents workflow execution with Python 2.7

On 05/26/2011 09:13 PM, Daniel Blanco wrote:
> In my case, I had this problem running Openerp 5 over Python 2.7.
(,,,)
> Please, help. I'm not prepared yet for OE6, since a number of modules
> must be upgraded to 6 before I could migrate.

Daniel, have you tried simply applying the 6.0 patch to your OpenERP 5.0
server?
You can find the patch by going to the revision mentioned in comment #4:
http://bazaar.launchpad.net/~<email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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