diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-09-10 18:11:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-10 21:54:44 +0100 |
commit | 5f40b7a29b2fe957b69c87cce7c8b2e9cf52a4a0 (patch) | |
tree | 76457171e6ca700e5a4879ccd767886c6ba2fe05 /bitbake | |
parent | 4ec3d7207261d12ff4859982989be7e142e7611d (diff) | |
download | poky-5f40b7a29b2fe957b69c87cce7c8b2e9cf52a4a0.tar.gz |
bitbake: hob: ensure error message text is properly escaped
Our poor implementation of markup escaping was causing invalid
markup, leading to the error dialog being blank. Use the glib markup
escaping function provided by PyGTK+ to do this properly and avoid the
blank error dialogs.
Partial fix for [YOCTO #2983].
(Bitbake rev: 563ea5233a5ab1629c51e802d04280692f96c596)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 833577fc69..a203a06e59 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -21,6 +21,7 @@ | |||
21 | # with this program; if not, write to the Free Software Foundation, Inc., | 21 | # with this program; if not, write to the Free Software Foundation, Inc., |
22 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 22 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
23 | 23 | ||
24 | import glib | ||
24 | import gtk | 25 | import gtk |
25 | import copy | 26 | import copy |
26 | import os | 27 | import os |
@@ -378,15 +379,6 @@ class Builder(gtk.Window): | |||
378 | END_NOOP : None, | 379 | END_NOOP : None, |
379 | } | 380 | } |
380 | 381 | ||
381 | @classmethod | ||
382 | def interpret_markup(cls, msg): | ||
383 | msg = msg.replace('&', '&') | ||
384 | msg = msg.replace('<', '<') | ||
385 | msg = msg.replace('>', '>') | ||
386 | msg = msg.replace('"', '"') | ||
387 | msg = msg.replace("'", "´") | ||
388 | return msg | ||
389 | |||
390 | def __init__(self, hobHandler, recipe_model, package_model): | 382 | def __init__(self, hobHandler, recipe_model, package_model): |
391 | super(Builder, self).__init__() | 383 | super(Builder, self).__init__() |
392 | 384 | ||
@@ -783,7 +775,7 @@ class Builder(gtk.Window): | |||
783 | 775 | ||
784 | def show_error_dialog(self, msg): | 776 | def show_error_dialog(self, msg): |
785 | lbl = "<b>Error</b>\n" | 777 | lbl = "<b>Error</b>\n" |
786 | lbl = lbl + "%s\n\n" % Builder.interpret_markup(msg) | 778 | lbl = lbl + "%s\n\n" % glib.markup_escape_text(msg) |
787 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) | 779 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) |
788 | button = dialog.add_button("Close", gtk.RESPONSE_OK) | 780 | button = dialog.add_button("Close", gtk.RESPONSE_OK) |
789 | HobButton.style_button(button) | 781 | HobButton.style_button(button) |
@@ -971,7 +963,7 @@ class Builder(gtk.Window): | |||
971 | self.build_failed() | 963 | self.build_failed() |
972 | 964 | ||
973 | def handler_no_provider_cb(self, running_build, msg): | 965 | def handler_no_provider_cb(self, running_build, msg): |
974 | dialog = CrumbsMessageDialog(self, Builder.interpret_markup(msg), gtk.STOCK_DIALOG_INFO) | 966 | dialog = CrumbsMessageDialog(self, glib.markup_escape_text(msg), gtk.STOCK_DIALOG_INFO) |
975 | button = dialog.add_button("Close", gtk.RESPONSE_OK) | 967 | button = dialog.add_button("Close", gtk.RESPONSE_OK) |
976 | HobButton.style_button(button) | 968 | HobButton.style_button(button) |
977 | dialog.run() | 969 | dialog.run() |