summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonardo Augusto <leobsd@gmail.com>2019-02-08 08:35:12 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-25 15:01:21 +0100
commit796788c025d4576c27d25ed50401c55e2e589bbb (patch)
tree3d3742dbd5153f11d8f0657d27c8e90aad4d8484
parent13ad350647b1d78699a1b83c777517aa3a098305 (diff)
downloadpoky-796788c025d4576c27d25ed50401c55e2e589bbb.tar.gz
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) (From OE-Core rev: b9ccf44edccd31264890fa790d6120fc9e2c0238) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/wic/engine.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 4eefc94b84..951bf30717 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -331,7 +331,7 @@ class Disk:
331 def copy(self, src, pnum, path): 331 def copy(self, src, pnum, path):
332 """Copy partition image into wic image.""" 332 """Copy partition image into wic image."""
333 if self.partitions[pnum].fstype.startswith('ext'): 333 if self.partitions[pnum].fstype.startswith('ext'):
334 cmd = "echo -e 'cd {}\nwrite {} {}' | {} -w {}".\ 334 cmd = "printf 'cd {}\nwrite {} {}' | {} -w {}".\
335 format(path, src, os.path.basename(src), 335 format(path, src, os.path.basename(src),
336 self.debugfs, self._get_part_image(pnum)) 336 self.debugfs, self._get_part_image(pnum))
337 else: # fat 337 else: # fat