* [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp
@ 2024-09-07 3:37 Tom de Vries
2024-09-07 18:09 ` Kevin Buettner
2024-09-08 20:38 ` Andrew Burgess
0 siblings, 2 replies; 6+ messages in thread
From: Tom de Vries @ 2024-09-07 3:37 UTC (permalink / raw)
To: gdb-patches
On a system with python 3.6, module gdb.missing_debug imports module curses,
so when running test-case gdb.python/py-missing-debug.exp on a system without
that module installed, we run into:
...
(gdb) source py-missing-debug.py^M
Python Exception <class 'ImportError'>: Module 'curses' is not installed.^M
Use:^M
sudo zypper install python36-curses^M
to install it.^M
Error occurred in Python: Module 'curses' is not installed.^M
Use:^M
sudo zypper install python36-curses^M
to install it.^M
(gdb) FAIL: gdb.python/py-missing-debug.exp: source python script
...
Fix this by issuing UNSUPPORTED instead, and bailing out.
Tested on x86_64-linux.
PR testsuite/31576
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31576
---
gdb/testsuite/gdb.python/py-missing-debug.exp | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-missing-debug.exp b/gdb/testsuite/gdb.python/py-missing-debug.exp
index dfc0a467b2a..9d853d3a311 100644
--- a/gdb/testsuite/gdb.python/py-missing-debug.exp
+++ b/gdb/testsuite/gdb.python/py-missing-debug.exp
@@ -58,8 +58,21 @@ with_test_prefix "initial checks" {
}
# Load the Python script into GDB.
-gdb_test "source $remote_python_file" "^Success" \
- "source python script"
+set python_script_loaded 0
+set re_no_curses [string_to_regexp "Module 'curses' is not installed."]
+gdb_test_multiple "source $remote_python_file" "source python script" {
+ -re -wrap $re_no_curses.* {
+ unsupported $gdb_test_name
+ }
+ -re -wrap "^Success" {
+ set python_script_loaded 1
+ pass $gdb_test_name
+ }
+}
+
+if { ! $python_script_loaded } {
+ return
+}
# Setup the separate debug info directory. This isn't actually needed until
# some of the later tests, but might as well get this done now.
base-commit: 4723415cda09b09dbac743f30f877355a49fdee2
--
2.35.3
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp
2024-09-07 3:37 [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp Tom de Vries
@ 2024-09-07 18:09 ` Kevin Buettner
2024-09-08 20:38 ` Andrew Burgess
1 sibling, 0 replies; 6+ messages in thread
From: Kevin Buettner @ 2024-09-07 18:09 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
On Sat, 7 Sep 2024 05:37:13 +0200
Tom de Vries <tdevries@suse.de> wrote:
> On a system with python 3.6, module gdb.missing_debug imports module curses,
> so when running test-case gdb.python/py-missing-debug.exp on a system without
> that module installed, we run into:
> ...
> (gdb) source py-missing-debug.py^M
> Python Exception <class 'ImportError'>: Module 'curses' is not installed.^M
> Use:^M
> sudo zypper install python36-curses^M
> to install it.^M
> Error occurred in Python: Module 'curses' is not installed.^M
> Use:^M
> sudo zypper install python36-curses^M
> to install it.^M
> (gdb) FAIL: gdb.python/py-missing-debug.exp: source python script
> ...
>
> Fix this by issuing UNSUPPORTED instead, and bailing out.
>
> Tested on x86_64-linux.
>
> PR testsuite/31576
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31576
LGTM.
Approved-by: Kevin Buettner <kevinb@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp
2024-09-07 3:37 [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp Tom de Vries
2024-09-07 18:09 ` Kevin Buettner
@ 2024-09-08 20:38 ` Andrew Burgess
2024-09-09 2:33 ` Tom de Vries
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Burgess @ 2024-09-08 20:38 UTC (permalink / raw)
To: Tom de Vries, gdb-patches
Tom de Vries <tdevries@suse.de> writes:
> On a system with python 3.6, module gdb.missing_debug imports module curses,
> so when running test-case gdb.python/py-missing-debug.exp on a system without
> that module installed, we run into:
> ...
> (gdb) source py-missing-debug.py^M
> Python Exception <class 'ImportError'>: Module 'curses' is not installed.^M
> Use:^M
> sudo zypper install python36-curses^M
> to install it.^M
> Error occurred in Python: Module 'curses' is not installed.^M
> Use:^M
> sudo zypper install python36-curses^M
> to install it.^M
> (gdb) FAIL: gdb.python/py-missing-debug.exp: source python script
Do you know where the curses include is coming from?
The py-missing-debug.py imports 'os' for os.rename and 'enum' for 'Enum'
class. I'm guessing one of these, (maybe 'os' ?) is pulling in curses,
but maybe there's something better we could use other than os.rename
which would avoid this issue?
If is 'os' that is pulling in 'curses', doesn't this feel like either
the system was broken anyway, or the package dependencies are broken?
Just curious to understand this better as I was a little surprised to
see that curses was a dependency of this test.
Thanks,
Andrew
> ...
>
> Fix this by issuing UNSUPPORTED instead, and bailing out.
>
> Tested on x86_64-linux.
>
> PR testsuite/31576
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31576
> ---
> gdb/testsuite/gdb.python/py-missing-debug.exp | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.python/py-missing-debug.exp b/gdb/testsuite/gdb.python/py-missing-debug.exp
> index dfc0a467b2a..9d853d3a311 100644
> --- a/gdb/testsuite/gdb.python/py-missing-debug.exp
> +++ b/gdb/testsuite/gdb.python/py-missing-debug.exp
> @@ -58,8 +58,21 @@ with_test_prefix "initial checks" {
> }
>
> # Load the Python script into GDB.
> -gdb_test "source $remote_python_file" "^Success" \
> - "source python script"
> +set python_script_loaded 0
> +set re_no_curses [string_to_regexp "Module 'curses' is not installed."]
> +gdb_test_multiple "source $remote_python_file" "source python script" {
> + -re -wrap $re_no_curses.* {
> + unsupported $gdb_test_name
> + }
> + -re -wrap "^Success" {
> + set python_script_loaded 1
> + pass $gdb_test_name
> + }
> +}
> +
> +if { ! $python_script_loaded } {
> + return
> +}
>
> # Setup the separate debug info directory. This isn't actually needed until
> # some of the later tests, but might as well get this done now.
>
> base-commit: 4723415cda09b09dbac743f30f877355a49fdee2
> --
> 2.35.3
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp
2024-09-08 20:38 ` Andrew Burgess
@ 2024-09-09 2:33 ` Tom de Vries
2024-09-09 14:19 ` Andrew Burgess
0 siblings, 1 reply; 6+ messages in thread
From: Tom de Vries @ 2024-09-09 2:33 UTC (permalink / raw)
To: Andrew Burgess, gdb-patches
On 9/8/24 22:38, Andrew Burgess wrote:
> Tom de Vries <tdevries@suse.de> writes:
>
>> On a system with python 3.6, module gdb.missing_debug imports module curses,
>> so when running test-case gdb.python/py-missing-debug.exp on a system without
>> that module installed, we run into:
>> ...
>> (gdb) source py-missing-debug.py^M
>> Python Exception <class 'ImportError'>: Module 'curses' is not installed.^M
>> Use:^M
>> sudo zypper install python36-curses^M
>> to install it.^M
>> Error occurred in Python: Module 'curses' is not installed.^M
>> Use:^M
>> sudo zypper install python36-curses^M
>> to install it.^M
>> (gdb) FAIL: gdb.python/py-missing-debug.exp: source python script
>
Hi Andrew,
> Do you know where the curses include is coming from?
>
Yes, from gdb/python/lib/gdb/missing_debug.py:
...
if sys.version_info >= (3, 7):
# Functions str.isascii() and str.isalnum are available starting Python
# 3.7.
def isascii(ch):
return ch.isascii()
def isalnum(ch):
return ch.isalnum()
else:
# Fall back to curses.ascii.isascii() and curses.ascii.isalnum() for
# earlier versions.
from curses.ascii import isalnum, isascii
...
Thanks,
- Tom
> The py-missing-debug.py imports 'os' for os.rename and 'enum' for 'Enum'
> class. I'm guessing one of these, (maybe 'os' ?) is pulling in curses,
> but maybe there's something better we could use other than os.rename
> which would avoid this issue?
>
> If is 'os' that is pulling in 'curses', doesn't this feel like either
> the system was broken anyway, or the package dependencies are broken?
>
> Just curious to understand this better as I was a little surprised to
> see that curses was a dependency of this test.
>
> Thanks,
> Andrew
>
>
>> ...
>>
>> Fix this by issuing UNSUPPORTED instead, and bailing out.
>>
>> Tested on x86_64-linux.
>>
>> PR testsuite/31576
>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31576
>> ---
>> gdb/testsuite/gdb.python/py-missing-debug.exp | 17 +++++++++++++++--
>> 1 file changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/gdb/testsuite/gdb.python/py-missing-debug.exp b/gdb/testsuite/gdb.python/py-missing-debug.exp
>> index dfc0a467b2a..9d853d3a311 100644
>> --- a/gdb/testsuite/gdb.python/py-missing-debug.exp
>> +++ b/gdb/testsuite/gdb.python/py-missing-debug.exp
>> @@ -58,8 +58,21 @@ with_test_prefix "initial checks" {
>> }
>>
>> # Load the Python script into GDB.
>> -gdb_test "source $remote_python_file" "^Success" \
>> - "source python script"
>> +set python_script_loaded 0
>> +set re_no_curses [string_to_regexp "Module 'curses' is not installed."]
>> +gdb_test_multiple "source $remote_python_file" "source python script" {
>> + -re -wrap $re_no_curses.* {
>> + unsupported $gdb_test_name
>> + }
>> + -re -wrap "^Success" {
>> + set python_script_loaded 1
>> + pass $gdb_test_name
>> + }
>> +}
>> +
>> +if { ! $python_script_loaded } {
>> + return
>> +}
>>
>> # Setup the separate debug info directory. This isn't actually needed until
>> # some of the later tests, but might as well get this done now.
>>
>> base-commit: 4723415cda09b09dbac743f30f877355a49fdee2
>> --
>> 2.35.3
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp
2024-09-09 2:33 ` Tom de Vries
@ 2024-09-09 14:19 ` Andrew Burgess
2024-09-09 16:57 ` Andrew Burgess
0 siblings, 1 reply; 6+ messages in thread
From: Andrew Burgess @ 2024-09-09 14:19 UTC (permalink / raw)
To: Tom de Vries, gdb-patches
Tom de Vries <tdevries@suse.de> writes:
> On 9/8/24 22:38, Andrew Burgess wrote:
>> Tom de Vries <tdevries@suse.de> writes:
>>
>>> On a system with python 3.6, module gdb.missing_debug imports module curses,
>>> so when running test-case gdb.python/py-missing-debug.exp on a system without
>>> that module installed, we run into:
>>> ...
>>> (gdb) source py-missing-debug.py^M
>>> Python Exception <class 'ImportError'>: Module 'curses' is not installed.^M
>>> Use:^M
>>> sudo zypper install python36-curses^M
>>> to install it.^M
>>> Error occurred in Python: Module 'curses' is not installed.^M
>>> Use:^M
>>> sudo zypper install python36-curses^M
>>> to install it.^M
>>> (gdb) FAIL: gdb.python/py-missing-debug.exp: source python script
>>
>
> Hi Andrew,
>
>> Do you know where the curses include is coming from?
>>
>
> Yes, from gdb/python/lib/gdb/missing_debug.py:
> ...
> if sys.version_info >= (3, 7):
> # Functions str.isascii() and str.isalnum are available starting Python
> # 3.7.
> def isascii(ch):
> return ch.isascii()
>
> def isalnum(ch):
> return ch.isalnum()
>
> else:
> # Fall back to curses.ascii.isascii() and curses.ascii.isalnum() for
> # earlier versions.
> from curses.ascii import isalnum, isascii
> ...
Thanks for explaining this. I wonder if there's a way we could avoid
that dependency... I'll have a think about that one.
Thanks,
Andrew
>
> Thanks,
> - Tom
>
>> The py-missing-debug.py imports 'os' for os.rename and 'enum' for 'Enum'
>> class. I'm guessing one of these, (maybe 'os' ?) is pulling in curses,
>> but maybe there's something better we could use other than os.rename
>> which would avoid this issue?
>>
>> If is 'os' that is pulling in 'curses', doesn't this feel like either
>> the system was broken anyway, or the package dependencies are broken?
>>
>> Just curious to understand this better as I was a little surprised to
>> see that curses was a dependency of this test.
>>
>> Thanks,
>> Andrew
>>
>>
>>> ...
>>>
>>> Fix this by issuing UNSUPPORTED instead, and bailing out.
>>>
>>> Tested on x86_64-linux.
>>>
>>> PR testsuite/31576
>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31576
>>> ---
>>> gdb/testsuite/gdb.python/py-missing-debug.exp | 17 +++++++++++++++--
>>> 1 file changed, 15 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/gdb/testsuite/gdb.python/py-missing-debug.exp b/gdb/testsuite/gdb.python/py-missing-debug.exp
>>> index dfc0a467b2a..9d853d3a311 100644
>>> --- a/gdb/testsuite/gdb.python/py-missing-debug.exp
>>> +++ b/gdb/testsuite/gdb.python/py-missing-debug.exp
>>> @@ -58,8 +58,21 @@ with_test_prefix "initial checks" {
>>> }
>>>
>>> # Load the Python script into GDB.
>>> -gdb_test "source $remote_python_file" "^Success" \
>>> - "source python script"
>>> +set python_script_loaded 0
>>> +set re_no_curses [string_to_regexp "Module 'curses' is not installed."]
>>> +gdb_test_multiple "source $remote_python_file" "source python script" {
>>> + -re -wrap $re_no_curses.* {
>>> + unsupported $gdb_test_name
>>> + }
>>> + -re -wrap "^Success" {
>>> + set python_script_loaded 1
>>> + pass $gdb_test_name
>>> + }
>>> +}
>>> +
>>> +if { ! $python_script_loaded } {
>>> + return
>>> +}
>>>
>>> # Setup the separate debug info directory. This isn't actually needed until
>>> # some of the later tests, but might as well get this done now.
>>>
>>> base-commit: 4723415cda09b09dbac743f30f877355a49fdee2
>>> --
>>> 2.35.3
>>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp
2024-09-09 14:19 ` Andrew Burgess
@ 2024-09-09 16:57 ` Andrew Burgess
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Burgess @ 2024-09-09 16:57 UTC (permalink / raw)
To: Tom de Vries, gdb-patches
Andrew Burgess <aburgess@redhat.com> writes:
> Tom de Vries <tdevries@suse.de> writes:
>
>> On 9/8/24 22:38, Andrew Burgess wrote:
>>> Tom de Vries <tdevries@suse.de> writes:
>>>
>>>> On a system with python 3.6, module gdb.missing_debug imports module curses,
>>>> so when running test-case gdb.python/py-missing-debug.exp on a system without
>>>> that module installed, we run into:
>>>> ...
>>>> (gdb) source py-missing-debug.py^M
>>>> Python Exception <class 'ImportError'>: Module 'curses' is not installed.^M
>>>> Use:^M
>>>> sudo zypper install python36-curses^M
>>>> to install it.^M
>>>> Error occurred in Python: Module 'curses' is not installed.^M
>>>> Use:^M
>>>> sudo zypper install python36-curses^M
>>>> to install it.^M
>>>> (gdb) FAIL: gdb.python/py-missing-debug.exp: source python script
>>>
>>
>> Hi Andrew,
>>
>>> Do you know where the curses include is coming from?
>>>
>>
>> Yes, from gdb/python/lib/gdb/missing_debug.py:
>> ...
>> if sys.version_info >= (3, 7):
>> # Functions str.isascii() and str.isalnum are available starting Python
>> # 3.7.
>> def isascii(ch):
>> return ch.isascii()
>>
>> def isalnum(ch):
>> return ch.isalnum()
>>
>> else:
>> # Fall back to curses.ascii.isascii() and curses.ascii.isalnum() for
>> # earlier versions.
>> from curses.ascii import isalnum, isascii
>> ...
>
> Thanks for explaining this. I wonder if there's a way we could avoid
> that dependency... I'll have a think about that one.
I posted:
https://inbox.sourceware.org/gdb-patches/7c515b37e2bf7ca319e76ebcbd3b16137d8919c3.1725900938.git.aburgess@redhat.com/T/#u
Thanks,
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-09-09 16:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-07 3:37 [PATCH] [gdb/testsuite] Handle missing curses in gdb.python/py-missing-debug.exp Tom de Vries
2024-09-07 18:09 ` Kevin Buettner
2024-09-08 20:38 ` Andrew Burgess
2024-09-09 2:33 ` Tom de Vries
2024-09-09 14:19 ` Andrew Burgess
2024-09-09 16:57 ` Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox