* [PATCH] lib/oe/qa: handle missing data attribute in __exit__
@ 2019-12-29 9:31 Alex Kiernan
2019-12-29 10:02 ` ✗ patchtest: failure for " Patchwork
2019-12-29 10:44 ` [PATCH] " Richard Purdie
0 siblings, 2 replies; 3+ messages in thread
From: Alex Kiernan @ 2019-12-29 9:31 UTC (permalink / raw)
To: openembedded-core
If mmap fails in open, we don't have a data attribute so when we execute
as a context manager the call to self.data.close needs to handle the
missing attribute:
File: '/home/akiernan/nanohub/build/../poky/meta/classes/chrpath.bbclass', lineno: 11, function: process_file_linux
0007: with oe.qa.ELFFile(fpath) as elf:
0008: try:
0009: elf.open()
0010: except oe.qa.NotELFFileError:
*** 0011: return
0012:
0013: p = sub.Popen([cmd, '-l', fpath],stdout=sub.PIPE,stderr=sub.PIPE)
0014: out, err = p.communicate()
0015: # If returned successfully, process stdout for results
File: '/home/akiernan/nanohub/build/../poky/meta/lib/oe/qa.py', lineno: 50, function: __exit__
0046: def __enter__(self):
0047: return self
0048:
0049: def __exit__(self, exc_type, exc_value, traceback):
*** 0050: self.data.close()
0051:
0052: def open(self):
0053: with open(self.name, "rb") as f:
0054: try:
Exception: AttributeError: 'ELFFile' object has no attribute 'data'
Fixes: 7785c41d0b95 ("chrpath: do less work")
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
---
meta/lib/oe/qa.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 21066c4dc3b3..d85206f155f0 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -47,7 +47,11 @@ class ELFFile:
return self
def __exit__(self, exc_type, exc_value, traceback):
- self.data.close()
+ try:
+ self.data.close()
+ except AttributeError:
+ # If we failed to mmap in open then the data attribute won't exist
+ pass
def open(self):
with open(self.name, "rb") as f:
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* ✗ patchtest: failure for lib/oe/qa: handle missing data attribute in __exit__
2019-12-29 9:31 [PATCH] lib/oe/qa: handle missing data attribute in __exit__ Alex Kiernan
@ 2019-12-29 10:02 ` Patchwork
2019-12-29 10:44 ` [PATCH] " Richard Purdie
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2019-12-29 10:02 UTC (permalink / raw)
To: Alex Kiernan; +Cc: openembedded-core
== Series Details ==
Series: lib/oe/qa: handle missing data attribute in __exit__
Revision: 1
URL : https://patchwork.openembedded.org/series/21782/
State : failure
== Summary ==
Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:
* Issue Series does not apply on top of target branch [test_series_merge_on_head]
Suggested fix Rebase your series on top of targeted branch
Targeted branch master (currently at 39825cba47)
If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).
---
Guidelines: https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] lib/oe/qa: handle missing data attribute in __exit__
2019-12-29 9:31 [PATCH] lib/oe/qa: handle missing data attribute in __exit__ Alex Kiernan
2019-12-29 10:02 ` ✗ patchtest: failure for " Patchwork
@ 2019-12-29 10:44 ` Richard Purdie
1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2019-12-29 10:44 UTC (permalink / raw)
To: Alex Kiernan, openembedded-core
On Sun, 2019-12-29 at 09:31 +0000, Alex Kiernan wrote:
> If mmap fails in open, we don't have a data attribute so when we
> execute
> as a context manager the call to self.data.close needs to handle the
> missing attribute:
>
> File:
> '/home/akiernan/nanohub/build/../poky/meta/classes/chrpath.bbclass',
> lineno: 11, function: process_file_linux
> 0007: with oe.qa.ELFFile(fpath) as elf:
> 0008: try:
> 0009: elf.open()
> 0010: except oe.qa.NotELFFileError:
> *** 0011: return
> 0012:
> 0013: p = sub.Popen([cmd, '-l',
> fpath],stdout=sub.PIPE,stderr=sub.PIPE)
> 0014: out, err = p.communicate()
> 0015: # If returned successfully, process stdout for
> results
> File: '/home/akiernan/nanohub/build/../poky/meta/lib/oe/qa.py',
> lineno: 50, function: __exit__
> 0046: def __enter__(self):
> 0047: return self
> 0048:
> 0049: def __exit__(self, exc_type, exc_value, traceback):
> *** 0050: self.data.close()
> 0051:
> 0052: def open(self):
> 0053: with open(self.name, "rb") as f:
> 0054: try:
> Exception: AttributeError: 'ELFFile' object has no attribute 'data'
>
> Fixes: 7785c41d0b95 ("chrpath: do less work")
> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
> ---
>
> meta/lib/oe/qa.py | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
> index 21066c4dc3b3..d85206f155f0 100644
> --- a/meta/lib/oe/qa.py
> +++ b/meta/lib/oe/qa.py
> @@ -47,7 +47,11 @@ class ELFFile:
> return self
>
> def __exit__(self, exc_type, exc_value, traceback):
> - self.data.close()
> + try:
> + self.data.close()
> + except AttributeError:
> + # If we failed to mmap in open then the data attribute
> won't exist
> + pass
>
> def open(self):
> with open(self.name, "rb") as f:
Thanks, there was a patch in master-next which was being held for
various reasons but I fixed the commit message and I merged it early on
to resolve this in master.
Cheers,
Richard
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-29 10:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-29 9:31 [PATCH] lib/oe/qa: handle missing data attribute in __exit__ Alex Kiernan
2019-12-29 10:02 ` ✗ patchtest: failure for " Patchwork
2019-12-29 10:44 ` [PATCH] " Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox