This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MIPS build slave


On 07/21/2015 06:43 PM, Simon Marchi wrote:
> On 15-07-21 01:21 PM, Brendan Kirby wrote:
>> I overrode the SHELL variable in the Buildbot systemd service I wrote to
>> start it. 
>>
>> Brendan
> 
> Ok thanks, I added a little warning in the wiki:
> 
> 
> /!\ It has been reported that the tests won't run properly if the SHELL variable is not
>     set to a valid shell (e.g. /sbin/nologin instead of /bin/bash). Make sure that the
>     user running the buildslave has a valid shell or override the SHELL environment
>     variable somehow.

You always need a valid SHELL set.  Not just for the testsuite, but
for gdb itself: gdb starts programs with the shell for
argument globbing, variable expansion ("run *", "run $foo", etc), and
redirection ("run 1>foo.txt", etc.), unless you disable all that
with "set startup-with-shell off".

 $ SHELL=/foo gdb /usr/bin/sleep
 ...
 (gdb) r
 Starting program: /usr/bin/sleep
 Cannot exec /usr/bin/sleep -c exec /usr/bin/sleep .
 Error: No such file or directory
 During startup program exited with code 127.
 (gdb)

As you found, that's a bogus error message.  It should have been:

 (gdb) r
 Starting program: /usr/bin/sleep
 Cannot exec /foo -c exec /usr/bin/sleep .
 Error: No such file or directory
 During startup program exited with code 127.
 (gdb)

This patchlet fixes that:

>From 767ecf74811b010c47a0721306beae1979141c61 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Thu, 23 Jul 2015 12:10:18 +0100
Subject: [PATCH] fix exec error message

---
 gdb/fork-child.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 66c07fb..4ba62b0 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -365,7 +365,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,

       /* If we get here, it's an error.  */
       save_errno = errno;
-      fprintf_unfiltered (gdb_stderr, "Cannot exec %s", exec_file);
+      fprintf_unfiltered (gdb_stderr, "Cannot exec %s", argv[0]);
       for (i = 1; argv[i] != NULL; i++)
 	fprintf_unfiltered (gdb_stderr, " %s", argv[i]);
       fprintf_unfiltered (gdb_stderr, ".\n");
-- 
1.9.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]