diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2011-07-26 14:28:33 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-07-27 15:45:48 +0100 |
commit | 30ddd02277d4513e2649ed168a513205e244bcb1 (patch) | |
tree | 5758f035b94ab5ad86af5c157b1dd86d6b82df27 /meta/classes/package.bbclass | |
parent | 19715dafa51a94d7a4bde1c72bc3d07699aa2315 (diff) | |
download | poky-30ddd02277d4513e2649ed168a513205e244bcb1.tar.gz |
package.bbclass: fixup_perms - change symlink processing
We switch to using os.lchown in order to avoid following a symlink.
We also now check if an item is a symlink, if so we avoid the
os.chmod as a symlink inherits the mode of it's target.
(From OE-Core rev: c64d075b3d367e6c76aafa17782585d026b1f31e)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r-- | meta/classes/package.bbclass | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index f2950e25c2..076a532360 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -472,7 +472,7 @@ python fixup_perms () { | |||
472 | else: | 472 | else: |
473 | return int(mode,8) | 473 | return int(mode,8) |
474 | 474 | ||
475 | # Note uid/gid -1 has special significance in os.chown | 475 | # Note uid/gid -1 has special significance in os.lchown |
476 | def _procuid(self, uid): | 476 | def _procuid(self, uid): |
477 | if uid is None or uid == "-": | 477 | if uid is None or uid == "-": |
478 | return -1 | 478 | return -1 |
@@ -514,14 +514,14 @@ python fixup_perms () { | |||
514 | 514 | ||
515 | # Fix the permission, owner and group of path | 515 | # Fix the permission, owner and group of path |
516 | def fix_perms(path, mode, uid, gid, dir): | 516 | def fix_perms(path, mode, uid, gid, dir): |
517 | if mode: | 517 | if mode and not os.path.islink(path): |
518 | #bb.note("Fixup Perms: chmod 0%o %s" % (mode, dir)) | 518 | #bb.note("Fixup Perms: chmod 0%o %s" % (mode, dir)) |
519 | os.chmod(path, mode) | 519 | os.chmod(path, mode) |
520 | # -1 is a special value that means don't change the uid/gid | 520 | # -1 is a special value that means don't change the uid/gid |
521 | # if they are BOTH -1, don't bother to chown | 521 | # if they are BOTH -1, don't bother to lchown |
522 | if not (uid == -1 and gid == -1): | 522 | if not (uid == -1 and gid == -1): |
523 | #bb.note("Fixup Perms: chown %d:%d %s" % (uid, gid, dir)) | 523 | #bb.note("Fixup Perms: lchown %d:%d %s" % (uid, gid, dir)) |
524 | os.chown(path, uid, gid) | 524 | os.lchown(path, uid, gid) |
525 | 525 | ||
526 | # Return a list of configuration files based on either the default | 526 | # Return a list of configuration files based on either the default |
527 | # files/fs-perms.txt or the contents of FILESYSTEM_PERMS_TABLES | 527 | # files/fs-perms.txt or the contents of FILESYSTEM_PERMS_TABLES |