delete action always cause error ( in kilo)

Bug #1464461 reported by koji
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
High
Matthias Runge
Kilo
Fix Released
Undecided
Unassigned
OpenStack Security Advisory
Won't Fix
Undecided
Unassigned

Bug Description

When i did any delete actions (delete router, delete network etc...) in japanese environment , always get a error page.

horizon error logs:
-------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 52, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 84, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 223, in post
    return self.get(request, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 159, in get
    handled = self.construct_tables()
  File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 150, in construct_tables
    handled = self.handle_table(table)
  File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 125, in handle_table
    handled = self._tables[name].maybe_handle()
  File "/usr/lib/python2.7/site-packages/horizon/tables/base.py", line 1640, in maybe_handle
    return self.take_action(action_name, obj_id)
  File "/usr/lib/python2.7/site-packages/horizon/tables/base.py", line 1482, in take_action
    response = action.multiple(self, self.request, obj_ids)
  File "/usr/lib/python2.7/site-packages/horizon/tables/actions.py", line 302, in multiple
    return self.handle(data_table, request, object_ids)
  File "/usr/lib/python2.7/site-packages/horizon/tables/actions.py", line 828, in handle
    exceptions.handle(request, ignore=ignore)
  File "/usr/lib/python2.7/site-packages/horizon/exceptions.py", line 364, in handle
    six.reraise(exc_type, exc_value, exc_traceback)
  File "/usr/lib/python2.7/site-packages/horizon/tables/actions.py", line 817, in handle
    (self._get_action_name(past=True), datum_display))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
-------------------------

It occurs in japanese,korean,chinese,french and deutsche, not occurs in english and spanish.

Matthias Runge (mrunge)
tags: added: i18n kilo-backport-potential
Changed in horizon:
importance: Undecided → High
jun moon (z8715000)
Changed in horizon:
assignee: nobody → jun moon (z8715000)
jun moon (z8715000)
information type: Public → Public Security
Revision history for this message
jun moon (z8715000) wrote :

what does your ja enviroment mean ? Does it mean your environment is japanese system environment or the lauguage of openstack-dashboard is set to japanese ?

Revision history for this message
koji (koji-takeuchi) wrote :

It means "the lauguage of openstack-dashboard is set to japanese"

Revision history for this message
jun moon (z8715000) wrote : Re: [Bug 1464461] Re: delete action always cause error ( in kilo)
Download full text (3.1 KiB)

But I tried yesterday that deleting network and router was normal,in Japanese and Chinese environment 发自网易邮箱大师 On 2015-06-22 10:09 , koji Wrote: It means "the lauguage of openstack-dashboard is set to japanese" -- You received this bug notification because you are a bug assignee. https://bugs.launchpad.net/bugs/1464461 Title: delete action always cause error ( in kilo) Status in OpenStack Dashboard (Horizon): New Bug description: When i did any delete actions (delete router, delete network etc...) in japanese environment , always get a error page. horizon error logs: ------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec return view_func(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 52, in dec return view_func(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec return view_func(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/horizon/decorators.py", line 84, in dec return view_func(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch return handler(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 223, in post return self.get(request, *args, **kwargs) File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 159, in get handled = self.construct_tables() File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 150, in construct_tables handled = self.handle_table(table) File "/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 125, in handle_table handled = self._tables[name].maybe_handle() File "/usr/lib/python2.7/site-packages/horizon/tables/base.py", line 1640, in maybe_handle return self.take_action(action_name, obj_id) File "/usr/lib/python2.7/site-packages/horizon/tables/base.py", line 1482, in take_action response = action.multiple(self, self.request, obj_ids) File "/usr/lib/python2.7/site-packages/horizon/tables/actions.py", line 302, in multiple return self.handle(data_table, request, object_ids) File "/usr/lib/python2.7/site-packages/horizon/tables/actions.py", line 828, in handle exceptions.handle(request, ignore=ignore) File "/usr/lib/python2.7/site-packages/horizon/exceptions.py", line 364, in handle six.reraise(exc_type, exc_value, exc_traceback) File "/usr/lib/python2.7/site-packages/horizon/tables/actions.py", line 817, in handle (self._get_action_name(past=True), datum_display)) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128) ------------------------- It occurs in japanese,korean,chinese,french and deutsche, not occurs in english and spanish. To manage notifications about this bug go to: https://bugs.launchpad.net/horizon/+bug/1464461/+subs...

Read more...

Revision history for this message
Haifeng.Yan (yanheven) wrote :

can't reproduce. may be your locale environment don't support these types of language.

Revision history for this message
koji (koji-takeuchi) wrote :

I installed openstack kilo using RDO on CentOS7.

I describe below procedure of reproducing in python shell.

#in kilo
-------------------------
[openstack-kilo]# pip list | grep -i django
Django (1.8.1)
django-appconf (0.6)
django-compressor (1.4)
django-openstack-auth (1.2.0)
django-pyscss (1.0.5)
[openstack-kilo]# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.conf import settings
>>> from django.core.wsgi import get_wsgi_application
>>> from django.utils.translation import pgettext_lazy
>>> settings.configure(USE_I18N=True)
>>> application = get_wsgi_application()
>>> lazy_str_ja = pgettext_lazy('present','あああ')
>>> lazy_str_en = pgettext_lazy('present','aaa')
>>> '%s'%(lazy_str_ja)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 147, in __bytes_cast_encoded
    return func(*self.__args, **self.__kw).encode('utf-8')
  File "/usr/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 92, in pgettext
    return _trans.pgettext(context, message)
  File "/usr/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 331, in pgettext
    msg_with_ctxt = "%s%s%s" % (context, CONTEXT_SEPARATOR, message)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
>>> '%s'%(lazy_str_en)
'aaa'
------------------

#in juno
------------------
[openstack juno]# pip list | grep -i django
Django (1.6.11)
django-appconf (0.6)
django-compressor (1.3)
django-openstack-auth (1.1.7)
django-pyscss (1.0.5)
[openstack juno]# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.conf import settings
>>> from django.core.wsgi import get_wsgi_application
>>> from django.utils.translation import pgettext_lazy
>>> settings.configure(USE_I18N=True)
>>> application = get_wsgi_application()
>>> lazy_str_ja = pgettext_lazy('present','あああ')
>>> lazy_str_en = pgettext_lazy('present','aaa')
>>> '%s'%(lazy_str_ja)
'<django.utils.functional.__proxy__ object at 0x1f14d50>'
>>> '%s'%(lazy_str_en)
'<django.utils.functional.__proxy__ object at 0x2124490>'
------------------

Could you check the version of django.

Revision history for this message
jun moon (z8715000) wrote :

you can try like like this : u'%s'%(lazy_str_ja) , it'll use unicode to convert your string to byte string, then decode the byte string to a unicode object

Revision history for this message
koji (koji-takeuchi) wrote :

it worked.

------
# python
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.conf import settings
>>> from django.core.wsgi import get_wsgi_application
>>> from django.utils.translation import pgettext_lazy
>>> settings.configure(USE_I18N=True)
>>> application = get_wsgi_application()
>>> lazy_str_ja = pgettext_lazy('present',u'あああ')
>>> '%s'%(lazy_str_ja)
'\xe3\x81\x82\xe3\x81\x82\xe3\x81\x82'
------

so i changes the action.py as below.

-------------
# pwd
/usr/lib/python2.7/site-packages/horizon/tables
# diff actions.py.orig actions.py
767c767
< msgstr = pgettext_lazy("past", "%(action)s %(data_type)s")
---
> msgstr = pgettext_lazy("past", u"%(action)s %(data_type)s")
769c769
< msgstr = pgettext_lazy("present", "%(action)s %(data_type)s")
---
> msgstr = pgettext_lazy("present", u"%(action)s %(data_type)s")
-------------

and restart httpd.
then i do delete action , it works without errors.

Changed in horizon:
assignee: jun moon (z8715000) → Matthias Runge (mrunge)
status: New → In Progress
Changed in horizon:
status: In Progress → Fix Committed
Matthias Runge (mrunge)
Changed in horizon:
milestone: none → liberty-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/196637

Revision history for this message
Jeremy Stanley (fungi) wrote :

Can someone provide a justification explaining why this bug was switched to a suspected security vulnerability report? What is the exploit scenario and associated risk?

Changed in ossa:
status: New → Incomplete
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/kilo)

Reviewed: https://review.openstack.org/196637
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=25c961f69b88aee7a5413ec9456eeccb3b1669f3
Submitter: Jenkins
Branch: stable/kilo

commit 25c961f69b88aee7a5413ec9456eeccb3b1669f3
Author: Matthias Runge <email address hidden>
Date: Wed Jun 24 12:15:53 2015 +0200

    fix delete action always cause error

    Strings should be treated as unicode.

    Change-Id: Ic9faff0c882f30e7b1d04c8cd2a97aa64d1a61bc
    Closes-Bug: #1464461
    (cherry picked from commit 2dac63a786954276af75c9484d6cc8db7e89ffd4)

tags: added: in-stable-kilo
Revision history for this message
Jeremy Stanley (fungi) wrote :

Since it's been a week with no answer to my question in comment #10, I've switched this back to a regular public bug for now.

information type: Public Security → Public
Grant Murphy (gmurphy)
Changed in ossa:
status: Incomplete → Won't Fix
Changed in horizon:
status: Fix Committed → Fix Released
Revision history for this message
Kevin Tibi (ktibi) wrote :

#11 I have this issue with french, and your patch no works with me.

I have clean all then compress --force.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/216712

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to horizon (master)

Reviewed: https://review.openstack.org/216712
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=6a8361de947dfb4a941336a14a5275640835780a
Submitter: Jenkins
Branch: master

commit 6a8361de947dfb4a941336a14a5275640835780a
Author: Matthias Runge <email address hidden>
Date: Tue Aug 25 15:09:55 2015 +0200

    Fix UTF-8 handling in tables

    Previous fix was not complete.

    Altered the transform for sequence comparison to use str
    instead of repr for greater py2/py3 compatibility in the
    face of unicode.

    Closes-Bug: #1488443
    Related-Bug: #1464461
    Co-Authored-By: Richard Jones <email address hidden>
    Change-Id: I6b2c554350399f97f639e4c1e8d1ac8a34c9d046

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to horizon (stable/kilo)

Related fix proposed to branch: stable/kilo
Review: https://review.openstack.org/227143

Thierry Carrez (ttx)
Changed in horizon:
milestone: liberty-2 → 8.0.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (stable/kilo)

Change abandoned by Dave Walker (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/227143
Reason: Kilo is now approaching EOL. We are in freeze pending the final release and no freeze exception has been raised. Therefore I am abandoning this change, if it is required in the release - please restore and raise a request. Thanks

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

Other bug subscribers

Remote bug watches

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