commit:     6b049d6c5c65706a11c321f7a73ba02cddba6d5e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 21:19:55 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 24 21:19:55 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b049d6c

sys-apps/pciutils: add regex for LD version to be safe

To avoid ver_cut dying if something odd gets in there.

Bug: https://bugs.gentoo.org/847133
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/pciutils/pciutils-3.8.0.ebuild | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys-apps/pciutils/pciutils-3.8.0.ebuild 
b/sys-apps/pciutils/pciutils-3.8.0.ebuild
index 9cc012fc6893..e92c695e88d3 100644
--- a/sys-apps/pciutils/pciutils-3.8.0.ebuild
+++ b/sys-apps/pciutils/pciutils-3.8.0.ebuild
@@ -58,6 +58,13 @@ check_binutils_version() {
                # 2.38
                # ```
                local ver=$($(tc-getLD) --version 2>&1 | head -1 | rev | cut 
-d' ' -f1 | rev)
+
+               if ! [[ ${ver} =~ [0-9].[0-9][0-9] ]] ; then
+                       # Skip if unrecognised format so we don't pass something
+                       # odd into ver_cut.
+                       return
+               fi
+
                ver_major=$(ver_cut 1 "${ver}")
                ver_minor=$(ver_cut 2 "${ver}")
 

Reply via email to