Re: [patch] gdb/testsuite: Fix POSIX-isms in gdb.base/shell.exp

Sandra Loosemore
2020-06-25T19:35:53Z

On 6/25/20 12:07 PM, Eli Zaretskii wrote:
>> From: Sandra Loosemore <sandra@codesourcery.com>
>> Date: Thu, 25 Jun 2020 11:57:08 -0600
>> Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
>>
>> Here is the documentation I found via Google for system() in the Windows
>> library:
>>
>> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/system-wsystem?view=vs-2019
>>
>> "system uses the COMSPEC and PATH environment variables to locate the
>> command-interpreter file CMD.exe."
>>
>> I think the GDB manual doesn't accurately describe what GDB does in this
>> situation, BTW.
>
> Which part of the manual did you allude to here, and what is in your
> opinion inaccurate there?

https://sourceware.org/gdb/current/onlinedocs/gdb/Shell-Commands.html#Shell-Commands

"If it exists, the environment variable SHELL determines which shell to
run. Otherwise GDB uses the default shell (/bin/sh on Unix systems,
COMMAND.COM on MS-DOS, etc.). "

The SHELL environment variable is not consulted on Windows hosts. It
just uses whatever shell the system() call uses -- look at the
implementation of shell_escape in gdb/cli/cli-cmds.c.

The references to MS-DOS and COMMAND.COM are certainly bit-rotten.
COMMAND.COM was replaced by CMD.EXE in Windows NT, 25+ years ago now.
And do you really expect to be able to build a modern GDB to run on a
16-bit MS-DOS host? :-P

-Sandra