All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randle, William C" <william.c.randle@intel.com>
To: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>,
	"danismostlikely@gmail.com" <danismostlikely@gmail.com>
Subject: Re: [PATCH] package.bbclass: improve permission handling
Date: Thu, 14 Apr 2016 00:14:29 +0000	[thread overview]
Message-ID: <1460592870.21923.18.camel@intel.com> (raw)
In-Reply-To: <1460585876-26239-1-git-send-email-danismostlikely@gmail.com>

On Wed, 2016-04-13 at 16:17 -0600, Dan McGregor wrote:

From: Dan McGregor <dan.mcgregor@usask.ca<mailto:dan.mcgregor@usask.ca>>

Change fs_link_table to be keyed by path, just like fs_perms_table.
When a new entry is coming in for either table, remove any previous
entry for that path. This way later permission file entries override
earlier ones.

[YOCTO #9430]

Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca<mailto:dan.mcgregor@usask.ca>>
---
 meta/classes/package.bbclass | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 894b729..76b9f86 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -775,9 +775,13 @@ python fixup_perms () {
                 entry = fs_perms_entry(d.expand(line))
                 if entry and entry.path:
                     if entry.link:
-                        fs_link_table[entry.link] = entry
+                        fs_link_table[entry.path] = entry
+                        if entry.path in fs_perms_table:
+                            fs_perms_table.pop(entry.path)
                     else:
                         fs_perms_table[entry.path] = entry
+                        if entry.path in fs_link_table:
+                            fs_link_table.pop(entry.path)
             f.close()

     # Debug -- list out in-memory table
@@ -789,8 +793,9 @@ python fixup_perms () {
     # We process links first, so we can go back and fixup directory ownership
     # for any newly created directories
     # Process in sorted order so /run gets created before /run/lock, etc.
-    for link in sorted(fs_link_table):
-        dir = fs_link_table[link].path
+    for entry in sorted(fs_link_table.values(), key=lambda x: x.link):
+        link = entry.link
+        dir = entry.path
         origin = dvar + dir
         if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)):
             continue
--
2.8.1



Thanks, Dan! That looks good to me. One thought, though. Since you're looking for previous entries in the alternate tables (perms in link table and links in perm table), should we also consider searching the same table (link in links and perm in perms) in case someone used a private/local perms file to override a default (e.g., change a symlink /var/foo -> /run/foo to /var/foo -> /var/baz). In this case, it would keep the last one found, kind of like you're doing here. Just a thought.

    -Bill


      reply	other threads:[~2016-04-14  0:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 15:22 [PATCH] package.bbclass: handle links in sorted order Bill Randle
2016-04-12 16:51 ` Denys Dmytriyenko
2016-04-13 17:30   ` Dan McGregor
2016-04-13 17:40     ` Randle, William C
2016-04-13 18:54       ` Dan McGregor
2016-04-13 22:17       ` [PATCH] package.bbclass: improve permission handling Dan McGregor
2016-04-14  0:14         ` Randle, William C [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460592870.21923.18.camel@intel.com \
    --to=william.c.randle@intel.com \
    --cc=danismostlikely@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.