<div dir="ltr"><div dir="ltr">Does anybody have other suggestions on this one?<br><br>&gt; Python subprocess&#39; shell=True defaults to /bin/sh[1][2], which<br>&gt; often refers to a POSIX-compliant shell. As the -e flag is<br>&gt; not defined in the POSIX standard[3], some shells may <br>&gt; interpret &quot;-e&quot; as the first argument to the echo command,<br>&gt; causing the rest of the command line to fail.<br>&gt; <br>&gt; In this particular case, &quot;echo -e &#39;cd {}&#39;&quot; is interpreted<br>&gt; as &quot;-e cd {}&quot;, which causes the first line of the command<br>&gt; to fail, and causing cp to always place the source file<br>&gt; in the filesystem&#39;s root.<br>&gt; <br>&gt; Replacing &quot;echo -e&quot; for a printf command makes this<br>&gt; more portable.<br>&gt; <br>&gt; This issue only affects &quot;wic cp&quot; for ext* filesystems.<br>&gt; <br>&gt; [1] <a href="https://docs.python.org/2/library/subprocess.html">https://docs.python.org/2/library/subprocess.html</a><br>&gt; [2] <a href="https://docs.python.org/3/library/subprocess.html">https://docs.python.org/3/library/subprocess.html</a><br>&gt; [3] <a href="http://pubs.opengroup.org/onlinepubs/9699919799">http://pubs.opengroup.org/onlinepubs/9699919799</a><br>&gt; <br>&gt; Signed-off-by: Leonardo Augusto &lt;<a href="mailto:leobsd@gmail.com">leobsd@gmail.com</a>&gt;<br>&gt; --- <br>&gt;  scripts/lib/wic/engine.py | 2 +-<br>&gt;  1 file changed, 1 insertion(+), 1 deletion(-)<br>&gt; <br>&gt; diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py<br>&gt; index 4662c665c0..97f5e848cc 100644<br>&gt; --- a/scripts/lib/wic/engine.py<br>&gt; +++ b/scripts/lib/wic/engine.py<br>&gt; @@ -331,7 +331,7 @@ class Disk:<br>&gt;      def copy(self, src, pnum, path):<br>&gt;          &quot;&quot;&quot;Copy partition image into wic image.&quot;&quot;&quot;<br>&gt;          if self.partitions[pnum].fstype.startswith(&#39;ext&#39;):<br>&gt; -            cmd = &quot;echo -e &#39;cd {}\nwrite {} {}&#39; | {} -w {}&quot;.\<br>&gt; +            cmd = &quot;printf &#39;cd {}\nwrite {} {}&#39; | {} -w {}&quot;.\<br>&gt;                        format(path, src, os.path.basename(src),<br>&gt;                               self.debugfs, self._get_part_image(pnum))<br>&gt;          else: # fat <br></div></div>