public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [PR gdb/28369] Use get_shell on gdb/ser-pipe.c
@ 2021-09-25 21:34 Sergio Durigan Junior
  2021-09-30 17:40 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Sergio Durigan Junior @ 2021-09-25 21:34 UTC (permalink / raw)
  To: GDB Patches; +Cc: Sergio Durigan Junior

PR gdb/28369 reports that gdb/ser-pipe.c has an 'execl' function call
with a hard-coded "/bin/sh" as its argument.  We've had 'get_shell'
for a while now, which is conscious about the SHELL environment and a
better alternative to always calling "/bin/sh".

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28369
---
 gdb/ser-pipe.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index cc72010ae46..257e0d4a107 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -30,6 +30,7 @@
 #include "gdbsupport/gdb_sys_time.h"
 #include <fcntl.h>
 #include "gdbsupport/filestuff.h"
+#include "gdbsupport/pathstuff.h"
 
 #include <signal.h>
 
@@ -122,7 +123,9 @@ pipe_open (struct serial *scb, const char *name)
 	}
 
       close_most_fds ();
-      execl ("/bin/sh", "sh", "-c", name, (char *) 0);
+
+      const char *shellfile = get_shell ();
+      execl (shellfile, shellfile, "-c", name, (char *) 0);
       _exit (127);
     }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [PR gdb/28369] Use get_shell on gdb/ser-pipe.c
  2021-09-25 21:34 [PATCH] [PR gdb/28369] Use get_shell on gdb/ser-pipe.c Sergio Durigan Junior
@ 2021-09-30 17:40 ` Tom Tromey
  2021-09-30 22:20   ` Sergio Durigan Junior
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2021-09-30 17:40 UTC (permalink / raw)
  To: Sergio Durigan Junior via Gdb-patches; +Cc: Sergio Durigan Junior

>>>>> "Sergio" == Sergio Durigan Junior via Gdb-patches <gdb-patches@sourceware.org> writes:

Sergio> PR gdb/28369 reports that gdb/ser-pipe.c has an 'execl' function call
Sergio> with a hard-coded "/bin/sh" as its argument.  We've had 'get_shell'
Sergio> for a while now, which is conscious about the SHELL environment and a
Sergio> better alternative to always calling "/bin/sh".

Thanks, this is ok.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [PR gdb/28369] Use get_shell on gdb/ser-pipe.c
  2021-09-30 17:40 ` Tom Tromey
@ 2021-09-30 22:20   ` Sergio Durigan Junior
  0 siblings, 0 replies; 3+ messages in thread
From: Sergio Durigan Junior @ 2021-09-30 22:20 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Sergio Durigan Junior via Gdb-patches

On Thursday, September 30 2021, Tom Tromey wrote:

>>>>>> "Sergio" == Sergio Durigan Junior via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Sergio> PR gdb/28369 reports that gdb/ser-pipe.c has an 'execl' function call
> Sergio> with a hard-coded "/bin/sh" as its argument.  We've had 'get_shell'
> Sergio> for a while now, which is conscious about the SHELL environment and a
> Sergio> better alternative to always calling "/bin/sh".
>
> Thanks, this is ok.

Thanks, Tom.

Pushed: 906e2b7664c5becfa3e10717a7d530e87fdab4ec

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-30 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 21:34 [PATCH] [PR gdb/28369] Use get_shell on gdb/ser-pipe.c Sergio Durigan Junior
2021-09-30 17:40 ` Tom Tromey
2021-09-30 22:20   ` Sergio Durigan Junior

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).