linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf_doc: Fix build error with older python versions
@ 2023-01-06 11:40 Michal Suchanek
  2023-01-06 12:11 ` Quentin Monnet
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Suchanek @ 2023-01-06 11:40 UTC (permalink / raw)
  Cc: Michal Suchanek, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Quentin Monnet, Toke Høiland-Jørgensen,
	open list:BPF [GENERAL] (Safe Dynamic Programs and Tools),
	open list

+ make -j48 -s -C /dev/shm/kbuild/linux.33946/current ARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
TypeError: '_sre.SRE_Match' object is not subscriptable

Fixes: 8a76145a2ec2 ("bpf: explicitly define BPF_FUNC_xxx integer values")

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 scripts/bpf_doc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
index e8d90829f23e..38d51e05c7a2 100755
--- a/scripts/bpf_doc.py
+++ b/scripts/bpf_doc.py
@@ -271,7 +271,7 @@ class HeaderParser(object):
             if capture:
                 fn_defines_str += self.line
                 helper_name = capture.expand(r'bpf_\1')
-                self.helper_enum_vals[helper_name] = int(capture[2])
+                self.helper_enum_vals[helper_name] = int(capture.group(2))
                 self.helper_enum_pos[helper_name] = i
                 i += 1
             else:
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf_doc: Fix build error with older python versions
  2023-01-06 11:40 [PATCH] bpf_doc: Fix build error with older python versions Michal Suchanek
@ 2023-01-06 12:11 ` Quentin Monnet
  2023-01-06 22:11   ` Daniel Borkmann
  0 siblings, 1 reply; 5+ messages in thread
From: Quentin Monnet @ 2023-01-06 12:11 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Toke Høiland-Jørgensen,
	open list:BPF [GENERAL] (Safe Dynamic Programs and Tools),
	open list

2023-01-06 12:40 UTC+0100 ~ Michal Suchanek <msuchanek@suse.de>
> + make -j48 -s -C /dev/shm/kbuild/linux.33946/current ARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
> TypeError: '_sre.SRE_Match' object is not subscriptable
> 
> Fixes: 8a76145a2ec2 ("bpf: explicitly define BPF_FUNC_xxx integer values")
> 
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  scripts/bpf_doc.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
> index e8d90829f23e..38d51e05c7a2 100755
> --- a/scripts/bpf_doc.py
> +++ b/scripts/bpf_doc.py
> @@ -271,7 +271,7 @@ class HeaderParser(object):
>              if capture:
>                  fn_defines_str += self.line
>                  helper_name = capture.expand(r'bpf_\1')
> -                self.helper_enum_vals[helper_name] = int(capture[2])
> +                self.helper_enum_vals[helper_name] = int(capture.group(2))
>                  self.helper_enum_pos[helper_name] = i
>                  i += 1
>              else:

Thanks, the change looks good.

Acked-by: Quentin Monnet <quentin@isovalent.com>

Would be nice to have a bit more context in the commit log: As I
understand, Match objects have been scriptable since Python 3.6 (2016).

Reference: https://docs.python.org/3/whatsnew/3.6.html#re

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf_doc: Fix build error with older python versions
  2023-01-06 12:11 ` Quentin Monnet
@ 2023-01-06 22:11   ` Daniel Borkmann
  2023-01-09 11:34     ` Michal Suchanek
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Borkmann @ 2023-01-06 22:11 UTC (permalink / raw)
  To: Quentin Monnet, Michal Suchanek
  Cc: Alexei Starovoitov, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Toke Høiland-Jørgensen,
	open list:BPF [GENERAL] (Safe Dynamic Programs and Tools),
	open list

