program exit code, "at exit" handler and explicit close of shared objects
Roumen Petrov
bugtrack@roumenpetrov.info
Sat Oct 26 15:07:00 GMT 2019
Hello Cygwin developers,
This email is mainly for issue with exist code for a program.
It is inspired from openssl issue #10107 - "test_ssl_old freezes on
cygwin". Actually after one or another work-around "unfreeze" test and
this shows that one of subtests fail. This failure is main topic of this
email.
More about failed test "testing connection with weak DH, expecting
failure". So failure is expected and program code try to exit with 1.
Unfortunately OS returns zero exit code.
Since version 1.1 OpenSSL uses "at exit handler" to clean-up allocated
resources. Removing registered handler restores program exit code. So
something in handler triggers issue.
After additional tests (research) I was able to isolate issues to simple
test case. Please find attached "test-dlclose.c" and "Makefile".
First test is as is:
$ make
cc -g -Wall -Wextra test-dlclose.c -o test-dlclose
./test-dlclose
exit with code 33
make: [Makefile:4: all] Error 33 (ignored)
For next test change test-dlclose.c to define DLCLOSE_ATEXIT ( s/#if 0/#if 1/ ):
$ make
cc -g -Wall -Wextra test-dlclose.c -o test-dlclose
./test-dlclose
exit with code 33
As is visible make does not report error, i.e. program exit code is zero.
Is there a way to bypass issue?
For protocol:
$ uname -srvm -> CYGWIN_NT-10.0 3.0.7(0.338/5/3) 2019-04-30 18:08 x86_64
Regards,
Roumen Petrov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-dlclose.c
Type: text/x-csrc
Size: 701 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20191026/87de8787/attachment.bin>
-------------- next part --------------
CFLAGS = -g -Wall -Wextra
all: test-dlclose
-./test-dlclose
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list