Re: [Boost-bugs] [Boost C++ Libraries] #1578: bug in readdir_r_simulator() in a multi-threaded environment

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #1578: bug in readdir_r_simulator() in a multi-threaded environment
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-01-21 14:09:02


#1578: bug in readdir_r_simulator() in a multi-threaded environment
-----------------------------+----------------------------------------------
  Reporter: raulh39_at_[hidden] | Owner: bemandawes
      Type: Bugs | Status: assigned
 Milestone: Boost 1.35.0 | Component: filesystem
   Version: Boost 1.34.1 | Severity: Problem
Resolution: | Keywords:
-----------------------------+----------------------------------------------
Comment (by bemandawes):

 Replying to [comment:2 anonymous]:
> Replying to [comment:1 bemandawes]:
> > Sun supplies both POSIX and non-POSIX versions of readdir_r, according
 to http://docs.sun.com/app/docs/doc/819-2243/readdir-3c?a=view. The
 compliant version is selected by defining _POSIX_PTHREAD_SEMANTICS.
>
> Yes, that's true. I didn't read all the man page. My fault.
>
> >
> > So it looks to me that the fix for ticket #1578 (which is reporting
 the bug that results when the non-POSIX version is used) is to define
 _POSIX_PTHREAD_SEMANTICS at the beginning of boost-
 root/libs/filesystem/src/operations.cpp. This will cause the POSIX version
 to be used.
>
> Yes, but _POSIX_PTHREAD_SEMANTICS is already defined at the beginning of
 operations.cpp...

 Duh... Sorry, I missed that.

> I have been investigating the problem.
>
> It happens that I am compiling in a 32 bits environment, and, because of
 that, the compiler defines _ILP32.
> But, at the beginning of operations.cpp you can find:
> {{{
> #if !(defined(__HP_aCC) && defined(_ILP32) && \
> !defined(_STATVFS_ACPP_PROBLEMS_FIXED))
> # define _FILE_OFFSET_BITS 64 // at worst, these defines may have no
 effect,
> #endif
> }}}
> As I don't define neither !__HP_aCC nor _STATVFS_ACPP_PROBLEMS_FIXED,
 _FILE_OFFSET_BITS gets defined with a value of 64.
> But this is not correct, because if you do that, the posix version of
 readdir_r is not selected.
>
> (If you need an extract of dirent.h to verify this, I can send it to
 you, but it is 122 lines long so I prefer not to copy it here)
>
> So please, consider changing that lines to:
> {{{
> #if !(defined(__HP_aCC) && defined(_ILP32) && \
> !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) && \
> !defined(__sun__)
> # define _FILE_OFFSET_BITS 64 // at worst, these defines may have no
 effect,
> #endif
> }}}

 But IIUC, that will disable large file support. See
 http://docs.sun.com/app/docs/doc/816-5138/appendixa-tbl-10?a=view

 That document specifically lists _ILP32 and _FILE_OFFSET_BITS==64 as a
 valid combinations. I really would like to see the dirent.h header. I
 looked for it with Google, but couldn't find a copy. IANAL, but it seems
 to me that it would be fair use for me to look at a copy for debugging
 this problem. If you would like, I can ask someone at Sun to send me a
 copy.

 --Beman

--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1578#comment:3>
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:49:57 UTC