On 1/6/23 1:11 PM, Quentin Monnet wrote:
> 2023-01-06 12:40 UTC+0100 ~ Michal Suchanek <msuchanek@suse.de>
>> + make -j48 -s -C /dev/shm/kbuild/linux.33946/current ARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
>> TypeError: '_sre.SRE_Match' object is not subscriptable
>>
>> Fixes: 8a76145a2ec2 ("bpf: explicitly define BPF_FUNC_xxx integer values")
>>
>> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
>> ---
>>   scripts/bpf_doc.py | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
>> index e8d90829f23e..38d51e05c7a2 100755
>> --- a/scripts/bpf_doc.py
>> +++ b/scripts/bpf_doc.py
>> @@ -271,7 +271,7 @@ class HeaderParser(object):
>>               if capture:
>>                   fn_defines_str += self.line
>>                   helper_name = capture.expand(r'bpf_\1')
>> -                self.helper_enum_vals[helper_name] = int(capture[2])
>> +                self.helper_enum_vals[helper_name] = int(capture.group(2))
>>                   self.helper_enum_pos[helper_name] = i
>>                   i += 1
>>               else:
> 
> Thanks, the change looks good.
> 
> Acked-by: Quentin Monnet <quentin@isovalent.com>
> 
> Would be nice to have a bit more context in the commit log: As I
> understand, Match objects have been scriptable since Python 3.6 (2016).
> 
> Reference: https://docs.python.org/3/whatsnew/3.6.html#re

Agree, Michal, could you improve the commit description as it's a bit terse
as-is and then resubmit your patch.

Thanks,
Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] bpf_doc: Fix build error with older python versions
  2023-01-06 22:11   ` Daniel Borkmann
@ 2023-01-09 11:34     ` Michal Suchanek
  2023-01-12  1:10       ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Suchanek @ 2023-01-09 11:34 UTC (permalink / raw)
  Cc: Michal Suchanek, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Toke Høiland-Jørgensen, Quentin Monnet,
	open list:BPF [GENERAL] (Safe Dynamic Programs and Tools),
	open list

The ability to subscript match result as an array is only available
since python 3.6. Existing code in bpf_doc uses the older group()
interface but commit 8a76145a2ec2 adds code using the new interface.

Use the old interface consistently to avoid build error on older
distributions like the below:

+ make -j48 -s -C /dev/shm/kbuild/linux.33946/current ARCH=powerpc HOSTCC=gcc CROSS_COMPILE=powerpc64-suse-linux- clean
TypeError: '_sre.SRE_Match' object is not subscriptable

Fixes: 8a76145a2ec2 ("bpf: explicitly define BPF_FUNC_xxx integer values")

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Acked-by: Quentin Monnet <quentin@isovalent.com>
---
v2: Add more details to commit message
---
 scripts/bpf_doc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
index e8d90829f23e..38d51e05c7a2 100755
--- a/scripts/bpf_doc.py
+++ b/scripts/bpf_doc.py
@@ -271,7 +271,7 @@ class HeaderParser(object):
             if capture:
                 fn_defines_str += self.line
                 helper_name = capture.expand(r'bpf_\1')
-                self.helper_enum_vals[helper_name] = int(capture[2])
+                self.helper_enum_vals[helper_name] = int(capture.group(2))
                 self.helper_enum_pos[helper_name] = i
                 i += 1
             else:
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf_doc: Fix build error with older python versions
  2023-01-09 11:34     ` Michal Suchanek
@ 2023-01-12  1:10       ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-12  1:10 UTC (permalink / raw)
  To: Michal Suchanek
  Cc: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, toke, quentin, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Mon,  9 Jan 2023 12:34:42 +0100 you wrote:
> The ability to subscript match result as an array is only available
> since python 3.6. Existing code in bpf_doc uses the older group()
> interface but commit 8a76145a2ec2 adds code using the new interface.
> 
> Use the old interface consistently to avoid build error on older
> distributions like the below:
> 
> [...]

Here is the summary with links:
  - bpf_doc: Fix build error with older python versions
    https://git.kernel.org/bpf/bpf-next/c/5fbea42387eb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-12  1:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 11:40 [PATCH] bpf_doc: Fix build error with older python versions Michal Suchanek
2023-01-06 12:11 ` Quentin Monnet
2023-01-06 22:11   ` Daniel Borkmann
2023-01-09 11:34     ` Michal Suchanek
2023-01-12  1:10       ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).