Package: smbios-utils

Any dependency in the smbios-tools python scripts on 
/usr/lib/python3/dist-packages/libsmbios_c/smbios_token.py imporperly raises a 
StopIteration exception with newer versions of Python 3 and terminates.

# smbios-token-ctl -d
================================================================================
  Token: 0x0005 - Serial Port 1 (COM2)
  value: bool = false
   Desc: Configure the system's first/only built-in serial port to respond as CO
         M2.
...
...
...
================================================================================
  Token: 0xf654 - unknown (unknown)
  value: bool = false
   Desc: unknown
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/libsmbios_c/smbios_token.py", line 134, 
in __iter__
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/sbin/smbios-token-ctl", line 475, in <module>
    sys.exit( main() )
              ^^^^^^
  File "/usr/sbin/smbios-token-ctl", line 380, in main
    dumpTokens(tokenTable, tokenXlator, options)
  File "/usr/sbin/smbios-token-ctl", line 214, in dumpTokens
    for token in tokenTable:
RuntimeError: generator raised StopIteration


This patch corrects the problem, allowing iterations to continue as expected:

--- smbios_token.py     2023-03-27 13:47:02.135215225 -0400
+++ smbios_token.py.new 2023-03-27 13:47:32.275214757 -0400
@@ -129,9 +129,12 @@
         while 1:
             cur =DLL.token_table_get_next( self._tableobj, cur )
             if bool(cur):
-                yield cur.contents
+                try:
+                    yield cur.contents
+                except StopIteration:
+                    return
             else:
-                raise StopIteration
+                return

     @traceLog()
     def __getitem__(self, id):


I am running Debian Bookworm

# uname -a
Linux lt3107-1 6.1.0-6-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.15-1 
(2023-03-05) x86_64 GNU/Linux



--


Robert Mavrinac

Systems Analyst

School of Computer Science

Room 3103B Lambton Tower

University of Windsor

401 Sunset Avenue, Windsor, ON N9B 3P4

519-253-3000 (4410)

Email: mavri...@uwindsor.ca<mailto:mavri...@uwindsor.ca>

Reply via email to