Closed HuO50 closed 2 years ago
Hi, Zhongze Thank you for the fix. As we discussed offline, I will merge it into the devel branch: smbios-3.3.0. And then we will test all changes, once the devel branch is ready, we can switch to the master branch. Thanks.
Hi, Zhongze Can you check it again? I got the following compilation errors: $ sudo make python3.10 src/setup.py build /home/lijiang/src/python-dmidecode/src/setup.py:29: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.core import setup, Extension running build running build_py running build_ext building 'dmidecodemod' extension gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -UNDEBUG -I/usr/include/libxml2 -I/usr/include/python3.10 -c src/dmidecode.c -o build/temp.linux-x86_64-3.10/src/dmidecode.o src/dmidecode.c: In function ‘dmi_additional_info’: src/dmidecode.c:3907:42: warning: variable ‘str_n’ set but not used [-Wunused-but-set-variable] 3907 | xmlNode data_n = NULL, str_n = NULL, *val_n = NULL; | ^~~~~ gcc -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -UNDEBUG -I/usr/include/libxml2 -I/usr/include/python3.10 -c src/dmidecodemodule.c -o build/temp.linux-x86_64-3.10/src/dmidecodemodule.o In file included from src/dmidecodemodule.c:47: src/dmidecodemodule.h:71:12: error: conflicting types for ‘smbios_decode’; have ‘int(Log_t , int, u8 , const char , u32, xmlNode )’ {aka ‘int(struct _Log_t , int, unsigned char , const char , unsigned int, struct _xmlNode )’} 71 | extern int smbios_decode(Log_t logp, int type, u8 buf, const char devmem, u32 flags, xmlNode node); | ^ |
int smbios_decode(Log_t logp, int type, u8 buf, const char devmem, xmlNode xmlnode); | ^ |
extern int legacy_decode(Log_t logp, int type, u8 buf, const char devmem, u32 flags, xmlNode node); | ^ |
int legacy_decode(Log_t logp, int type, u8 buf, const char devmem, xmlNode xmlnode); | ^ |
opt->devmem = SYS_TABLE_FILE; | ^ |
opt->devmem = SYS_TABLE_FILE; | ^ |
ver_n = smbios3_decode_get_version(buf, opt->dumpfile); | ^ |
smbios_decode_get_version src/dmidecodemodule.c:164:31: warning: assignment to ‘xmlNode ’ {aka ‘struct _xmlNode ’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 164 | ver_n = smbios3_decode_get_version(buf, opt->dumpfile); | ^ src/dmidecodemodule.c:195:54: error: ‘SYS_ENTRY_FILE’ undeclared (first use in this function) 195 | if ((buf = read_file(opt->logdata, 0, &size, SYS_ENTRY_FILE)) != NULL) | ^ |
ver_n = smbios3_decode_get_version(buf, opt->devmem); | ^ src/dmidecodemodule.c:235:17: warning: assignment to ‘u8 ’ {aka ‘unsigned char ’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 235 | if (buf = mem_chunk(opt->logdata, fp, 0x20, opt->devmem) == NULL) | ^ src/dmidecodemodule.c:235:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 235 | if (buf = mem_chunk(opt->logdata, fp, 0x20, opt->devmem) == NULL) | ^~~ src/dmidecodemodule.c:243:23: warning: assignment to ‘xmlNode ’ {aka ‘struct _xmlNode ’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 243 | ver_n = smbios3_decode_get_version(buf, opt->devmem); | ^ src/dmidecodemodule.c:270:31: warning: assignment to ‘xmlNode ’ {aka ‘struct _xmlNode ’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion] 270 | ver_n = smbios3_decode_get_version(buf + fp, opt->devmem); | ^ src/dmidecodemodule.c: In function ‘dmidecode_get_xml’: src/dmidecodemodule.c:352:29: warning: implicit declaration of function ‘smbios3_decode’; did you mean ‘smbios_decode’? [-Wimplicit-function-declaration] 352 | if (smbios3_decode(opt->logdata, opt->type, buf, opt->dumpfile, 0, dmixml_n)) | ^ |
smbios_decode src/dmidecodemodule.c:375:54: error: ‘SYS_ENTRY_FILE’ undeclared (first use in this function) 375 | if ((buf = read_file(opt->logdata, 0, &size, SYS_ENTRY_FILE)) != NULL) | ^ |
if (smbios3_decode(opt->logdata, opt->type, buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET, dmixml_n)) | ^ |
if (smbios3_decode(opt->logdata, opt->type, buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET, dmixml_n)) | ^ |
if (buf = mem_chunk(opt->logdata, fp, 0x20, opt->devmem) == NULL) | ^ src/dmidecodemodule.c:412:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 412 | if (buf = mem_chunk(opt->logdata, fp, 0x20, opt->devmem) == NULL) | ^~~ src/dmidecodemodule.c: In function ‘__dmidecode_xml_getsection’: src/dmidecodemodule.c:569:90: warning: passing argument 3 of ‘_pyReturnError’ makes integer from pointer without a cast [-Wint-conversion] 569 | _pyReturnError(PyExc_RuntimeError, "Invalid type id '%s' -- %s", typeid, err); | ^ |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
char * |
In file included from src/dmidecode.h:24: src/dmierror.h:38:65: note: expected ‘int’ but argument is of type ‘char *’ 38 | void _pyReturnError(PyObject exception, const char fname, int line, const char *msgfmt, ...); | opt->devmem = SYS_TABLE_FILE; | ^ |
opt->devmem = SYS_TABLE_FILE; | ^ |
section = PyUnicode_AsUTF8(args); | ^ src/dmidecodemodule.c: In function ‘dmidecode_dump’: src/dmidecodemodule.c:893:26: error: ‘SYS_TABLE_FILE’ undeclared (first use in this function) 893 | if (dump(SYS_TABLE_FILE, f)) | ^ |
int ret; | ^~~ src/dmidecodemodule.c: In function ‘dmidecode_set_dev’: src/dmidecodemodule.c:916:19: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 916 | f = PyUnicode_AsUTF8(arg); | ^ src/dmidecodemodule.c: In function ‘dmidecode_set_pythonxmlmap’: src/dmidecodemodule.c:978:23: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 978 | fname = PyUnicode_AsUTF8(arg); | ^ src/dmidecodemodule.c: At top level: src/dmidecodemodule.c:1057:24: warning: initialization of ‘PyObject ()(PyObject , PyObject )’ {aka ‘struct _object ()(struct _object , struct _object )’} from incompatible pointer type ‘PyObject ()(PyObject , PyObject , PyObject )’ {aka ‘struct _object ()(struct _object , struct _object , struct _object )’} [-Wincompatible-pointer-types] 1057 | {(char *)"xmlapi", dmidecode_xmlapi, METH_VARARGS | METH_KEYWORDS, | ^ |
PyModule_AddObject(module, "options", PyCapsule_New(opt, NULL, destruct_options)); | ^ |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
void ()(void ) |
In file included from /usr/include/python3.10/Python.h:102,
from src/dmidecodemodule.c:42:
/usr/include/python3.10/pycapsule.h:31:26: note: expected ‘PyCapsule_Destructor’ {aka ‘void ()(struct _object )’} but argument is of type ‘void ()(void )’
31 | PyCapsule_Destructor destructor);
| ~~~~~^~~~~~
error: command '/usr/bin/gcc' failed with exit code 1
make: *** [Makefile:65: build/lib.linux-x86_64-3.10/dmidecodemod.cpython-310-x86_64-linux-gnu.so] Error 1
I have reverted the pull request from the devel branch: smbion-3.3.0. Thanks.
Sorry for committing wrong code! I will check the code again.
Default use /dev/mem dump dmidecode info. Add collecting info method from DMI instead /dev/mem. Issue address:https://github.com/nima/python-dmidecode/issues/15