[Boost-bugs] [Boost C++ Libraries] #6054: Reading Shared Memory from x86 to x64 and vice versa on OSX

Subject: [Boost-bugs] [Boost C++ Libraries] #6054: Reading Shared Memory from x86 to x64 and vice versa on OSX
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-25 08:56:39


#6054: Reading Shared Memory from x86 to x64 and vice versa on OSX
-------------------------------------------+--------------------------------
 Reporter: tibdewal.rahulkumar@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
  Version: Boost 1.47.0 | Severity: Showstopper
 Keywords: |
-------------------------------------------+--------------------------------
 If I create a SM from 64 bit application and open it on 32 bit application
 it fails.

 //for 64 bit
     shared_memory_object( create_only, "test" , read_write) ;
 // for 32 bit
     shared_memory_object (open_only, "test", read_write);
 file created by 64bit application is at path as below:

 /private/tmp/boost_interprocess/AD21A54E000000000000000000000000/test
 where as file searched by 32 bit application is at path

 /private/tmp/boost_interprocess/AD21A54E00000000/test
 Thus 32 bit applications cannot read the file.

 I am using boost 1.47.0 on Mac OS X. Is it a bug? Do I have to do some
 settings use some Macros in order to fix it? Has any one encountered this
 problem before?




 This Bug is present in tmp_dir_helpers.hpp file.


 {{{
        inline void get_bootstamp(std::string &s, bool add = false)
         {
           ...
            std::size_t char_counter = 0;
            long fields[2] = { result.tv_sec, result.tv_usec };
            for(std::size_t field = 0; field != 2; ++field){
               for(std::size_t i = 0; i != sizeof(long); ++i){
                  const char *ptr = (const char *)&fields[field];
                  bootstamp_str[char_counter++] =
 Characters[(ptr[i]&0xF0)>>4];
                  bootstamp_str[char_counter++] =
 Characters[(ptr[i]&0x0F)];
               }
            ...
         }
 }}}


 Where as it should have been some thing like this..


 {{{
    '''long long''' fields[2] = { result.tv_sec, result.tv_usec };
                for(std::size_t field = 0; field != 2; ++field){
                   for(std::size_t i = 0; i != sizeof('''long long''');
 ++i)

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6054>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC