Bug 1128771

Summary: 32/64 bit GlusterFS portability
Product: [Community] GlusterFS Reporter: Justin Clift <jclift>
Component: coreAssignee: bugs <bugs>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: mainlineCC: atumball, bugs, kwade, manu, ndevos, pasik
Target Milestone: ---Keywords: EasyFix, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-11 09:32:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Build log showing the error none

Description Justin Clift 2014-08-11 14:13:45 UTC
Description of problem:

  As per upstream mailing list post here:

    http://supercolony.gluster.org/pipermail/gluster-devel/2014-August/041888.html

    Emmanuel Dreyfus wrote:

      I note this kind of warnings:

      meta-helpers.c:42:13: warning: cast to pointer from integer of different
size
      meta-helpers.c: In function 'meta_fd_release':

      This is caused by the attempt to use uint64_t as a placeholder for
      pointers. That causes warnings on machines with 32 bit pointers, and of
      course you are doomed the day pointers get bigger than 64 bits (not for
      tomorrow, but we all know computers do not need more than 640 kB,
      right?)

      uintptr_t is the right type to use in such a situation. POSIX defines it
      as an unsigned integer capable of holding a pointer. <stdint.h> takes
      care of defining it to the right size:
      http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html

      Fixing this warning in meta-helpers.c means modifying libglusterfs
      interfaces and cause a widespread change, hence I will not submit it,
      but I just share that information in case some courageous developer want
      to give it a try for the sake of portability.


    And from further discussion off list:

      The point is that when there is the need for a cast from pointer
      to int, uintptr_t should be used, as there is the guarantee that
      its size fits the pointer size.
      http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html

      When displaying such an int, printf("%"PRIxPTR, var); shoud be used
      http://pubs.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html


Version-Release number of selected component (if applicable):

  Upstream GlusterFS git, master branch, as of Monday 11th August 2014.

Comment 1 Justin Clift 2014-08-11 15:51:52 UTC
Further thoughts from Niels de Vos:

  Justin Clift wrote:
  > Niels, do you reckon this is an EasyFix candidate?

  Probably, yes. But please include a way on reproducing the warnings. For
  example, on can build GlusterFS master on Fedora Rawhide i386 or Fedora
  armv7hl. If possible, also give an example on how casting is correctly
  done.

  A build.log from Fedora Rawhide/i386 contains the same warnings. Search
  for -Wformat in http://download.gluster.org/pub/gluster/glusterfs/nightly/glusterfs/fedora-rawhide-i386/glusterfs-3.7dev-0.77.gitccb5dc0.autobuild/build.log

(attached)

Comment 2 Justin Clift 2014-08-11 15:52:37 UTC
Created attachment 925823 [details]
Build log showing the error