[patch] gdb/testsuite: Fix POSIX-isms in gdb.base/shell.exp
Eli Zaretskii
eliz@gnu.org
Fri Jun 26 07:08:41 GMT 2020
> CC: <cbiesinger@google.com>, <gdb-patches@sourceware.org>
> From: Sandra Loosemore <sandra@codesourcery.com>
> Date: Thu, 25 Jun 2020 13:35:45 -0600
>
> >> 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.
It isn't factually wrong: $SHELL isn't supposed to be set on non-Posix
hosts. However, I made the text more accurate with the patch below,
which I just installed.
> 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
You'd be surprised:
ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/gdb801b.zip
https://groups.google.com/forum/#!msg/comp.os.msdos.djgpp/MIm6bIlJ8b8/yNuLXDoxBQAJ
The DJGPP project has MS-DOS ports of all the main GNU utilities, most
of them of fairly recent versions (the above is GDB 8.0.1).
As for the 16-bit nature of MS-DOS and the ability to run a modern GDB
on it, you remind me of a short dialogue between RMS and DJ Delorie,
which happened more than 30 years ago and started the DJGPP project;
see the first paragraphs on this page:
http://www.delorie.com/djgpp/history.html
Here's the patch I installed on the master branch:
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 4b1a4c0..c591934 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2020-06-26 Eli Zaretskii <eliz@gnu.org>
+
+ * gdb.texinfo (Shell Commands): More accurate description of use
+ of $SHELL. Reported by Sandra Loosemore <sandra@codesourcery.com>.
+
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.texinfo (Maintenance Commands): Document new 'maint print
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 7f8c77a..fbe9f85 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -1451,9 +1451,10 @@
@itemx !@var{command-string}
Invoke a standard shell to execute @var{command-string}.
Note that no space is needed between @code{!} and @var{command-string}.
-If it exists, the environment variable @code{SHELL} determines which
-shell to run. Otherwise @value{GDBN} uses the default shell
-(@file{/bin/sh} on Unix systems, @file{COMMAND.COM} on MS-DOS, etc.).
+On GNU and Unix systems, the environment variable @code{SHELL}, if it
+exists, determines which shell to run. Otherwise @value{GDBN} uses
+the default shell (@file{/bin/sh} on GNU and Unix systems,
+@file{cmd.exe} on MS-Windows, @file{COMMAND.COM} on MS-DOS, etc.).
@end table
The utility @code{make} is often needed in development environments.
More information about the Gdb-patches
mailing list