| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:from:subject:to:message-id:date:mime-version | |
| :content-type; q=dns; s=default; b=um+CE7T+At+3XBLp5JsnwzSPsREIv | |
| NtXwuP9o6rd7CuSdDsiJELBxSh8i7g1pB2JrvnkQ1jS7VqbO7rcmxNaBurqizYUz | |
| Okd6KpWI24b4v22OEIDzTGVmG4imforvsvwfsXsbX9EpIB8eQe986C9ThmQ9WJHP | |
| 9NiSvKGu7pPoeU= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:from:subject:to:message-id:date:mime-version | |
| :content-type; s=default; bh=M/BE+StcnC0n4PnuhYOARj6Ee9Y=; b=tf1 | |
| rYuVgIpQs8+fr8KuTbYHpPZmJBHSpnhp0OsbeCkfjIQdmaXRiSZsasuHFzsvsxQk | |
| WrO7UkJ8SuB+Eb5jXnGatsEc2l7F8+w52ga5h8awOl4xFSqxs64b9RQd+ipyxDFG | |
| dnj0bd0DUw+rwgHFW/ZmDn5obc9yFoFNLo3VgMu0= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Spam-SWARE-Status: | No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=work-around, wextra, Wextra, inspired |
| X-HELO: | rila.superhosting.bg |
| From: | Roumen Petrov <bugtrack AT roumenpetrov DOT info> |
| Subject: | program exit code, "at exit" handler and explicit close of shared objects |
| To: | cygwin AT cygwin DOT com |
| Message-ID: | <a24efbf6-872e-1e5b-017a-b14c59d84550@roumenpetrov.info> |
| Date: | Sat, 26 Oct 2019 18:07:11 +0300 |
| User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.5 |
| MIME-Version: | 1.0 |
| X-OutGoing-Spam-Status: | No, score=-0.2 |
| X-IsSubscribed: | yes |
--------------C739CC2AFC9CAC34FBE7FDF6
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
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
--------------C739CC2AFC9CAC34FBE7FDF6
Content-Type: text/x-csrc;
name="test-dlclose.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="test-dlclose.c"
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
void *handle = NULL;
#if 0
# define DLCLOSE_ATEXIT 1
#endif
#ifdef DLCLOSE_ATEXIT
static void
dlclose_atexit(void) {
if (dlclose(handle) != 0) {
fprintf(stderr, "dlclose fail : %s\n", dlerror());
}
}
#endif
int
main() {
handle = dlopen("libz.so", RTLD_LAZY | RTLD_NOW);
if (handle == NULL) {
fprintf(stderr, "dlopen fail : %s\n", dlerror());
return 1;
}
#ifndef DLCLOSE_ATEXIT
if (dlclose(handle) != 0) {
fprintf(stderr, "dlclose fail : %s\n", dlerror());
return 2;
}
#else
if (atexit(dlclose_atexit) != 0) {
fprintf(stderr, "atexit fail\n");
return 3;
}
#endif
printf("exit with code 33\n");
return 33;
}
--------------C739CC2AFC9CAC34FBE7FDF6
Content-Type: text/plain; charset=UTF-8;
name="Makefile"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Makefile"
Q0ZMQUdTID0gLWcgLVdhbGwgLVdleHRyYQoKYWxsOiB0ZXN0LWRsY2xvc2UK
CS0uL3Rlc3QtZGxjbG9zZQo=
--------------C739CC2AFC9CAC34FBE7FDF6
Content-Type: text/plain; charset=us-ascii
--
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
--------------C739CC2AFC9CAC34FBE7FDF6--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |