Project

General

Profile

Actions

Bug #600

closed

OFStandard::searchDirectoryRecursively() relies on undefined HAVE_READDIR_R

Added by Jörg Riesmeier about 11 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Library
Target version:
-
Start date:
2014-06-26
Due date:
% Done:

100%

Estimated time:
Module:
ofstd, config?
Operating System:
Linux
Compiler:

Description

OFStandard::searchDirectoryRecursively() checks HAVE_READDIR_R in order to determine whether to use readdir() or the thread-safe readdir_r(). However, HAVE_READDIR_R is never defined because it is neither checked by the GNU Autoconf nor the CMake configure mechanism.

What is defined and actually checked by the module "dcmwlm" is HAVE_OLD_READDIR_R (in combination with _REEENTRANT).


Related issues 1 (0 open1 closed)

Related to DCMTK - Feature #161: Notizen zum Thema DCMTK und MultithreadingClosed

Actions
Actions #1

Updated by Jan Schlamelcher over 8 years ago

  • Status changed from New to Closed

Closed by commit #a4a69b0167a08.

Actions #2

Updated by Jan Schlamelcher over 8 years ago

  • % Done changed from 0 to 100
Actions #3

Updated by Jörg Riesmeier over 7 years ago

  • Status changed from Closed to Reopened
  • Target version changed from 3.6.2 to 3.6.6
  • Operating System set to Linux
Actions #4

Updated by Marco Eichelberg over 7 years ago

Apparently, the glibc version in which readdir_r was first marked as deprecated is 2.24. In earlier versions of glibc and on other libc implementations we have to assume that readdir() is thread unsafe, because Posix does not require it to be thread safe.

The presence of glibc can be determined by the __GLIBC__ macro being present (after inclusion e.g. of <stdio.h> or <stdlib.h>). The version number of glibc is available at compile time with the __GLIBC__ and __GLIBC_MINOR__ macros, which resolve to the major and minor version number. The following pseudocode could be used to avoid the deprecation warning on glibc systems:

#if defined(__GLIBC__) && (((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 24)) || (__GLIBC__ >= 3))
#defined READDIR_IS_THREADSAFE
#endif

#if defined(HAVE_READDIR_R) && !defined(READDIR_IS_THREADSAFE)
// use readdir_r()
#else
// use readdir()
#endif

Actions #5

Updated by Marco Eichelberg over 7 years ago

In a few DCMTK modules, readdir()/readdir_r() are still used directly. These should be migrated to OFStandard::searchDirectoryRecursively() first, so that the system dependent code is only needed in one place. Affected are:
  • private/dcmpps/libsrc/ppsmgram.cc
  • public/dcmpstat/apps/dcmprscu.cc
  • public/dcmwlm/libsrc/wlfsim.cc
Actions #6

Updated by Michael Onken over 7 years ago

This bug is also listed in Debian as bug #859202.

Actions #7

Updated by Jörg Riesmeier over 7 years ago

Was already mentioned (see Note #3).

Actions #8

Updated by Marco Eichelberg over 7 years ago

Fixed by commit #f421bce for public modules; commit #03a4f49 private modules.

Actions #9

Updated by Marco Eichelberg over 7 years ago

  • Status changed from Reopened to Closed
Actions #10

Updated by Michael Onken over 5 years ago

  • Target version deleted (3.6.6)
Actions

Also available in: Atom PDF