cros_sdk: Don't make directories as root.
cros_sdk made some cache directories as root which created problems for
non root users working inside it. FixIt.
BUG=chromium:658504
TEST=unittests, pre-cq
Change-Id: I5c478b93de1982d682c6b93a1e76f7ebf5a8fef1
Reviewed-on: https://chromium-review.googlesource.com/401998
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index 27c2df2..f813cf1 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -673,7 +673,7 @@
for target in (sdk_cache, distfiles_cache):
src = os.path.join(constants.SOURCE_ROOT, os.path.basename(target))
if not os.path.exists(src):
- osutils.SafeMakedirs(target)
+ osutils.SafeMakedirsNonRoot(target)
continue
lock.write_lock(
"Upgrade to %r needed but chroot is locked; please exit "
@@ -684,7 +684,7 @@
# of us avoiding taking a write lock to do the src check. If we
# took a write lock for that check, it would effectively limit
# all cros_sdk for a chroot to a single instance.
- osutils.SafeMakedirs(target)
+ osutils.SafeMakedirsNonRoot(target)
elif not os.path.exists(target):
# Upgrade occurred, but a reversion, or something whacky
# occurred writing to the old location. Wipe and continue.