Bug 1128771 - 32/64 bit GlusterFS portability
Summary: 32/64 bit GlusterFS portability
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: core
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-11 14:13 UTC by Justin Clift
Modified: 2018-10-11 09:32 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-11 09:32:52 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:


Attachments (Terms of Use)
Build log showing the error (148.75 KB, text/x-log)
2014-08-11 15:52 UTC, Justin Clift
no flags Details

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


Note You need to log in before you can comment on or make changes to this bug.