On Mon, Aug 01, 2016 at 01:05:56AM +0000, Eric Wong wrote:
> +static void setup_pager_env(struct argv_array *env)
> +{
> + const char *pager_env = stringify(PAGER_ENV);
> +
> + while (*pager_env) {
> + struct strbuf buf = STRBUF_INIT;
> + const char *cp = strchrnul(pager_env, '=');
> +
> + if (!*cp)
> + die("malformed build-time PAGER_ENV");
> + strbuf_add(&buf, pager_env, cp - pager_env);
> + cp = strchrnul(pager_env, ' ');
> + if (!getenv(buf.buf)) {
> + strbuf_reset(&buf);
> + strbuf_add(&buf, pager_env, cp - pager_env);
> + argv_array_push(env, strbuf_detach(&buf, NULL));
> + }
> + strbuf_reset(&buf);
> + while (*cp && *cp == ' ')
> + cp++;
> + pager_env = cp;
> + }So it looks like this function splits on spaces but doesn't provide any escaping mechanism. Is there any case in which we want to accept environment variables containing whitespace? I ask this as someone that has EDITOR set to "gvim -f" on occasion and seeing how tools sometimes handle that poorly. Even without that, I think this series is probably an improvement over the status quo. -- brian m. carlson / brian with sandals: Houston, Texas, US +1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204
signature.asc
Description: PGP signature

