From 7b9cedc697c37fa79fd9f7fba0e455ac2f30f038 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 1 Sep 2017 20:20:36 +0200 Subject: [PATCH] common_trans: leave the shell handle commands containing = in arg0 This is probably an environment variable definition. * bin/common_trans.cc: Here. A use-case appears in the test of the next patch. --- bin/common_trans.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/common_trans.cc b/bin/common_trans.cc index 9af739e1d..20c8ca495 100644 --- a/bin/common_trans.cc +++ b/bin/common_trans.cc @@ -584,7 +584,8 @@ skip_ws(const char*& cmd) // - can have >stderr and & and such) are not support. Chains of commands -// (pipes, semi-colons, etc.) are not supported. +// (pipes, semi-colons, etc.) are not supported. Envvar definitions +// before the command are not supported. static void exec_command(const char* cmd) { @@ -635,6 +636,13 @@ exec_command(const char* cmd) } } } + // If result is empty, we failed to found the command; let's see if + // the shell is smarter. If the command contains '=', it's unlikely + // to be a command, but probably an environment variable defintion + // as in + // FOO=1 command args.. + if (result.empty() || strchr(result[0], '=')) + goto use_shell; { if (stdin) {