portable: allow reattaching when one image has a version and the other does not
authorLuca Boccassi <bluca@debian.org>
Wed, 23 Mar 2022 21:29:04 +0000 (21:29 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 29 Mar 2022 13:02:48 +0000 (14:02 +0100)
commit2350712e32c02d77cbae64d362b6614b19542993
tree35b84f1c704662f56b60637fe92120d3c891fba0
parentf09f6dc2c8f59b2b58159cc413b605a547c8646e
portable: allow reattaching when one image has a version and the other does not

A reattach might go from img.raw to img_0.1.raw or viceversa, but this is
not allowed right now as we try to match the full name.

Also take into account that running strcspn(a, '/') on an image name, without
leading path, will return the length of the full string, but the versions
might be different so they won't match, eg:

img_0.1.raw -> 12
img_0.1.1.raw -> 14

So adjust the check to take that into account, and skip it if we are not
dealing with directories
src/portable/portable.c
test/units/testsuite-29.sh