Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mismatch between implementation and documentation of bmap path discovery strategy #30

Open
josch opened this issue Jul 16, 2024 · 2 comments · May be fixed by #35
Open

mismatch between implementation and documentation of bmap path discovery strategy #30

josch opened this issue Jul 16, 2024 · 2 comments · May be fixed by #35

Comments

@josch
Copy link

josch commented Jul 16, 2024

The documentation states:

bmaptool automatically discovers it by looking for a file with the same basename as IMAGE but with the ".bmap" extension.

Lets try this out:

$ echo foo > foo.img
$ echo bar > bar.img
$ bmaptool create foo.img > foo.bmap
$ bmaptool create bar.img > foo.img.bmap
$ bmaptool copy foo.img disk
bmaptool: info: discovered bmap file 'foo.img.bmap'
bmaptool: info: block map format version 2.0
bmaptool: info: 1 blocks of size 4096 (4 bytes), mapped 1 blocks (4.0 KiB or 100.0%)
bmaptool: info: copying image 'foo.img' to file 'disk' using bmap file 'foo.img.bmap'
bmaptool: info: 100% copied
bmaptool: ERROR: An error occurred, here is the traceback:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/bmaptools/CLI.py", line 490, in copy_command
    writer.copy(False, not args.no_verify)
  File "/usr/lib/python3/dist-packages/bmaptools/BmapCopy.py", line 617, in copy
    reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/usr/lib/python3/dist-packages/six.py", line 719, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/bmaptools/BmapCopy.py", line 562, in _get_data
    raise Error("checksum mismatch for blocks range %d-%d: "

bmaptool: ERROR: checksum mismatch for blocks range 0-0: calculated b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c, should be 7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730 (image file foo.img)

This happens because instead of looking for a bmap file by taking the basename of the image file and adding the bmap extension, bmaptool first tries the original filename (not its basename) and adds the bmap extension to that.

Where is the error? In the documentation or in the implementation?

It becomes even more confusing if the file has multiple extensions which is common when compressing the disk image. For example, if the image file is called foo.img.gz, then bmaptool will look for bmap files in this order:

  1. foo.img.gz.bmap
  2. foo.img.bmap
  3. foo.bmap

Is this intentional and should the documentation be updated or should the implementation be changed to match the documentation?

Thanks!

@josch
Copy link
Author

josch commented Jul 25, 2024

Hi, I'd like to contribute a pull request fixing this issue but I'd need to know what the intended behaviour is first. :)

josch added a commit to josch/bmaptool that referenced this issue Jul 30, 2024
… file discovery

For example, if the image file is called foo.img.gz, then bmaptool will
look for bmap files in this order:

    foo.img.gz.bmap
    foo.img.bmap
    foo.bmap

Closes: yoctoproject#30
@josch
Copy link
Author

josch commented Jul 30, 2024

In the absence of any maintainer input, and assuming that the code is correct and the docs are not, I filed #35 to fix the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant