common-mk: comment on common_utils.py and make it posix compliant

Addressed comments in
https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1107024/34/common-mk/common_utils.py#11.

TEST=cros_workon_make --board=eve --test arc-adbd
BUG=chromium:868820

Change-Id: I33153d7f6c4955c4e53504461a6aacd1616b1931
Reviewed-on: https://chromium-review.googlesource.com/1154856
Commit-Ready: Keigo Oka <oka@chromium.org>
Tested-by: Keigo Oka <oka@chromium.org>
Reviewed-by: Keigo Oka <oka@chromium.org>
diff --git a/common-mk/common_utils.py b/common-mk/common_utils.py
index e810cca..3d5e667 100644
--- a/common-mk/common_utils.py
+++ b/common-mk/common_utils.py
@@ -8,6 +8,11 @@
 
 from __future__ import print_function
 
+# Usually we should use cros_build_lib.RunCommand over subprocess.check_output
+# to avoid possible issues in subprocess. Here we use subprocess exceptionally,
+# because the usage is simple enough, and lower overhead is important as it
+# being called about ten times per each ebuild. See crbug.com/868820 for the
+# time comparison.
 import subprocess
 
 def parse_shell_args(s):
@@ -21,5 +26,5 @@
   # The dummy variable prevents the first value in s from interpreted as a flag
   # for echo. IFS is set to separate $* with newlines.
   output = subprocess.check_output(
-      ['eval "set -- dummy $0"; IFS=$\'\\n\'; echo -n "$*"', s], shell=True)
+      ['eval "set -- dummy $0"; IFS=$\'\\n\'; printf "%s" "$*"', s], shell=True)
   return output.splitlines()[1:]