pass down CHG path from above

Summary:
I've been troubleshooting eden integration test failures on my
devserver and traced it to some slightly off behavior in the telemetry
wrapper.

The wrapper was setting `CHGHG` to `hg.real` rather than the computed
path to the `hg.real` executable.  In the eden integration tests this
path is the buck generated `hg.par`.  The problem this caused was running
the installed hg.real rather than the one from the test environment
and this caused resolution of the eden extension to fail.

Once I fixed that up I found that chg had detected a problem with the
paths to the hg executable that were being used; we were picking up `chg`
from the system path and had a similar issue to above.

I introduced an environmental variable `CHG_BIN` to hold the desired path
and set it to the buck built `chg` binary.

In the process of this I found that `chg` was triggering a UBSAN issue
by passing a nullptr as the second argument to `memcpy`.  I've included
the trivial fix for that in this diff also.

Reviewed By: quark-zju

Differential Revision: D8274636

fbshipit-source-id: 7ee0740cbfb447ab41b9e08308767d42790ba296
This commit is contained in:
Wez Furlong 2018-06-05 13:36:24 -07:00 committed by Facebook Github Bot
parent 3d72ef23a5
commit a09e44a469

View File

@ -218,7 +218,10 @@ static void execcmdserver(const struct cmdserveropts *opts)
const char **argv = chg_mallocx(sizeof(char *) * argsize);
memcpy(argv, baseargv, sizeof(baseargv));
memcpy(argv + baseargvsize, opts->args, sizeof(char *) * opts->argsize);
/* Ensure that opts->args is non-null prior to memcpy to avoid UB */
if (opts->args) {
memcpy(argv + baseargvsize, opts->args, sizeof(char *) * opts->argsize);
}
argv[argsize - 1] = NULL;
if (putenv("CHGINTERNALMARK=") != 0)