]> code.ossystems Code Review - openembedded-core.git/commitdiff
relocate_sdk: fixed .gccrelocprefix section handling
authorWenlin Kang <wenlin.kang@windriver.com>
Wed, 23 Mar 2016 08:35:48 +0000 (16:35 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 28 Mar 2016 14:54:51 +0000 (15:54 +0100)
When fixing paths for .gccrelocprefix section, it will corrupt the next
entry during updating the current one if "new_prefix" length is more
than "DEFAULT_INSTALL_DIR", this problem is obvious on the code, but it's
only found when install sdk onto a net file system.

Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/relocate_sdk.py

index 992db5c47d1531478e00d19c721a5b476970315c..ceca1f2563efcfc86dbc52f6b15d290e17547faf 100755 (executable)
@@ -166,6 +166,7 @@ def change_dl_sysdirs():
                 while (offset + 4096) <= sh_size:
                     path = f.read(4096)
                     new_path = old_prefix.sub(new_prefix, path)
+                    new_path = new_path.rstrip(b("\0"))
                     # pad with zeros
                     new_path += b("\0") * (4096 - len(new_path))
                     #print "Changing %s to %s at %s" % (str(path), str(new_path), str(offset))