Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-56088

readdir_r / readdir64_r is deprecated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.6.3, 5.9.0 Alpha
    • 5.6.0 Alpha, 5.8.0 Beta
    • Core: I/O
    • None
    • Arch Linux 64-bit

    Description

      I get this warning on Linux now... maybe it's just a GCC 6 thing.

      /home/rutledge/dev/qt58/qtbase/src/corelib/io/qfilesystemiterator_unix.cpp: In member function 'bool QFileSystemIterator::advance(QFileSystemEntry&, QFileSystemMetaData&)':
      /home/rutledge/dev/qt58/qtbase/mkspecs/linux-g++/../common/posix/qplatformdefs.h:146:35: warning: 'int readdir64_r(DIR*, dirent64*, dirent64**)' is deprecated [-Wdeprecated-declarations]
       #define QT_READDIR_R            ::readdir64_r
                                         ^
      /home/rutledge/dev/qt58/qtbase/src/corelib/io/qfilesystemiterator_unix.cpp:112:17: note: in expansion of macro 'QT_READDIR_R'
           lastError = QT_READDIR_R(dir, mt_file.data(), &dirEntry);
                       ^~~~~~~~~~~~
      In file included from /home/rutledge/dev/qt58/qtbase/mkspecs/linux-g++/qplatformdefs.h:63:0,
                       from /home/rutledge/dev/qt58/qtbase/src/corelib/io/qfilesystemiterator_unix.cpp:40:
      /usr/include/dirent.h:201:12: note: declared here
       extern int readdir64_r (DIR *__restrict __dirp,
                  ^~~~~~~~~~~
      /home/rutledge/dev/qt58/qtbase/src/corelib/io/qfilesystemiterator_unix.cpp:112:60: warning: 'int readdir64_r(DIR*, dirent64*, dirent64**)' is deprecated [-Wdeprecated-declarations]
           lastError = QT_READDIR_R(dir, mt_file.data(), &dirEntry);
                                                                  ^
      In file included from /home/rutledge/dev/qt58/qtbase/mkspecs/linux-g++/qplatformdefs.h:63:0,
                       from /home/rutledge/dev/qt58/qtbase/src/corelib/io/qfilesystemiterator_unix.cpp:40:
      /usr/include/dirent.h:201:12: note: declared here
       extern int readdir64_r (DIR *__restrict __dirp,
                  ^~~~~~~~~~~
      

      More info:

      https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html

      qfilesystemiterator_unix.cpp seems to be the only place this macro is used anyway, so maybe it's not too hard to eliminate. But "It is recommended that you use readdir, with external locking if multiple threads access the same dirstream." And that agrees with a comment in QFileSystemIterator::advance: // ### add local lock to prevent breaking reentrancy

      Attachments

        For Gerrit Dashboard: QTBUG-56088
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes