public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: Tobias Burnus <tobias@codesourcery.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	fortran <fortran@gcc.gnu.org>
Cc: NightStrike <nightstrike@gmail.com>
Subject: Re: [Patch] libfortran: Fix execute_command_line for Windows
Date: Wed, 18 Jan 2023 21:47:06 +0100	[thread overview]
Message-ID: <e5a67301-4be3-0f44-4512-b726f49e4702@gmx.de> (raw)
In-Reply-To: <0b95e5f1-142e-e13a-7d77-272073e25c2a@codesourcery.com>

Hi Tobias,

Am 18.01.23 um 16:42 schrieb Tobias Burnus:
> 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.

I don't use Windows, but this LGTM.

> OK for mainline?

Yes, and thanks for the patch!

Harald

>
> Tobias
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201,
> 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer:
> Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München;
> Registergericht München, HRB 106955


  reply	other threads:[~2023-01-18 20:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 15:42 Tobias Burnus
2023-01-18 20:47 ` Harald Anlauf [this message]
2023-01-19  1:54 ` Jerry D

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5a67301-4be3-0f44-4512-b726f49e4702@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nightstrike@gmail.com \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).