From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 2211B3858D28; Thu, 19 Jan 2023 01:54:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2211B3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1031.google.com with SMTP id q64so910583pjq.4; Wed, 18 Jan 2023 17:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:content-language :references:cc:to:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=405aUhLp5+UvZtxKAtPviD0wbP88HfpynO8n8ydNCrQ=; b=BGGBBM6BwXC/yjxpQ2tMROYKDmCulfpg8yqAjRuaMthyT47i+E3VxHJXaivCkjpmEk e0pzX1r940i0aeYbBLu/SoHD1MAfpVjV1ohMntvz7QTznolEUs6OE/JwUJuyny9lbqhn SkuTT45PU2LprMpBNVoscKhR/IzMeoO8qzcd9jDRmAaLxlaDe4ZNV5yXvTxew8e+jjUV MdkoTop60WV2t3ROx0YvWf29hGOR4hrTais9ZZfTjdyc/49LOBMpFBnuYlFPTWvdfsp/ hoTrCTZA/7X4D3+4lu8vTsv9xCWiGnp/wSFnEsjOEu5ZNYGaPkYM9DOOfHfmtol2hiIn 3gUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:content-language :references:cc:to:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=405aUhLp5+UvZtxKAtPviD0wbP88HfpynO8n8ydNCrQ=; b=7re5OMZimjsNU78WDpwB8NmQfLhvw58qep4YGglXT9YrqRtBEkhr3PA71f0tWpCL3Q JZBNH4IZPJS5SaTY8qQjyOCqqj3zUPAfN7IZS+vnKF9s/d+dyMBJNgWIm8kL0Oiw03nk hPzEtoHO1EkwB0Ow/FBehnMrBKl2PQdy9QNSYidicV/asrSUQulI3D3omMJ5CW/7Omjt D5G24n7exJneg0Q3T9C20iI+Gw8EazcKyjvMM/oUMntEUcJIDObRm8e2apCFdU1xfVbs i01084wtIfyWaSb4rTZ1U9IzjqucJj9NZOwjV6jb1SBwKqoh/qzeualm6OagaFS9GzQb bfjw== X-Gm-Message-State: AFqh2kqN0RZI1spbAfU5J8VLRJB2l9jZsD8iWUEdrPckM7gANtXqXgDI y4yrq0NLlZ/XcoarH9kSNo0= X-Google-Smtp-Source: AMrXdXsy1js2LNUR4eccNwMjdfij0fgc38+mhnLvMPOxn7Bxzs48OmYpRMtnGsnAPs8l0F65oO+DoA== X-Received: by 2002:a17:90b:146:b0:229:1740:1055 with SMTP id em6-20020a17090b014600b0022917401055mr2106146pjb.2.1674093245102; Wed, 18 Jan 2023 17:54:05 -0800 (PST) Received: from [192.168.1.20] ([50.37.188.226]) by smtp.gmail.com with ESMTPSA id y2-20020a17090a16c200b002272616d3e1sm1941710pje.40.2023.01.18.17.54.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jan 2023 17:54:04 -0800 (PST) Message-ID: <0b098c99-eb94-9cec-459c-e284d5c0c135@gmail.com> Date: Wed, 18 Jan 2023 17:54:04 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 To: Tobias Burnus , gcc-patches , fortran Cc: NightStrike References: <0b95e5f1-142e-e13a-7d77-272073e25c2a@codesourcery.com> Content-Language: en-US From: Jerry D Subject: Re: [Patch] libfortran: Fix execute_command_line for Windows In-Reply-To: <0b95e5f1-142e-e13a-7d77-272073e25c2a@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/18/23 7:42 AM, Tobias Burnus wrote: > Reported by nightstrike, who also tested this patch. > > On Windows, we call system() which works as described at > https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/system-wsystem?view=msvc-170 > > Namely, it only fails with "-1" if the command interpreter > could not be started. Otherwise, it has the return value. > (Same on Linux.) On POSIX systems, 'sh' calls exit(127) or > _exit(127) if it cannot execute the program of the passed string, > as documented. Cf. https://www.unix.com/man-page/posix/3p/system/ > > Thus, the question is what happens on Windows. Our experiments, several > webpages (like stackoverflow) and the source code of WINE for cmd.exe > indicate > that Windows returns 9009 in that case. See for instance > https://github.com/wine-mirror/wine/blob/master/programs/cmd/wcmdmain.c#L1262-L1269 > > Thus, we now do likewise. The code is for MINGW; Cygwin does not set > that that > var and is likely to use return values closer to POSIX. > > OK for mainline? > > Tobias OK, thanks fir fix. Jerry