Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared library calls exit #161

Closed
hobbes1069 opened this issue Nov 9, 2011 · 2 comments
Closed

Shared library calls exit #161

hobbes1069 opened this issue Nov 9, 2011 · 2 comments

Comments

@hobbes1069
Copy link

In packaging OCE for Fedora I ran into the following issue. I've got the packages building successfully now so I ran rpmlint on them, which if you're not familiar with it, checks a bunch of common packaging issues.

The following libraries appear to call exit which is a no-no for shared libraries:
$ rpmlint *.rpm | grep shared-lib-calls-exit
OCE-foundation.x86_64: W: shared-lib-calls-exit /usr/lib64/libTKAdvTools.so.1.0.0 exit@GLIBC_2.2.5
OCE-foundation.x86_64: W: shared-lib-calls-exit /usr/lib64/libTKernel.so.1.0.0 exit@GLIBC_2.2.5
OCE-visualization.x86_64: W: shared-lib-calls-exit /usr/lib64/libTKService.so.1.0.0 exit@GLIBC_2.2.5
OCE-visualization.x86_64: W: shared-lib-calls-exit /usr/lib64/libTKOpenGl.so.1.0.0 exit@GLIBC_2.2.5

rpmlint provides the following explination:
$ 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.

@ghost
Copy link

ghost commented Nov 24, 2015

@ghost ghost self-assigned this Nov 24, 2015
@ghost
Copy link

ghost commented Nov 24, 2015

Response from OCC:

The places where OCCT code calls exit() are:

  • Draw_BasicCommands.cxx: abort of the program if its execution time is over the defined limit (considered as hang up). This is necessary in tests to avoid blocking the process if some test hangs.
  • Draw_Window.cxx: exit if DRAW application cannot initialize.
  • lex.ExprIntrp.c and lex.step.c: exit() is part of the standard code generated by Flex scanner, not actually called from anywhere -- another error function is used instead.
  • OSD_File.cxx: exit() is inside piece of dead code, to be removed.
  • OSD_signal.cxx: exit() is called from signal handler in case when jumping did not succeeded. This can be improved by resetting handler to default and re-raising signal, as described in (I am not sure if this makes any real difference):
    http://www.gnu.org/software/libc/manual/html_node/Termination-in-Handler.html [^]
  • OSD_signal_WNT.cxx: exit() is called if the user selects to abort the program explicitly on the case of exception (special debug mode)
  • Standard_ErrorHandler.cxx: exit() is called in situation when no landing point can be found to return from signal handler... This is used only when NO_CXX_EXCEPTION is defined, which is obsolete (used in the past for old compilers not supporting C++ exceptions) and should be removed.

Thus I believe that all actual uses of exit() are legitime and necessary, though some code around can be revised and cleaned up. If you have some particular complaints or know situation when exit() is called not in appropriate situation, please explain this.

Unless we disagree, I think we can close this.

@ghost ghost added the Reported to OCCT label Dec 15, 2015
@ghost ghost closed this as completed Apr 23, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant