Project

General

Profile

Actions

Bug #3294

closed

Interest::getNonce and Name::compare fail on big endian platforms

Added by susmit shannigrahi about 9 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Base
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Actions #1

Updated by Junxiao Shi about 9 years ago

  • Subject changed from ndn-cxx tests fail on big endian machines like s390(x) or ppc64 to Interest::getNonce and Name::compare fail on big endian
  • Description updated (diff)
  • Category set to Base
  • Target version set to Unsupported

Fedora is not a supported platform, although I believe this bug would also appear on Ubuntu which has ppc64 releases.

Actions #2

Updated by Davide Pesavento about 9 years ago

  • Subject changed from Interest::getNonce and Name::compare fail on big endian to Interest::getNonce and Name::compare fail on big endian platforms
Actions #3

Updated by Davide Pesavento about 9 years ago

The failures in Name::compare tests might not be endianness bugs, but could be due to incorrect assumptions regarding memcmp() return value, see also https://github.com/named-data/ndn-cxx/pull/3

Actions #4

Updated by susmit shannigrahi almost 9 years ago

Davide Pesavento wrote:
The failures in Name::compare tests might not be endianness bugs, but could be due to incorrect assumptions regarding memcmp() return value, see also https://github.com/named-data/ndn-cxx/pull/3

This is still happening in 0.4.0. I thought we fixed it, no?

https://kojipkgs.fedoraproject.org//work/tasks/4228/12494228/build.log

Actions #5

Updated by Davide Pesavento almost 9 years ago

susmit shannigrahi wrote:

This is still happening in 0.4.0. I thought we fixed it, no?

Uhm no... we fixed Name::compare, but there are other failures in your report, probably endian-related, and I don't think anyone tried to fix those.

Actions #6

Updated by susmit shannigrahi almost 9 years ago

Davide Pesavento wrote:
Uhm no... we fixed Name::compare, but there are other failures in your report, probably endian-related, and I don't think anyone tried to fix those.

tlv.hpp uses be16toh, be32toh and be64toh before returning values. The test compares 1U to the returned value. There is a conversion mismatch somewhere.

Actions #8

Updated by Davide Pesavento about 5 years ago

  • % Done changed from 0 to 50

I don't see what's wrong with getNonce, there's nothing endian-specific there. However, decoding of the nonce field may be wrong, the code only does a memcpy but no endian-swap.
A related question is why are we using uint32_t to represent the nonce instead of uint8_t[4]?

Actions #9

Updated by Davide Pesavento over 4 years ago

  • Status changed from New to Code review
  • Assignee set to Davide Pesavento
  • Target version changed from Unsupported to 0.8.0
  • % Done changed from 50 to 100
Actions #11

Updated by Davide Pesavento over 4 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF