This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Expand $ when using tcsh
ClosedPublic

Authored by JDevlieghere on Apr 13 2022, 10:09 AM.

Details

Summary

Unlike for any of the other shells, we were escaping $ when using tcsh.
There's nothing special about $ in tcsh and this prevents you from
expanding shell variables, one of the main reasons this functionality
exists in the first place.

Diff Detail

Event Timeline

JDevlieghere created this revision.Apr 13 2022, 10:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 10:09 AM
JDevlieghere requested review of this revision.Apr 13 2022, 10:09 AM
jingham accepted this revision.Apr 13 2022, 10:42 AM

tcsh is different from the other shells in that a non-existent variable is trapped by the shell, and an error produced BEFORE running the command, whereas in other shells it just gets passed raw. So we should make sure that passing a non-existent shell variable produces a reasonable error. At present it sort of does:

(lldb) process launch --shell=tcsh -- $PWD $NO_SUCH_SHELL_VARIABLE
NO_SUCH_SHELL_VARIABLE: Undefined variable.
error: process exited with status 1
'r' and 'run' are aliases that default to launching through a shell.
Try launching without going through a shell by using 'process launch'.
(lldb)

The advisory part of that message is a little bogus, but that's a separate issue. Erroring out seems reasonable since that's actually what tcsh would have done with these arguments, and we seem in a fine state to try again.

It might be nice to have a test where we pass a bad variable and make sure that the error stays reasonable? But that's on the nice to have side...

This revision is now accepted and ready to land.Apr 13 2022, 10:42 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2022, 1:01 PM