summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorBenjamin Esquivel <benjamin.esquivel@linux.intel.com>2015-09-03 07:10:45 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-04 16:23:56 +0100
commit7c079463c96891f0dbf6d7744c0d6bfe7af1e0ca (patch)
tree099cae4a2c051d87c69c2eba27d49729470e38e0 /bitbake/lib
parentea3384e9f84388d60331ba24f67ce5716ce45ee0 (diff)
downloadpoky-7c079463c96891f0dbf6d7744c0d6bfe7af1e0ca.tar.gz
bitbake: utils: Fix a potential error in movefile
bitbake utils' movefile is now prone to malform the destination file with duplicated file name strings. Fixing it to force a file name append iff the dest argument is a dir not a file name (Bitbake rev: 38dd27f7191da002a16c561be3790ce487045b01) Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 5eec787336..b62985dd7b 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -741,9 +741,12 @@ def movefile(src, dest, newmtime = None, sstat = None):
741 renamefailed = 1 741 renamefailed = 1
742 if sstat[stat.ST_DEV] == dstat[stat.ST_DEV]: 742 if sstat[stat.ST_DEV] == dstat[stat.ST_DEV]:
743 try: 743 try:
744 # os.rename needs to know the destination path with file name 744 # os.rename needs to know the dest path ending with file name
745 destfile = os.path.join(dest, os.path.basename(src)) 745 # so append the file name to a path only if it's a dir specified
746 os.rename(src, destfile) 746 srcfname = os.path.basename(src)
747 destpath = os.path.join(dest, srcfname) if os.path.isdir(dest) \
748 else dest
749 os.rename(src, destpath)
747 renamefailed = 0 750 renamefailed = 0
748 except Exception as e: 751 except Exception as e:
749 if e[0] != errno.EXDEV: 752 if e[0] != errno.EXDEV: