Skip to content

Conversation

@theStack
Copy link
Contributor

The test feature_addrman.py currently serializes the addrdb without specifying endianness for ints, so the machine's native byte order is used (see https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment) and the generated peers.dat would be invalid on big-endian systems (our internal (de)serializers always use little-endian, see ser_{read,write}data32). Fix this by explicitly specifying little-endian serialization via the < character in struct.pack(...).

This is not detected by CI as we unfortunately don't run functional tests on big-endian systems there (I think we definitely should!).

The test `feature_addrman.py` currently serializes the addrdb without
specifying endianness for `int`s, so the machine's native byte order is used (see
https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment)
and the generated `peers.dat` would be invalid on big-endian systems.
Fix this by explicitly specifying little-endian serialization via the
`<` character in `struct.pack(...)`.
@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 25, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK MarcoFalke

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@maflcko
Copy link
Member

maflcko commented Apr 25, 2023

There is ci/test/00_setup_env_s390x.sh, but I guess it runs qemu-user, not qemu-system, so the python part will run on the host endianness. I wonder how hard it would be to spin up qemu-system in the CI env?

@maflcko
Copy link
Member

maflcko commented Jul 17, 2023

See #28087

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review lgtm. Will test later with #28087

lgtm ACK 53c990a 🔚

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: lgtm ACK 53c990ad3406ee945305af84af98d2f020e5f316   🔚
Q4OT2tQTqBObBcrKRFcksXJ+Hmk4cjXI0J1/jP0WyRJv9KJBww/yqNmqG4wmwyFsKkVg4cftn3+JzTrEqVQqCA==

@maflcko maflcko added this to the 26.0 milestone Jul 25, 2023
@maflcko
Copy link
Member

maflcko commented Jul 26, 2023

tested as well, so my recommendation would be to merge this before ##28087

@fanquake fanquake merged commit 8fba5df into bitcoin:master Jul 26, 2023
@theStack theStack deleted the test-fix_feature_addrman_on_big_endian_systems branch July 26, 2023 19:26
fanquake added a commit to bitcoin-core/gui that referenced this pull request Aug 9, 2023
fad0b67 ci: Use qemu-user through container engine (MarcoFalke)

Pull request description:

  Currently the CI containers always run on the host architecture, and only wrap `bitcoind` into `qemu-user` when needed. This has many issues:

  * The `i386` tasks can not be run on non-x86 hosts.
  * `config.guess` isn't present when building the CI image, which is fine. But it prints a warning, see bitcoin/bitcoin#27739 (review)
  * The python tests are run on the host architecture, making it harder to find architecture specific bugs. See for example bitcoin/bitcoin#27529 (comment)
  * All modern container engines support automatic dispatch to qemu-user, so it seems redundant to re-invent the wheel.

  Fix all issues by:
  * removing `HOST` from `ci/test/00_setup_env.sh`.
  * removing `QEMU_USER_CMD` and `ci/test/wrap-qemu.sh`.
  * removing `DPKG_ADD_ARCH` where possible, and pruning `PACKAGES` where possible.
  * specifying the architecture in `CI_IMAGE_NAME_TAG` to be used by the container engine.

ACKs for top commit:
  fanquake:
    ACK fad0b67 - this seems ok to me, and removes complexity from our CI system.

Tree-SHA512: 85e79f9f570e292d70a629d112fd4a6e6217d96226a1b665ed13485f616d84720ad2126b7d4b22fc603049f72fa7f2163b56a6bc276319fcd8b0496304ea4157
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 9, 2023
…tems

53c990a test: fix `feature_addrman.py` on big-endian systems (Sebastian Falbesoner)

Pull request description:

  The test `feature_addrman.py` currently serializes the addrdb without specifying endianness for `int`s, so the machine's native byte order is used (see https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment) and the generated `peers.dat` would be invalid on big-endian systems (our internal (de)serializers always use little-endian, see `ser_{read,write}data32`). Fix this by explicitly specifying little-endian serialization via the `<` character in `struct.pack(...)`.

  This is not detected by CI as we unfortunately don't run functional tests on big-endian systems there (I think we definitely should!).

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 53c990a   🔚

Tree-SHA512: 513af6f1f785a713e7a8ef3a57fcd3fe2520a7d537f63a9c8e1f4bdea4c2f605fd4c35001623d6b13458883dbc256f24943684ab8f224055c22bf8d8eeee5fe2
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Sep 6, 2023
The test `feature_addrman.py` currently serializes the addrdb without
specifying endianness for `int`s, so the machine's native byte order is used (see
https://docs.python.org/3/library/struct.html#byte-order-size-and-alignment)
and the generated `peers.dat` would be invalid on big-endian systems.
Fix this by explicitly specifying little-endian serialization via the
`<` character in `struct.pack(...)`.

Github-Pull: bitcoin#27529
Rebased-From: 53c990a
@bitcoin bitcoin locked and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants