Bug #3294
closedInterest::getNonce and Name::compare fail on big endian platforms
100%
Description
ndn-cxx tests fail on big endian machines like s390(x) or ppc64
https://bugzilla.redhat.com/show_bug.cgi?id=1275619
Buildlogs:
http://ppc.koji.fedoraproject.org/koji/taskinfo?taskID=2833893
http://s390.koji.fedoraproject.org/koji/taskinfo?taskID=1971883
      
      Updated by Junxiao Shi about 10 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.
      
      Updated by Davide Pesavento about 10 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
 
      
      Updated by Davide Pesavento almost 10 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
      
      Updated by susmit shannigrahi almost 10 years ago
      
    
    Davide Pesavento wrote:
The failures inName::comparetests might not be endianness bugs, but could be due to incorrect assumptions regardingmemcmp()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
      
      Updated by Davide Pesavento almost 10 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.
      
      Updated by susmit shannigrahi almost 10 years ago
      
    
    Davide Pesavento wrote:
Uhm no... we fixedName::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.
      
      Updated by susmit shannigrahi almost 10 years ago
      
    
    Adding the bugzilla bug here:
      
      Updated by Davide Pesavento about 6 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]?
      
      Updated by Davide Pesavento over 5 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
 
      
      Updated by Davide Pesavento over 5 years ago
      
    
    
    
      
      Updated by Davide Pesavento over 5 years ago
      
    
    - Status changed from Code review to Closed