* [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups)
@ 2022-08-21 8:41 Yann E. MORIN
2022-08-21 8:41 ` [Buildroot] [PATCH 1/2] utils/genrandconfig: fix checking host glibc version Yann E. MORIN
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yann E. MORIN @ 2022-08-21 8:41 UTC (permalink / raw)
To: buildroot; +Cc: Yann E . MORIN
Hello All!
This two-patch series does what it says on the tin, and ensures such
issues are easier to debug in the future.
Regards,
Yann E. MORIN.
----------------------------------------------------------------
Yann E. MORIN (2):
utils/genrandconfig: fix checking host glibc version
utils/genrandconfig: dump traceback for unhandled exceptions
utils/genrandconfig | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/2] utils/genrandconfig: fix checking host glibc version
2022-08-21 8:41 [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) Yann E. MORIN
@ 2022-08-21 8:41 ` Yann E. MORIN
2022-09-17 11:06 ` Peter Korsgaard
2022-08-21 8:41 ` [Buildroot] [PATCH 2/2] utils/genrandconfig: dump traceback for unhandled exceptions Yann E. MORIN
2022-08-23 20:20 ` [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) Thomas Petazzoni via buildroot
2 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2022-08-21 8:41 UTC (permalink / raw)
To: buildroot; +Cc: Yann E. MORIN
Unless explicitly told otherwise, subprocess.check_output() returns
bytes objects [0].
When we try to check the C library version (to check the Linaro
toolchain is usable), genrandconfig currently fails with:
TypeError: cannot use a string pattern on a bytes-like object
So, as suggested in the python documentation, decocde() the output of
subprocess.check_output() before we can use it.
[0] https://docs.python.org/3/library/subprocess.html#subprocess.check_output
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
utils/genrandconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/genrandconfig b/utils/genrandconfig
index c6b3123feb..21d4592049 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -181,7 +181,7 @@ def is_toolchain_usable(configfile, config):
'BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64_BE=y\n' in configlines or \
'BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB=y\n' in configlines:
ldd_version_output = subprocess.check_output(['ldd', '--version'])
- glibc_version = ldd_version_output.splitlines()[0].split()[-1]
+ glibc_version = ldd_version_output.decode().splitlines()[0].split()[-1]
if StrictVersion('2.14') > StrictVersion(glibc_version):
print("WARN: ignoring the Linaro ARM toolchains because too old host glibc", file=sys.stderr)
return False
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 2/2] utils/genrandconfig: dump traceback for unhandled exceptions
2022-08-21 8:41 [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) Yann E. MORIN
2022-08-21 8:41 ` [Buildroot] [PATCH 1/2] utils/genrandconfig: fix checking host glibc version Yann E. MORIN
@ 2022-08-21 8:41 ` Yann E. MORIN
2022-09-17 11:06 ` Peter Korsgaard
2022-08-23 20:20 ` [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) Thomas Petazzoni via buildroot
2 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2022-08-21 8:41 UTC (permalink / raw)
To: buildroot; +Cc: Yann E. MORIN
In case of an unexpected error, we currently only print the exception as
an str(). For example, the recent issue with the glibc version check
only reported:
TypeError: cannot use a string pattern on a bytes-like object
That does not help in fixing the issue; the exception text is also not
usually very user-friendly either anyway.
We change the reporting to print the traceback, which in the glibc
version check mentioned above, the error is reported as:
Traceback (most recent call last):
File "./utils/genrandconfig", line 740, in <module>
ret = gen_config(args)
File "./utils/genrandconfig", line 676, in gen_config
if not is_toolchain_usable(configfile, toolchainconfig):
File "./utils/genrandconfig", line 186, in is_toolchain_usable
if StrictVersion('2.14') > StrictVersion(glibc_version):
File "/usr/lib/python3.8/distutils/version.py", line 40, in __init__
self.parse(vstring)
File "/usr/lib/python3.8/distutils/version.py", line 135, in parse
match = self.version_re.match(vstring)
TypeError: cannot use a string pattern on a bytes-like object
With this, the error is much easier to pinpoint (it's the last one that
is not in a system module).
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
utils/genrandconfig | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/utils/genrandconfig b/utils/genrandconfig
index 21d4592049..4c00d67691 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -25,6 +25,7 @@ import os
from random import randint
import subprocess
import sys
+import traceback
from distutils.version import StrictVersion
import platform
@@ -737,7 +738,7 @@ if __name__ == '__main__':
try:
ret = gen_config(args)
- except Exception as e:
- print(str(e), file=sys.stderr)
+ except Exception:
+ traceback.print_exc()
parser.exit(1)
parser.exit(ret)
--
2.25.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups)
2022-08-21 8:41 [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) Yann E. MORIN
2022-08-21 8:41 ` [Buildroot] [PATCH 1/2] utils/genrandconfig: fix checking host glibc version Yann E. MORIN
2022-08-21 8:41 ` [Buildroot] [PATCH 2/2] utils/genrandconfig: dump traceback for unhandled exceptions Yann E. MORIN
@ 2022-08-23 20:20 ` Thomas Petazzoni via buildroot
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-08-23 20:20 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: Peter Korsgaard, buildroot
On Sun, 21 Aug 2022 10:41:25 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> utils/genrandconfig: fix checking host glibc version
> utils/genrandconfig: dump traceback for unhandled exceptions
Both applied to master, thanks!
Peter: these commits should go in 2022.02.x and 2022.05.x. Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH 1/2] utils/genrandconfig: fix checking host glibc version
2022-08-21 8:41 ` [Buildroot] [PATCH 1/2] utils/genrandconfig: fix checking host glibc version Yann E. MORIN
@ 2022-09-17 11:06 ` Peter Korsgaard
0 siblings, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2022-09-17 11:06 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> Unless explicitly told otherwise, subprocess.check_output() returns
> bytes objects [0].
> When we try to check the C library version (to check the Linaro
> toolchain is usable), genrandconfig currently fails with:
> TypeError: cannot use a string pattern on a bytes-like object
> So, as suggested in the python documentation, decocde() the output of
> subprocess.check_output() before we can use it.
> [0] https://docs.python.org/3/library/subprocess.html#subprocess.check_output
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Committed to 2022.05.x and 2022.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH 2/2] utils/genrandconfig: dump traceback for unhandled exceptions
2022-08-21 8:41 ` [Buildroot] [PATCH 2/2] utils/genrandconfig: dump traceback for unhandled exceptions Yann E. MORIN
@ 2022-09-17 11:06 ` Peter Korsgaard
0 siblings, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2022-09-17 11:06 UTC (permalink / raw)
To: Yann E. MORIN; +Cc: buildroot
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
> In case of an unexpected error, we currently only print the exception as
> an str(). For example, the recent issue with the glibc version check
> only reported:
> TypeError: cannot use a string pattern on a bytes-like object
> That does not help in fixing the issue; the exception text is also not
> usually very user-friendly either anyway.
> We change the reporting to print the traceback, which in the glibc
> version check mentioned above, the error is reported as:
> Traceback (most recent call last):
> File "./utils/genrandconfig", line 740, in <module>
> ret = gen_config(args)
> File "./utils/genrandconfig", line 676, in gen_config
> if not is_toolchain_usable(configfile, toolchainconfig):
> File "./utils/genrandconfig", line 186, in is_toolchain_usable
> if StrictVersion('2.14') > StrictVersion(glibc_version):
> File "/usr/lib/python3.8/distutils/version.py", line 40, in __init__
> self.parse(vstring)
> File "/usr/lib/python3.8/distutils/version.py", line 135, in parse
> match = self.version_re.match(vstring)
> TypeError: cannot use a string pattern on a bytes-like object
> With this, the error is much easier to pinpoint (it's the last one that
> is not in a system module).
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Committed to 2022.05.x and 2022.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-17 11:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-21 8:41 [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) Yann E. MORIN
2022-08-21 8:41 ` [Buildroot] [PATCH 1/2] utils/genrandconfig: fix checking host glibc version Yann E. MORIN
2022-09-17 11:06 ` Peter Korsgaard
2022-08-21 8:41 ` [Buildroot] [PATCH 2/2] utils/genrandconfig: dump traceback for unhandled exceptions Yann E. MORIN
2022-09-17 11:06 ` Peter Korsgaard
2022-08-23 20:20 ` [Buildroot] [PATCH 0/2] utils/genrandconfig: fix host-glibc version check (branch yem/gerandconfig-fixups) Thomas Petazzoni via buildroot
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.