Bug 468440
| Summary: | atexit() hooks are not called on exec() | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Andrew Zabolotny <anpaza> |
| Component: | man-pages | Assignee: | Ivana Varekova <varekova> |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 9 | CC: | jakub, varekova |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2008-10-30 08:50:26 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
I tried on a micro linux-from-scratch variant I have running here in a virtual machine, and the bug is still there, so it's really a upstream bug. I have copied the report to the bugzilla recommended on glibc homepage, and added a link to that bugzilla. I was told by Ulrich Drepper that this is behaviour is conformant to standards. I found in the "The Open Group Base Specifications issue 6" the page related to exec() here: http://www.opengroup.org/onlinepubs/000095399/functions/exec.html The only quote mentioning atexit is: <<After a successful call to any of the exec functions, any functions previously registered by atexit() or pthread_atfork() are no longer registered.>> This is somehow vague, but anyway I think this can be re-classified as a bug in the man page. FreeBSD and Solaris man pages just repeat the same quote from standard. Changing target package to man-pages-2.78-2.fc9.noarch. The description details from which results the fact - the atexit stuff is not called before the execl call starts - are on execve page (there is link from execl page): "All process attributes are preserved during an execve(), except the following: .. * Exit handlers are not preserved (atexit(3), on_exit(3)). .. " It seems for me to be sufficient info so I think there is no need to add another notice about it. Indeed, there's a note on execve() page. I do not insist, but I think it would be helpful to note this on exec page as well. And even emphasize that the handlers are not called, not just "not preserved". Maybe I don't understand it well, but "handlers are not preserved" and "handlers are not called and not preserved" sound a bit different to me. Anyway, this bug can be closed I think. |
Description of problem: "man 3 exit" says, amongst other: ... The exit() function causes normal process termination and the value of status & 0377 is returned to the parent (see wait(2)). All functions registered with atexit(3) and on_exit(3) are called, in the reverse order of their registration. ... However, the atexit() hooks are never called if you invoke any of the exec*() functions. Version-Release number of selected component (if applicable): glibc-2.8-8.x86_64 How reproducible: Always Steps to Reproduce: 1. Copy the example from 'man 3 atexit' to test.c 2. Modify it so that instead of "exit(EXIT_SUCCESS)" at the end we have, for example: execl ("/bin/ls", "ls"); 3. Compile and run the example Actual results: $ ./a.out ATEXIT_MAX = 2147483647 a.out test.c Expected results: $ ./a.out ATEXIT_MAX = 2147483647 That was all, folks a.out test.c Additional info: I think it is a serious bug as it does not allow applications that rely on it to cleanup things that won't automatically cleanup during a normal process destruction.