From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: Kristian Amlie <kristian.amlie@mender.io>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] wic/direct.py: Avoid exception if using multiple rawcopy/no-table entries.
Date: Thu, 9 Mar 2017 15:28:20 +0200 [thread overview]
Message-ID: <20170309132820.GA9232@linux.intel.com> (raw)
In-Reply-To: <1489044316-14196-1-git-send-email-kristian.amlie@mender.io>
On Thu, Mar 09, 2017 at 08:25:16AM +0100, Kristian Amlie wrote:
> If we are both having a bootloader and a U-Boot environment file, we
> can end up with two entries using "--source rawcopy" and "--no-table",
> and since they reuse the same file [1], their cleanup handlers will
> try to delete the same file twice. So just ignore the error if the
> file doesn't exist.
>
> [1] Although they reuse the same file, the resulting output is
> correct, so it appears the file is accessed in properly sequential
> order.
>
> Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
> ---
> scripts/lib/wic/plugins/imager/direct.py | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> index b7e324a..0e8d436 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -548,7 +548,10 @@ class PartitionedImage():
> def cleanup(self):
> # remove partition images
> for image in self.partimages:
> - os.remove(image)
> + try:
> + os.remove(image)
> + except FileNotFoundError:
> + pass
>
> def assemble(self):
> logger.debug("Installing partitions")
Would it be better to just skip removing files that have already been
removed?
# remove partition images
for image in set(self.partimages):
os.remove(image)
--
Regards,
Ed
next prev parent reply other threads:[~2017-03-09 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-09 7:25 [PATCH] wic/direct.py: Avoid exception if using multiple rawcopy/no-table entries Kristian Amlie
2017-03-09 13:28 ` Ed Bartosh [this message]
2017-03-09 14:37 ` [PATCH v2] " Kristian Amlie
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=20170309132820.GA9232@linux.intel.com \
--to=ed.bartosh@linux.intel.com \
--cc=kristian.amlie@mender.io \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox