From: Cody P Schafer <dev@codyps.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] Avoid crashing if getgrnam() cannont find a group by the given name
Date: Sat, 25 Oct 2014 12:10:43 -0400 [thread overview]
Message-ID: <1414253443-23679-1-git-send-email-dev@codyps.com> (raw)
Without this, we get (on systems without a 'mail' group):
ERROR: Error executing a python function in /home/x/g/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_3.16.bb:
The stack trace of python calls that resulted in this exception/failure was:
File: 'fixup_perms', lineno: 231, function: <module>
0227: each_file = os.path.join(root, f)
0228: fix_perms(each_file, fs_perms_table[dir].fmode, fs_perms_table[dir].fuid, fs_perms_table[dir].fgid, dir)
0229:
0230:
*** 0231:fixup_perms(d)
0232:
File: 'fixup_perms', lineno: 173, function: fixup_perms
0169: if len(lsplit) != 8 and not (len(lsplit) == 3 and lsplit[1].lower() == "link"):
0170: msg = "Fixup perms: %s invalid line: %s" % (conf, line)
0171: package_qa_handle_error("perm-line", msg, d)
0172: continue
*** 0173: entry = fs_perms_entry(d.expand(line))
0174: if entry and entry.path:
0175: fs_perms_table[entry.path] = entry
0176: f.close()
0177:
File: 'fixup_perms', lineno: 32, function: __init__
File "fixup_perms", line 32, in __init__
File: 'fixup_perms', lineno: 44, function: _setdir
File "fixup_perms", line 44, in _setdir
File: 'fixup_perms', lineno: 75, function: _procgid
File "fixup_perms", line 75, in _procgid
Exception: KeyError: 'getgrnam(): name not found: mail'
ERROR: Function failed: fixup_perms
ERROR: Logfile of failure stored in: /home/x/obj/y/tmp/work/i586-poky-linux/linux-libc-headers/3.16-r0/temp/log.do_package.15841
ERROR: Task 400 (/home/x/g/poky/meta/recipes-kernel/linux-libc-headers/linux-libc-headers_3.16.bb, do_package) failed with exit code '1'
Signed-off-by: Cody P Schafer <dev@codyps.com>
---
meta/classes/package.bbclass | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 2aec3e6..d7c970b 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -568,7 +568,10 @@ python fixup_perms () {
elif gid.isdigit():
return int(gid)
else:
- return grp.getgrnam(gid).gr_gid
+ try:
+ return grp.getgrnam(gid).gr_gid
+ except Exception:
+ return -1
# Use for debugging the entries
def __str__(self):
--
2.0.4
reply other threads:[~2014-10-25 16:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1414253443-23679-1-git-send-email-dev@codyps.com \
--to=dev@codyps.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.