X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1566671105; bh=QmdeLQ5hLoQ82A7zMUH5/vtF0Nokh9Awrf5UqTMhmTc=; h=X-UI-Sender-Class:Date:From:To:Subject:References:In-Reply-To; b=jVPo3azCkMZv4I/f6gZzt1vjxgnPr7gmXVJ/Jz7Hw/hWBqtsANUOP4eK/3ROhYsQS Wccp8KmSrc5hkc/w7nH45qg68dzQInI3Fq3pJQIW82H9qOs0tdc7pJX4BCOmlcTXmt faNt54VDPVexDnUFo6uJ1FMiVEMGRV6SmgLyWz1E= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Message-ID: <5D618105.9020108@gmx.de> Date: Sat, 24 Aug 2019 20:25:09 +0200 From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.13) Gecko/20101206 SUSE/3.1.7 Thunderbird/3.1.7 MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: [PATCH] exec: fix inversions in leak detection logic References: <964e3268-2f75-ee73-ab5a-b01bf1aadb98 AT yandex DOT ru> <7209026e-1f1b-e590-00a3-4ed1a424cc0d AT yandex DOT ru> <83d0gzlxgq DOT fsf AT gnu DOT org> In-Reply-To: <83d0gzlxgq.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:2LCGWaAXezmk4++uX/NtSzHS6sjLgbTGAdkj7jIzYg+kP4G3QQC NwcxDWq8ERItx4rDvL++PQBplj84QCBS3YgZ0aTY9tuyy9HY6IUP5oxE6Ht2SnTuv45F22a jqLD3jynPerOMfxY8Tgkw6Mk88qpj33Ki0dd/we0eBB1WgPOn1bUFyLKRG0xQXGAxGX6cA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LHrR2sCr3O7Sa1VneCR8D5EDfMfX9dLpcQbA5lGx9od4OGtnyHB EatDdVPcVsR7kKmKkfurnRofNyUZlkZVkrg0lKyUlVlM6/WMMKdrWbonbEFP26MxQR7yHAXku YLynaOYCf9WDTlJxC0ivPxv0H5/3tGf0X4DRBgWVpN26BMFnhPDOD/O0AP6gMsIb816hIg8a/ CP0ZUgYFAmnYqS7vkoypM0EojU/YeJgXI/1OFkPVwBkLH5hA== Reply-To: djgpp AT delorie DOT com Am 20.08.2019 16:31, schrieb Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com]: >> From: Rod Pemberton >> Date: Tue, 20 Aug 2019 05:43:54 -0400 >> >> DOS and Windows are DJGPP's primary target environments. If the >> DJGPP code works properly for DOS and Windows consoles, there is no need >> to make it compatible with some other environment > > That is true, but OTOH there's no special need to refuse the change > up front. If the change doesn't cause any trouble to the CWSDPMI > based setup on DOS, and helps some other environment do something > useful, why should we refuse to make simple changes? I see no reason. I agree with this and thus it is time to bring this issue to an end. The proposed changes do not break a CWSDPMI based DJGPP setup on DOS thus I see no reason why the changes should not be accepted. If I do not get a proof until tomorrow that the patch below breaks something I will commit it. The patch has been out there for more than a week and that was more than enough time for all realy interested parties to evaluate/review it. Regards, Juan M. Guerrero * djgpp/include/process.h: make descriptor leak work-around conditional. Provided by Stas Sergeev (stsp2 AT yandex DOT ru). See http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp/2019/08/17/21:43:14 * djgpp/src/libc/dos/process/dosexec.c: make descriptor leak work-around conditional. Provided by Stas Sergeev (stsp2 AT yandex DOT ru). See http://www.delorie.com/djgpp/mail-archives/browse.cgi?p=djgpp/2019/08/17/21:43:14 diff -aprNU3 djgpp.orig/include/process.h djgpp/include/process.h --- djgpp.orig/include/process.h 2015-05-02 07:31:46 +0000 +++ djgpp/include/process.h 2019-08-24 19:41:06 +0000 @@ -52,6 +52,10 @@ int __djgpp_spawn(int _mode, const char #define SPAWN_EXTENSION_SRCH 1 #define SPAWN_NO_EXTENSION_SRCH 2 +#define __spawn_leak_workaround 0x0001 /* free descriptor leaks */ + +extern int __spawn_flags; + #endif /* !_POSIX_SOURCE */ #endif /* !__STRICT_ANSI__ */ #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ diff -aprNU3 djgpp.orig/src/libc/dos/process/dosexec.c djgpp/src/libc/dos/process/dosexec.c --- djgpp.orig/src/libc/dos/process/dosexec.c 2018-05-16 20:55:56 +0000 +++ djgpp/src/libc/dos/process/dosexec.c 2019-08-24 19:41:06 +0000 @@ -45,6 +45,7 @@ extern char **_environ; int __dosexec_in_system = 0; +int __spawn_flags = __spawn_leak_workaround; typedef struct { unsigned short eseg; @@ -492,7 +493,8 @@ static int direct_exec_tail (const char /* r5 as corresponding DPMI call is supported beginning with v5. */ ret = __dpmi_get_capabilities(&flags, dpmi_vendor); - if (ret == 0 && strcmp(dpmi_vendor + 2, "CWSDPMI") == 0) + if ((ret == 0 && strcmp(dpmi_vendor + 2, "CWSDPMI") == 0) + || (__spawn_flags & __spawn_leak_workaround) == 0) workaround_descriptor_leaks = 0; else {