Page MenuHomePhabricator

[lit] Fix `not` calling internal commands
ClosedPublic

Authored by jdenny on Aug 21 2019, 6:48 AM.

Details

Summary

Without this patch, when using lit's internal shell, if not on a lit
RUN line calls env, diff, or any of the other in-process shell
builtins that lit implements, lit accidentally searches for the latter
as an external executable. What's worse is that works fine when a
developer is testing on a platform where those executables are
available and behave as expected, but it then breaks on other
platforms.

not seems useful for some builtins, such as diff, so this patch
supports such uses. not --crash does not seem useful for builtins,
so this patch diagnoses such uses. In all cases, this patch ensures
shell builtins are found behind any sequence of env and not
commands.

not calling env calling an external command appears useful when
the env and external command are part of a lit substitution, as in
D65156. This patch supports that by looking through any sequence of
env and not commands, building the environment from the envs,
and storing the nots. The nots are then added back to the command
line without the envs to execute externally. This avoids the need
to replicate the not implementation, in particular the --crash
option, in lit.

Diff Detail

Event Timeline

jdenny created this revision.Aug 21 2019, 6:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2019, 6:48 AM
Herald added a subscriber: delcypher. · View Herald Transcript
rnk accepted this revision.Aug 21 2019, 2:35 PM

lgtm

This revision is now accepted and ready to land.Aug 21 2019, 2:35 PM
rnk added a comment.Sep 10 2019, 1:00 PM

I managed to run into this again:
https://reviews.llvm.org/rL371478#687359

Is anything blocking this?

In D66531#1665158, @rnk wrote:

I managed to run into this again:
https://reviews.llvm.org/rL371478#687359

Is anything blocking this?

See D65697#1640136. The next step is that D66574 needs to be reviewed, and I have some more patches I need to propose after that to add some missing features to the internal diff implementation. I've been very busy, so I haven't been pinging, but I didn't realize others were affected.

jdenny updated this revision to Diff 227566.Nov 1 2019, 8:19 PM
  • Rebased onto recent master.
  • Adjusted tests not to use diff as an example in-process builtin because it's now an out-of-process builtin.
  • Fixed discovery of out-of-process builtins behind not.
This revision was automatically updated to reflect the committed changes.