
Hi,
While at this subject:
If the PATH is not configured correctly, almost all imports fail and the program crashes/segfualts. The user has no hint of what went wrong.
I think that in this case the program should report an error: "import module [module-name] not found" and exit gracefully.
A more user friendly and helpful way to indicate the problem and let the user a chance to fix his/her PATH configuration.
Please let me know what you think.
Thanks,
Yigal
---- Arndt Jonasson arndt@tail-f.com wrote:
In the error reporting function printError in error.c is this code:
if ((errors[i].level <= smiHandle->errorLevel) && (parser->flags & SMI_FLAG_ERRORS) && ((smiDepth == 1) || (parser->flags & SMI_FLAG_RECURSIVE))) { smiVasprintf(&buffer, errors[i].fmt, ap); (smiHandle->errorHandler) (parser->path, line, errors[i].level, buffer, errors[i].tag); }
The test for smiDepth means that when a module A imports from another module B, errors while reading B are not reported. This may be reasonable for harmless warnings, but if then B imports from a third module C, and this module C isn't found, everything fails, probably with a segmentation violation, and the user gets no indication of why.
I think the test (smiDepth == 1)
should be replaced with (smiDepth == 1 || errors[i].level <= 2) -- !! This message is brought to you via the `libsmi' mailing list. !! Please do not reply to this message to unsubscribe. To unsubscribe or adjust !! your settings, send a mail message to libsmi-request@ibr.cs.tu-bs.de !! or look at https://mail.ibr.cs.tu-bs.de/mailman/listinfo/libsmi.