summaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2010-12-29 15:28:48 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-10 12:06:54 +0000
commit4245b27fa8d62c80858b6a050fed260583af7498 (patch)
tree72e180dd66fa78ac52779bcc98e2943d87964973 /lib/bb/utils.py
parent61897c0f57c7f05d85db180bf56b3772bacdb154 (diff)
downloadbitbake-4245b27fa8d62c80858b6a050fed260583af7498.tar.gz
bb.utils: check if lock file is writable, to fix Yocto bug 606
Bug 606 report that if $DL_DIR is read-only, do_fetch will simply hang without any error message. The root cause is that: bb.fetch.go()->bb.utils.lockfile() will try to lock file ${DL_DIR}/xxxxx.lock. Since ${DL_DIR} is read-only, it will cause IOError exception. Although lockfile() can catch the exception, currently code simply ignore all the exception and continue the loop. it make sense if the exception is caused by locking contention, but in the read-only $DL_DIR case, it cause endless waiting unfortunately. So this patch add read-only check for lockfile to avoid the silent hang. (From Poky rev: 6ee0c26e21f48dcd47af88ed5c174e76e76a3e42) Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 459b8948d..53de49f68 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -409,6 +409,10 @@ def lockfile(name):
logger.error("Lockfile destination directory '%s' does not exist", path)
sys.exit(1)
+ if not os.access(path, os.W_OK):
+ bb.msg.error(bb.msg.domain.Util, "Error, lockfile path is not writable!: %s" % path)
+ sys.exit(1)
+
while True:
# If we leave the lockfiles lying around there is no problem
# but we should clean up after ourselves. This gives potential