* [bitbake][PATCH] lib/ui/taskexp: Validate gi import
@ 2020-07-01 16:27 David Khouya
2020-07-07 9:52 ` [bitbake-devel] " Jacob Kroon
0 siblings, 1 reply; 7+ messages in thread
From: David Khouya @ 2020-07-01 16:27 UTC (permalink / raw)
To: bitbake-devel; +Cc: David Khouya
When running bitbake -g -u taskexp without having gi python module or
and invalid gtk version, bitbake fails with a stack trace.
In case of import or version error, bitbake should exit with an error
message instead of a stack trace.
Signed-off-by: David Khouya <dakhouya@gmail.com>
---
lib/bb/ui/taskexp.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
index 8fff2442..336d197d 100644
--- a/lib/bb/ui/taskexp.py
+++ b/lib/bb/ui/taskexp.py
@@ -8,9 +8,15 @@
#
import sys
-import gi
-gi.require_version('Gtk', '3.0')
-from gi.repository import Gtk, Gdk, GObject
+
+try:
+ import gi
+ gi.require_version('Gtk', '3.0')
+except ValueError:
+ sys.exit("FATAL: Gtk version needs to be 3.0")
+except ImportError:
+ sys.exit("FATAL: Gtk ui could not load the required gi python module")
+
import threading
from xmlrpc import client
import bb
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [bitbake-devel] [bitbake][PATCH] lib/ui/taskexp: Validate gi import
2020-07-01 16:27 [bitbake][PATCH] lib/ui/taskexp: Validate gi import David Khouya
@ 2020-07-07 9:52 ` Jacob Kroon
2020-07-07 11:56 ` David Khouya
0 siblings, 1 reply; 7+ messages in thread
From: Jacob Kroon @ 2020-07-07 9:52 UTC (permalink / raw)
To: David Khouya, bitbake-devel
On 7/1/20 6:27 PM, David Khouya wrote:
> When running bitbake -g -u taskexp without having gi python module or
> and invalid gtk version, bitbake fails with a stack trace.
>
> In case of import or version error, bitbake should exit with an error
> message instead of a stack trace.
>
> Signed-off-by: David Khouya <dakhouya@gmail.com>
> ---
> lib/bb/ui/taskexp.py | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
> index 8fff2442..336d197d 100644
> --- a/lib/bb/ui/taskexp.py
> +++ b/lib/bb/ui/taskexp.py
> @@ -8,9 +8,15 @@
> #
>
> import sys
> -import gi
> -gi.require_version('Gtk', '3.0')
> -from gi.repository import Gtk, Gdk, GObject
> +
> +try:
> + import gi
> + gi.require_version('Gtk', '3.0')
> +except ValueError:
> + sys.exit("FATAL: Gtk version needs to be 3.0")
> +except ImportError:
> + sys.exit("FATAL: Gtk ui could not load the required gi python module")
> +
> import threading
> from xmlrpc import client
> import bb
>
>
With this patch applied I get:
Traceback (most recent call last):
File "/home/jkroon/Projects/foo-linux/bitbake/bin/bitbake", line 35,
in <module>
sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
366, in bitbake_main
server_connection, ui_module = setup_bitbake(configParams,
configuration)
File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
404, in setup_bitbake
ui_module = import_extension_module(bb.ui, configParams.ui, 'main')
File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
96, in import_extension_module
module = __import__(pkg.__name__, fromlist=[modulename])
File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/ui/taskexp.py",
line 33, in <module>
class PackageDepView(Gtk.TreeView):
NameError: name 'Gtk' is not defined
Reverting the patch allows me to run
bitbake -g -u taskexp core-image-minimal
and browsing via the Gtk UI works fine.
Jacob
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bitbake-devel] [bitbake][PATCH] lib/ui/taskexp: Validate gi import
2020-07-07 9:52 ` [bitbake-devel] " Jacob Kroon
@ 2020-07-07 11:56 ` David Khouya
2020-07-07 12:05 ` Martin Jansa
0 siblings, 1 reply; 7+ messages in thread
From: David Khouya @ 2020-07-07 11:56 UTC (permalink / raw)
To: Jacob Kroon; +Cc: bitbake-devel
[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]
Thanks Jacob for the feedback. I'll submit a patch v2 with the changes
On Tue, Jul 7, 2020 at 5:53 AM Jacob Kroon <jacob.kroon@gmail.com> wrote:
> On 7/1/20 6:27 PM, David Khouya wrote:
> > When running bitbake -g -u taskexp without having gi python module or
> > and invalid gtk version, bitbake fails with a stack trace.
> >
> > In case of import or version error, bitbake should exit with an error
> > message instead of a stack trace.
> >
> > Signed-off-by: David Khouya <dakhouya@gmail.com>
> > ---
> > lib/bb/ui/taskexp.py | 12 +++++++++---
> > 1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
> > index 8fff2442..336d197d 100644
> > --- a/lib/bb/ui/taskexp.py
> > +++ b/lib/bb/ui/taskexp.py
> > @@ -8,9 +8,15 @@
> > #
> >
> > import sys
> > -import gi
> > -gi.require_version('Gtk', '3.0')
> > -from gi.repository import Gtk, Gdk, GObject
> > +
> > +try:
> > + import gi
> > + gi.require_version('Gtk', '3.0')
> > +except ValueError:
> > + sys.exit("FATAL: Gtk version needs to be 3.0")
> > +except ImportError:
> > + sys.exit("FATAL: Gtk ui could not load the required gi python
> module")
> > +
> > import threading
> > from xmlrpc import client
> > import bb
> >
> >
>
> With this patch applied I get:
>
> Traceback (most recent call last):
> File "/home/jkroon/Projects/foo-linux/bitbake/bin/bitbake", line 35,
> in <module>
> sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
> 366, in bitbake_main
> server_connection, ui_module = setup_bitbake(configParams,
> configuration)
> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
> 404, in setup_bitbake
> ui_module = import_extension_module(bb.ui, configParams.ui, 'main')
> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
> 96, in import_extension_module
> module = __import__(pkg.__name__, fromlist=[modulename])
> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/ui/taskexp.py",
> line 33, in <module>
> class PackageDepView(Gtk.TreeView):
> NameError: name 'Gtk' is not defined
>
> Reverting the patch allows me to run
>
> bitbake -g -u taskexp core-image-minimal
>
> and browsing via the Gtk UI works fine.
>
> Jacob
>
[-- Attachment #2: Type: text/html, Size: 3253 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bitbake-devel] [bitbake][PATCH] lib/ui/taskexp: Validate gi import
2020-07-07 11:56 ` David Khouya
@ 2020-07-07 12:05 ` Martin Jansa
2020-07-07 12:08 ` David Khouya
[not found] ` <161F7718C6BC7653.28965@lists.openembedded.org>
0 siblings, 2 replies; 7+ messages in thread
From: Martin Jansa @ 2020-07-07 12:05 UTC (permalink / raw)
To: David Khouya; +Cc: Jacob Kroon, bitbake-devel
[-- Attachment #1: Type: text/plain, Size: 2742 bytes --]
It's already in master:
https://git.openembedded.org/bitbake/commit/?id=2a2c507f239b047f34765312df4168030e38b90d
you should send a separate fixup patch instead of v2.
On Tue, Jul 7, 2020 at 1:57 PM David Khouya <dakhouya@gmail.com> wrote:
> Thanks Jacob for the feedback. I'll submit a patch v2 with the changes
>
>
> On Tue, Jul 7, 2020 at 5:53 AM Jacob Kroon <jacob.kroon@gmail.com> wrote:
>
>> On 7/1/20 6:27 PM, David Khouya wrote:
>> > When running bitbake -g -u taskexp without having gi python module or
>> > and invalid gtk version, bitbake fails with a stack trace.
>> >
>> > In case of import or version error, bitbake should exit with an error
>> > message instead of a stack trace.
>> >
>> > Signed-off-by: David Khouya <dakhouya@gmail.com>
>> > ---
>> > lib/bb/ui/taskexp.py | 12 +++++++++---
>> > 1 file changed, 9 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
>> > index 8fff2442..336d197d 100644
>> > --- a/lib/bb/ui/taskexp.py
>> > +++ b/lib/bb/ui/taskexp.py
>> > @@ -8,9 +8,15 @@
>> > #
>> >
>> > import sys
>> > -import gi
>> > -gi.require_version('Gtk', '3.0')
>> > -from gi.repository import Gtk, Gdk, GObject
>> > +
>> > +try:
>> > + import gi
>> > + gi.require_version('Gtk', '3.0')
>> > +except ValueError:
>> > + sys.exit("FATAL: Gtk version needs to be 3.0")
>> > +except ImportError:
>> > + sys.exit("FATAL: Gtk ui could not load the required gi python
>> module")
>> > +
>> > import threading
>> > from xmlrpc import client
>> > import bb
>> >
>> >
>>
>> With this patch applied I get:
>>
>> Traceback (most recent call last):
>> File "/home/jkroon/Projects/foo-linux/bitbake/bin/bitbake", line 35,
>> in <module>
>> sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>> 366, in bitbake_main
>> server_connection, ui_module = setup_bitbake(configParams,
>> configuration)
>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>> 404, in setup_bitbake
>> ui_module = import_extension_module(bb.ui, configParams.ui, 'main')
>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>> 96, in import_extension_module
>> module = __import__(pkg.__name__, fromlist=[modulename])
>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/ui/taskexp.py",
>> line 33, in <module>
>> class PackageDepView(Gtk.TreeView):
>> NameError: name 'Gtk' is not defined
>>
>> Reverting the patch allows me to run
>>
>> bitbake -g -u taskexp core-image-minimal
>>
>> and browsing via the Gtk UI works fine.
>>
>> Jacob
>>
>
>
[-- Attachment #2: Type: text/html, Size: 3910 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bitbake-devel] [bitbake][PATCH] lib/ui/taskexp: Validate gi import
2020-07-07 12:05 ` Martin Jansa
@ 2020-07-07 12:08 ` David Khouya
[not found] ` <161F7718C6BC7653.28965@lists.openembedded.org>
1 sibling, 0 replies; 7+ messages in thread
From: David Khouya @ 2020-07-07 12:08 UTC (permalink / raw)
To: Martin Jansa; +Cc: Jacob Kroon, bitbake-devel
[-- Attachment #1: Type: text/plain, Size: 2956 bytes --]
Perfect, will do.
On Tue, Jul 7, 2020 at 8:05 AM Martin Jansa <martin.jansa@gmail.com> wrote:
> It's already in master:
>
> https://git.openembedded.org/bitbake/commit/?id=2a2c507f239b047f34765312df4168030e38b90d
> you should send a separate fixup patch instead of v2.
>
> On Tue, Jul 7, 2020 at 1:57 PM David Khouya <dakhouya@gmail.com> wrote:
>
>> Thanks Jacob for the feedback. I'll submit a patch v2 with the changes
>>
>>
>> On Tue, Jul 7, 2020 at 5:53 AM Jacob Kroon <jacob.kroon@gmail.com> wrote:
>>
>>> On 7/1/20 6:27 PM, David Khouya wrote:
>>> > When running bitbake -g -u taskexp without having gi python module or
>>> > and invalid gtk version, bitbake fails with a stack trace.
>>> >
>>> > In case of import or version error, bitbake should exit with an error
>>> > message instead of a stack trace.
>>> >
>>> > Signed-off-by: David Khouya <dakhouya@gmail.com>
>>> > ---
>>> > lib/bb/ui/taskexp.py | 12 +++++++++---
>>> > 1 file changed, 9 insertions(+), 3 deletions(-)
>>> >
>>> > diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
>>> > index 8fff2442..336d197d 100644
>>> > --- a/lib/bb/ui/taskexp.py
>>> > +++ b/lib/bb/ui/taskexp.py
>>> > @@ -8,9 +8,15 @@
>>> > #
>>> >
>>> > import sys
>>> > -import gi
>>> > -gi.require_version('Gtk', '3.0')
>>> > -from gi.repository import Gtk, Gdk, GObject
>>> > +
>>> > +try:
>>> > + import gi
>>> > + gi.require_version('Gtk', '3.0')
>>> > +except ValueError:
>>> > + sys.exit("FATAL: Gtk version needs to be 3.0")
>>> > +except ImportError:
>>> > + sys.exit("FATAL: Gtk ui could not load the required gi python
>>> module")
>>> > +
>>> > import threading
>>> > from xmlrpc import client
>>> > import bb
>>> >
>>> >
>>>
>>> With this patch applied I get:
>>>
>>> Traceback (most recent call last):
>>> File "/home/jkroon/Projects/foo-linux/bitbake/bin/bitbake", line 35,
>>> in <module>
>>> sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>>> 366, in bitbake_main
>>> server_connection, ui_module = setup_bitbake(configParams,
>>> configuration)
>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>>> 404, in setup_bitbake
>>> ui_module = import_extension_module(bb.ui, configParams.ui, 'main')
>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>>> 96, in import_extension_module
>>> module = __import__(pkg.__name__, fromlist=[modulename])
>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/ui/taskexp.py",
>>> line 33, in <module>
>>> class PackageDepView(Gtk.TreeView):
>>> NameError: name 'Gtk' is not defined
>>>
>>> Reverting the patch allows me to run
>>>
>>> bitbake -g -u taskexp core-image-minimal
>>>
>>> and browsing via the Gtk UI works fine.
>>>
>>> Jacob
>>>
>>
>>
>
--
*David Khouya*
[-- Attachment #2: Type: text/html, Size: 4635 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bitbake-devel] [bitbake][PATCH] lib/ui/taskexp: Validate gi import
[not found] ` <161F7718C6BC7653.28965@lists.openembedded.org>
@ 2020-07-07 13:33 ` David Khouya
2020-07-07 14:18 ` Jacob Kroon
0 siblings, 1 reply; 7+ messages in thread
From: David Khouya @ 2020-07-07 13:33 UTC (permalink / raw)
To: David Khouya; +Cc: Martin Jansa, Jacob Kroon, bitbake-devel
[-- Attachment #1: Type: text/plain, Size: 3431 bytes --]
I pushed a commit on my fork if you want to give it a try. It works on my
side.
https://github.com/dakhouya/bitbake/commit/3af4530571cef1b6ec58f810b89f6f35a14cc475
I'll send a patch for that this evening.
On Tue, Jul 7, 2020 at 8:09 AM David Khouya via lists.openembedded.org
<dakhouya=gmail.com@lists.openembedded.org> wrote:
> Perfect, will do.
>
> On Tue, Jul 7, 2020 at 8:05 AM Martin Jansa <martin.jansa@gmail.com>
> wrote:
>
>> It's already in master:
>>
>> https://git.openembedded.org/bitbake/commit/?id=2a2c507f239b047f34765312df4168030e38b90d
>> you should send a separate fixup patch instead of v2.
>>
>> On Tue, Jul 7, 2020 at 1:57 PM David Khouya <dakhouya@gmail.com> wrote:
>>
>>> Thanks Jacob for the feedback. I'll submit a patch v2 with the changes
>>>
>>>
>>> On Tue, Jul 7, 2020 at 5:53 AM Jacob Kroon <jacob.kroon@gmail.com>
>>> wrote:
>>>
>>>> On 7/1/20 6:27 PM, David Khouya wrote:
>>>> > When running bitbake -g -u taskexp without having gi python module or
>>>> > and invalid gtk version, bitbake fails with a stack trace.
>>>> >
>>>> > In case of import or version error, bitbake should exit with an error
>>>> > message instead of a stack trace.
>>>> >
>>>> > Signed-off-by: David Khouya <dakhouya@gmail.com>
>>>> > ---
>>>> > lib/bb/ui/taskexp.py | 12 +++++++++---
>>>> > 1 file changed, 9 insertions(+), 3 deletions(-)
>>>> >
>>>> > diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
>>>> > index 8fff2442..336d197d 100644
>>>> > --- a/lib/bb/ui/taskexp.py
>>>> > +++ b/lib/bb/ui/taskexp.py
>>>> > @@ -8,9 +8,15 @@
>>>> > #
>>>> >
>>>> > import sys
>>>> > -import gi
>>>> > -gi.require_version('Gtk', '3.0')
>>>> > -from gi.repository import Gtk, Gdk, GObject
>>>> > +
>>>> > +try:
>>>> > + import gi
>>>> > + gi.require_version('Gtk', '3.0')
>>>> > +except ValueError:
>>>> > + sys.exit("FATAL: Gtk version needs to be 3.0")
>>>> > +except ImportError:
>>>> > + sys.exit("FATAL: Gtk ui could not load the required gi python
>>>> module")
>>>> > +
>>>> > import threading
>>>> > from xmlrpc import client
>>>> > import bb
>>>> >
>>>> >
>>>>
>>>> With this patch applied I get:
>>>>
>>>> Traceback (most recent call last):
>>>> File "/home/jkroon/Projects/foo-linux/bitbake/bin/bitbake", line 35,
>>>> in <module>
>>>> sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
>>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>>>> 366, in bitbake_main
>>>> server_connection, ui_module = setup_bitbake(configParams,
>>>> configuration)
>>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>>>> 404, in setup_bitbake
>>>> ui_module = import_extension_module(bb.ui, configParams.ui, 'main')
>>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/main.py", line
>>>> 96, in import_extension_module
>>>> module = __import__(pkg.__name__, fromlist=[modulename])
>>>> File "/home/jkroon/Projects/foo-linux/bitbake/lib/bb/ui/taskexp.py",
>>>> line 33, in <module>
>>>> class PackageDepView(Gtk.TreeView):
>>>> NameError: name 'Gtk' is not defined
>>>>
>>>> Reverting the patch allows me to run
>>>>
>>>> bitbake -g -u taskexp core-image-minimal
>>>>
>>>> and browsing via the Gtk UI works fine.
>>>>
>>>> Jacob
>>>>
>>>
>>>
>
> --
> *David Khouya*
>
>
>
>
--
*David Khouya*
[-- Attachment #2: Type: text/html, Size: 5772 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [bitbake-devel] [bitbake][PATCH] lib/ui/taskexp: Validate gi import
2020-07-07 13:33 ` David Khouya
@ 2020-07-07 14:18 ` Jacob Kroon
0 siblings, 0 replies; 7+ messages in thread
From: Jacob Kroon @ 2020-07-07 14:18 UTC (permalink / raw)
To: David Khouya; +Cc: Martin Jansa, bitbake-devel
On 7/7/20 3:33 PM, David Khouya wrote:
> I pushed a commit on my fork if you want to give it a try. It works on
> my side.
>
> https://github.com/dakhouya/bitbake/commit/3af4530571cef1b6ec58f810b89f6f35a14cc475
>
> I'll send a patch for that this evening.
>
Yes, this patch fixes taskexp for me.
Thanks,
Jacob
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-07 14:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 16:27 [bitbake][PATCH] lib/ui/taskexp: Validate gi import David Khouya
2020-07-07 9:52 ` [bitbake-devel] " Jacob Kroon
2020-07-07 11:56 ` David Khouya
2020-07-07 12:05 ` Martin Jansa
2020-07-07 12:08 ` David Khouya
[not found] ` <161F7718C6BC7653.28965@lists.openembedded.org>
2020-07-07 13:33 ` David Khouya
2020-07-07 14:18 ` Jacob Kroon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.