Re: [PATCH] Warn the user when $SHELL is invalid

Sergio Durigan Junior
2015-07-29T19:22:46Z

On Tuesday, July 28 2015, Pedro Alves wrote:

> As mentioned in the other thread, myself, I'm not convinced of the
> value of the extra fork/exit complexity for this. IMO, a wider
> potential bug surface for a not-so-clear benefit. We currently get:
>
> $ SHELL=/nonexisting gdb /home/pedro/a.out
> (gdb) r
> Starting program: /home/pedro/a.out
> Cannot exec /nonexisting -c exec /home/pedro/a.out .
> Error: No such file or directory
> During startup program exited with code 127.
> (gdb)
>
> If we're starting with a shell, then if the exec fails, it was
> obviously because execing the shell failed. I'd suggest simply trying
> to make the error message clearer. E.g.,:
>
> $ SHELL=/nonexisting gdb /home/pedro/a.out
> (gdb) r
> Starting program: /home/pedro/a.out
> "set startup-with-shell" is on, but failed to exec:
> /nonexisting -c exec /home/pedro/a.out
> Error: No such file or directory
> If set, the SHELL environment variable must point at a valid shell.
> SHELL is currently set to "/nonexisting".
> During startup program exited with code 127.
> (gdb)

Yeah, if it's just to warn the user, then I agree that it should be
possible to extend the existing error message. I'll send a patch for
this later.

Thanks,

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