It is possible that the user copies the bmapfile itself using 'bmaptool copy'.
Most probably this is just by a mistake. In this case bmaptool just fails,
since it discovers the bmap file, and it does not match the "image" (where the
image is the same bmap file).
This patch teaches bmaptool to handle this case by dropping the discoverd bmap
file if its path is the same as the image path.
Change-Id: Ib48842ed6157ba364173fcd7771e1b2ba3eea9e5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
# was not specified.
(bmap_obj, bmap_path) = find_and_open_bmap(args, log)
+ if bmap_path == args.image:
+ # Most probably the specified the bmap file instead of the image file
+ # by mistake.
+ log.warning("image has the same path as the bmap file, dropping bmap")
+ bmap_obj.close()
+ bmap_obj = None
+ bmap_path = None
+ args.nobmap = True
+
# Try to open the destination file. If it does not exist, a new regular
# file will be created. If it exists and it is a regular file - it'll be
# truncated. If this is a block device, it'll just be opened.