From bcbaa119f15995dab836c8a785e92fe215146cb8 Mon Sep 17 00:00:00 2001 From: "sschmitz@chromium.org" Date: Wed, 27 Feb 2013 18:03:23 +0000 Subject: [PATCH] Wrong file/dir owner and permission for installed Chrome OS fonts The install script sets owner to root and adjust dir/file permissions to 0755 and 0644 respectively. BUG=178612 TEST=manual; inspect dir/file owner and permissions in /usr/local/share/fonts/chromeos. Review URL: https://chromiumcodereview.appspot.com/12314144 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184986 0039d316-1c4b-4281-b951-d872f2087c98 --- build/linux/install-chromeos-fonts.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/build/linux/install-chromeos-fonts.py b/build/linux/install-chromeos-fonts.py index bb5f3c927cb0..98c3a570d139 100755 --- a/build/linux/install-chromeos-fonts.py +++ b/build/linux/install-chromeos-fonts.py @@ -39,7 +39,7 @@ def main(args): url = "%s/%s/%s" % (URL_PREFIX, URL_DIR, URL_FILE) - stamp = os.path.join(dest_dir, ".stamp") + stamp = os.path.join(dest_dir, ".stamp02") if os.path.exists(stamp): with open(stamp) as s: if s.read() == url: @@ -48,12 +48,14 @@ def main(args): if os.path.isdir(dest_dir): shutil.rmtree(dest_dir) - os.mkdir(dest_dir); + os.mkdir(dest_dir) + os.chmod(dest_dir, 0755) print "Installing Chrome OS fonts to %s." % dest_dir tarball = os.path.join(dest_dir, URL_FILE) subprocess.check_call(['curl', '-L', url, '-o', tarball]) - subprocess.check_call(['tar', 'xf', tarball, '-C', dest_dir]) + subprocess.check_call(['tar', '--no-same-owner', '--no-same-permissions', + '-xf', tarball, '-C', dest_dir]) os.remove(tarball) readme = os.path.join(dest_dir, "README") @@ -65,6 +67,12 @@ def main(args): with open(stamp, 'w') as s: s.write(url) + for base, dirs, files in os.walk(dest_dir): + for dir in dirs: + os.chmod(os.path.join(base, dir), 0755) + for file in files: + os.chmod(os.path.join(base, file), 0644) + return 0 if __name__ == '__main__':