Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Denys Dmytriyenko <denis@denix.org>
To: Bill Randle <william.c.randle@intel.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] package.bbclass: handle links in sorted order
Date: Tue, 12 Apr 2016 12:51:15 -0400	[thread overview]
Message-ID: <20160412165115.GY16135@denix.org> (raw)
In-Reply-To: <1460474541-3625-1-git-send-email-william.c.randle@intel.com>

On Tue, Apr 12, 2016 at 08:22:21AM -0700, Bill Randle wrote:
> When processing links, the directories are processed in unsorted order
> which can result in cases like /var/lock -> /run/lock handled before
> /var/run -> /run throwing an error for /var/run because /run already exists.
> Change the link processing to ensure links are processed in sorted order of
> the destination.

Seems to resolve the issue for me.


> [YOCTO #9430]
> 
> Signed-off-by: Bill Randle <william.c.randle@intel.com>

Reported-by: Denys Dmytriyenko <denys@ti.com>
Tested-by: Denys Dmytriyenko <denys@ti.com>


> ---
>  meta/classes/package.bbclass | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 4452e2f..894b729 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -727,6 +727,7 @@ python fixup_perms () {
>      dvar = d.getVar('PKGD', True)
>  
>      fs_perms_table = {}
> +    fs_link_table = {}
>  
>      # By default all of the standard directories specified in
>      # bitbake.conf will get 0755 root:root.
> @@ -773,24 +774,27 @@ python fixup_perms () {
>                      continue
>                  entry = fs_perms_entry(d.expand(line))
>                  if entry and entry.path:
> -                    fs_perms_table[entry.path] = entry
> +                    if entry.link:
> +                        fs_link_table[entry.link] = entry
> +                    else:
> +                        fs_perms_table[entry.path] = entry
>              f.close()
>  
>      # Debug -- list out in-memory table
>      #for dir in fs_perms_table:
>      #    bb.note("Fixup Perms: %s: %s" % (dir, str(fs_perms_table[dir])))
> +    #for link in fs_link_table:
> +    #    bb.note("Fixup Perms: %s: %s" % (link, str(fs_link_table[link])))
>  
>      # We process links first, so we can go back and fixup directory ownership
>      # for any newly created directories
> -    for dir in fs_perms_table:
> -        if not fs_perms_table[dir].link:
> -            continue
> -
> +    # 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
>          origin = dvar + dir
>          if not (cpath.exists(origin) and cpath.isdir(origin) and not cpath.islink(origin)):
>              continue
>  
> -        link = fs_perms_table[dir].link
>          if link[0] == "/":
>              target = dvar + link
>              ptarget = link
> @@ -810,9 +814,6 @@ python fixup_perms () {
>          os.symlink(link, origin)
>  
>      for dir in fs_perms_table:
> -        if fs_perms_table[dir].link:
> -            continue
> -
>          origin = dvar + dir
>          if not (cpath.exists(origin) and cpath.isdir(origin)):
>              continue
> -- 
> 2.5.0
> 
> -- 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


  reply	other threads:[~2016-04-12 16:51 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 [this message]
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

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=20160412165115.GY16135@denix.org \
    --to=denis@denix.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=william.c.randle@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox