Opened 13 years ago
Last modified 8 years ago
#1598 new defect
Exit call in some libs
Reported by: | volter | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 6.4.6 |
Component: | Default | Version: | 6.4.2 |
Keywords: | shared lib | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
Some of the Grass libraries call exit. Probably you can do something about it!
rpmlint -I shared-lib-calls-exit shared-lib-calls-exit: This library package calls exit() or _exit(), probably in a non-fork() context. Doing so from a library is strongly discouraged - when a library function calls exit(), it prevents the calling program from handling the error, reporting it to the user, closing files properly, and cleaning up any state that the program has. It is preferred for the library to return an actual error code and let the calling program decide how to handle the situation.
grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_linkm.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_edit.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_sim.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_dig2.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_raster.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_interpdata.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_dbmidriver.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_display.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_sqlp.so.6.4.2 exit@GLIBC_2.2.5 grass-libs.x86_64: W: shared-lib-calls-exit /usr/lib64/libgrass_cdhc.so.6.4.2 exit@GLIBC_2.2.5
Replying to volter:
The standard error-handling mechanism in GRASS is to call G_fatal_error(), which calls exit(). Most other libraries probably shouldn't be calling exit() directly, but should be calling G_fatal_error() instead.
FWIW, the list of library files which call exit() directly is:
plus most of the CDHC library.
libgrass_sqlp's exit() is from yy_fatal_error(), which is part of the lex boilerplate. If desired, error handling can be customised by defining the macro YY_FATAL_ERROR.
Some of the above are legitimate, others may indicate code which should be calling G_fatal_error() instead.
lib/vector/diglib/allocation.c uses G_calloc(), so it doesn't need to perform its own error handling (although digfrealloc() should just use G_realloc()).
The other cases should be examined, but most of these are invalid/wontfix.