]> code.ossystems Code Review - openembedded-core.git/commit
scripts/lib/wic/engine: Fix cp's target path for ext* filesystems
authorLeonardo Augusto <leobsd@gmail.com>
Fri, 8 Feb 2019 16:35:12 +0000 (08:35 -0800)
committerArmin Kuster <akuster808@gmail.com>
Sun, 7 Apr 2019 09:39:31 +0000 (15:09 +0530)
commitb9ccf44edccd31264890fa790d6120fc9e2c0238
tree39ef1f085236ce7542a5507b9d9ba4a0bb63ea16
parent6f53c61dd989045a7075b678c7030421d715bc16
scripts/lib/wic/engine: Fix cp's target path for ext* filesystems

Python subprocess' shell=True defaults to /bin/sh[1][2], which
often refers to a POSIX-compliant shell. As the -e flag is
not defined in the POSIX standard[3], some shells may
interpret "-e" as the first argument to the echo command,
causing the rest of the command line to fail.

In this particular case, "echo -e 'cd {}'" is interpreted
as "-e cd {}", which causes the first line of the command
to fail, and causing cp to always place the source file
in the filesystem's root.

Replacing "echo -e" for a printf command makes this
more portable.

This issue only affects "wic cp" for ext* filesystems.

[1] https://docs.python.org/2/library/subprocess.html
[2] https://docs.python.org/3/library/subprocess.html
[3] http://pubs.opengroup.org/onlinepubs/9699919799

(From OE-Core rev: 9a5b703d4e60c3ccdf80b5289b8e6fc91133fcde)

Signed-off-by: Leonardo Augusto <leobsd@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
scripts/lib/wic/engine.py