* [PATCH] wic: make engine.py:get_partitions() resilient to parted/dmidecode stderr output
@ 2018-10-10 18:31 Geoff Parker
2018-10-10 19:03 ` ✗ patchtest: failure for " Patchwork
0 siblings, 1 reply; 2+ messages in thread
From: Geoff Parker @ 2018-10-10 18:31 UTC (permalink / raw)
To: openembedded-core
Running wic commands on Debian 10 systems fail in
scripts/lib/wic/engine.py:get_partitions() due to new stderr output captured
when trying to parse the output from /sbin/parted as a non-root user.
The parted command calls the dmidecode utility, which produces this error
as a non-root user:
/sys/firmware/dmi/tables/smbios_entry_point: Permission denied
/dev/mem: Permission denied
scripts/lib/wic/engine.py:get_partitions()
calls misc.py:exec_cmd(), a subprocess wrapper which returns a
combined stderr and sdtdout.
These messages to stderr confuse the partition table parser in get_partitions().
This patch has the partition table parser ignore lines before the
expected "BYT;"
header string.
Running wic in Debian 9 does not have this issue.
---
scripts/lib/wic/engine.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index f0c5ff0aaf..52c9592b33 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -266,10 +266,15 @@ class Disk:
out = exec_cmd("%s -sm %s unit B print" % (self.parted,
self.imagepath))
parttype = namedtuple("Part", "pnum start end size fstype")
splitted = out.splitlines()
- lsector_size, psector_size, self._ptable_format =
splitted[1].split(":")[3:6]
+ # skip over possible errors in exec_cmd output
+ try:
+ idx =splitted.index("BYT;")
+ except ValueError:
+ raise WicError("Error getting partition information
from %s" % (self.parted))
+ lsector_size, psector_size, self._ptable_format =
splitted[idx + 1].split(":")[3:6]
self._lsector_size = int(lsector_size)
self._psector_size = int(psector_size)
- for line in splitted[2:]:
+ for line in splitted[idx + 2:]:
pnum, start, end, size, fstype = line.split(':')[:5]
partition = parttype(int(pnum), int(start[:-1]), int(end[:-1]),
int(size[:-1]), fstype)
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* ✗ patchtest: failure for wic: make engine.py:get_partitions() resilient to parted/dmidecode stderr output
2018-10-10 18:31 [PATCH] wic: make engine.py:get_partitions() resilient to parted/dmidecode stderr output Geoff Parker
@ 2018-10-10 19:03 ` Patchwork
0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2018-10-10 19:03 UTC (permalink / raw)
To: Geoff Parker; +Cc: openembedded-core
== Series Details ==
Series: wic: make engine.py:get_partitions() resilient to parted/dmidecode stderr output
Revision: 1
URL : https://patchwork.openembedded.org/series/14461/
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 cannot be parsed correctly due to malformed diff lines [test_mbox_format]
Suggested fix Create the series again using git-format-patch and ensure it can be applied using git am
Diff line self.imagepath))
* 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 d0d55add6c)
* Patch wic: make engine.py:get_partitions() resilient to parted/dmidecode stderr output
Issue Patch is missing Signed-off-by [test_signed_off_by_presence]
Suggested fix Sign off the patch (either manually or with "git commit --amend -s")
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] 2+ messages in thread
end of thread, other threads:[~2018-10-10 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-10 18:31 [PATCH] wic: make engine.py:get_partitions() resilient to parted/dmidecode stderr output Geoff Parker
2018-10-10 19:03 ` ✗ patchtest: failure for " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox