From 5d7de9e8c10c8613925bf7dac364d7f0b563f527 Mon Sep 17 00:00:00 2001 From: Mattias Ellert Date: Apr 21 2016 08:40:38 +0000 Subject: Backport upstream's fix for the deprecation of readdir_r --- diff --git a/xrootd-deprecated.patch b/xrootd-deprecated.patch index 343552c..71a078d 100644 --- a/xrootd-deprecated.patch +++ b/xrootd-deprecated.patch @@ -1,12 +1,134 @@ -diff -ur xrootd-4.3.0.orig/cmake/XRootDOSDefs.cmake xrootd-4.3.0/cmake/XRootDOSDefs.cmake ---- xrootd-4.3.0.orig/cmake/XRootDOSDefs.cmake 2016-02-25 10:44:53.000000000 +0100 -+++ xrootd-4.3.0/cmake/XRootDOSDefs.cmake 2016-02-27 08:27:37.479682161 +0100 -@@ -28,6 +28,8 @@ - if( GCC_VERSION VERSION_GREATER 6.0 OR GCC_VERSION VERSION_EQUAL 6.0 ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=misleading-indentation" ) - endif() -+ # Glibc 2.24 depricates readdir_r and readdir64_r -+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations" ) - endif() - - #------------------------------------------------------------------------------- +From 4179c70670d41c1ebc0efe43cca440e5491882f4 Mon Sep 17 00:00:00 2001 +From: Andrew Hanushevsky +Date: Tue, 19 Apr 2016 23:16:43 -0700 +Subject: [PATCH] Do not use the deprecated readdir_r() function in Linux. + +--- + src/XrdDig/XrdDigFS.cc | 31 ++++++++++++++++++++----------- + src/XrdSfs/XrdSfsNative.cc | 16 +++++++++++++--- + 2 files changed, 33 insertions(+), 14 deletions(-) + +diff --git a/src/XrdDig/XrdDigFS.cc b/src/XrdDig/XrdDigFS.cc +index a300094..75bc463 100644 +--- a/src/XrdDig/XrdDigFS.cc ++++ b/src/XrdDig/XrdDigFS.cc +@@ -239,21 +239,30 @@ const char *XrdDigDirectory::nextEntry() + + // Read the next directory entry + // ++#ifdef __linux__ + do{errno = 0; +- if ((retc = readdir_r(dh, d_pnt, &rp))) +- {if (retc && errno != 0) +- XrdDigFS::Emsg(epname,error,retc,"read directory",fname); ++ rp = readdir(dh); ++ if (!rp) ++ {if (!(retc = errno)) {ateof = 1; error.clear();} ++ else XrdDigFS::Emsg(epname,error,retc,"read directory",fname); ++ d_pnt->d_name[0] = '\0'; ++ return (const char *)0; ++ } ++#else ++do{if ((retc = readdir_r(dh, d_pnt, &rp))) ++ {XrdDigFS::Emsg(epname,error,retc,"read directory",fname); + d_pnt->d_name[0] = '\0'; + return (const char *)0; + } + + // Check if we have reached end of file + // +- if (retc || !rp || !d_pnt->d_name[0]) ++ if (!rp || !d_pnt->d_name[0]) + {ateof = true; + error.clear(); + return (const char *)0; + } ++#endif + + // If autostat wanted, do so here + // +@@ -261,11 +270,11 @@ do{errno = 0; + { + #ifdef HAVE_FSTATAT + int sFlags = (isProc ? AT_SYMLINK_NOFOLLOW : 0); +- if (fstatat(dirFD, d_pnt->d_name, sBuff, sFlags)) continue; ++ if (fstatat(dirFD, rp->d_name, sBuff, sFlags)) continue; + sBuff->st_mode = (sBuff->st_mode & wMask) | S_IRUSR; + #else + char dPath[2048]; +- snprintf(dPath, sizeof(dPath), "%s%s", fname, d_pnt->d_name); ++ snprintf(dPath, sizeof(dPath), "%s%s", fname, rp->d_name); + if (stat(dPath, sBuff)) continue; + sBuff->st_mode = (sBuff->st_mode & wMask) | S_IRUSR; + #endif +@@ -279,12 +288,12 @@ do{errno = 0; + {struct stat Stat, *sP = (sBuff ? sBuff : &Stat); + char *dP; + int n, rc; +- rc = (sBuff ? 0:fstatat(dirFD,d_pnt->d_name,&Stat,AT_SYMLINK_NOFOLLOW)); ++ rc = (sBuff ? 0:fstatat(dirFD,rp->d_name,&Stat,AT_SYMLINK_NOFOLLOW)); + if (!rc && !noTag && S_ISLNK(sP->st_mode)) +- {n = strlen(d_pnt->d_name); +- dP = d_pnt->d_name + n + 4; ++ {n = strlen(rp->d_name); ++ dP = rp->d_name + n + 4; + n = sizeof(dirent_full.nbf) - (n + 8); +- if ((n = readlinkat(dirFD,d_pnt->d_name,dP,n)) < 0) strcpy(dP,"?"); ++ if ((n = readlinkat(dirFD,rp->d_name,dP,n)) < 0) strcpy(dP,"?"); + else *(dP+n) = 0; + strncpy(dP-4, " -> ", 4); + } +@@ -293,7 +302,7 @@ do{errno = 0; + + // Return the actual entry + // +- return (const char *)(d_pnt->d_name); ++ return (const char *)(rp->d_name); + } while(1); + return 0; // Keep compiler happy + } +diff --git a/src/XrdSfs/XrdSfsNative.cc b/src/XrdSfs/XrdSfsNative.cc +index 9464219..34578af 100644 +--- a/src/XrdSfs/XrdSfsNative.cc ++++ b/src/XrdSfs/XrdSfsNative.cc +@@ -197,17 +197,26 @@ const char *XrdSfsNativeDirectory::nextEntry() + + // Read the next directory entry + // ++#ifdef __linux__ + errno = 0; ++ rp = readdir(dh); ++ if (!rp) ++ {if (!(retc = errno)) {ateof = 1; error.clear();} ++ else XrdSfsNative::Emsg(epname,error,retc,"read directory",fname); ++ d_pnt->d_name[0] = '\0'; ++ return (const char *)0; ++ } ++ return (const char *)(rp->d_name); ++#else + if ((retc = readdir_r(dh, d_pnt, &rp))) +- {if (retc && errno != 0) +- XrdSfsNative::Emsg(epname,error,retc,"read directory",fname); ++ {XrdSfsNative::Emsg(epname,error,retc,"read directory",fname); + d_pnt->d_name[0] = '\0'; + return (const char *)0; + } + + // Check if we have reached end of file + // +- if (retc || !rp || !d_pnt->d_name[0]) ++ if (!rp || !d_pnt->d_name[0]) + {ateof = 1; + error.clear(); + return (const char *)0; +@@ -216,6 +225,7 @@ const char *XrdSfsNativeDirectory::nextEntry() + // Return the actual entry + // + return (const char *)(d_pnt->d_name); ++#endif + } + + /******************************************************************************/ +-- +2.5.5 + diff --git a/xrootd.spec b/xrootd.spec index 95efca5..5350233 100644 --- a/xrootd.spec +++ b/xrootd.spec @@ -10,7 +10,7 @@ Name: xrootd Epoch: 1 Version: 4.3.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Extended ROOT file server Group: System Environment/Daemons @@ -610,6 +610,9 @@ fi %doc %{_pkgdocdir} %changelog +* Thu Apr 21 2016 Mattias Ellert - 1:4.3.0-3 +- Backport upstream's fix for the deprecation of readdir_r + * Sat Feb 27 2016 Mattias Ellert - 1:4.3.0-2 - Workaround deprecation of readdir_r in glibc 2.24