Bug 1356998

Summary: syscalls: readdir_r() is deprecated in newer glibc
Product: [Community] GlusterFS Reporter: Kaleb KEITHLEY <kkeithle>
Component: unclassifiedAssignee: Kaleb KEITHLEY <kkeithle>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: mainlineCC: bugs
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-06 05:12:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
full compile output with deprecated warnings none

Description Kaleb KEITHLEY 2016-07-15 13:04:34 UTC
Description of problem:

In glibc-2.23 on Fedora 25/rawhide (glibc-2.23.90), the readdir_r() function is marked as deprecated and compiler warnings are emitted while compiling.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Kaleb KEITHLEY 2016-07-15 13:36:39 UTC
Created attachment 1180163 [details]
full compile output with deprecated warnings

Comment 2 Vijay Bellur 2016-07-15 13:38:56 UTC
REVIEW: http://review.gluster.org/14838 (core: use readdir(3) with glibc, and associated cleanup) posted (#9) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 3 Vijay Bellur 2016-07-15 17:40:06 UTC
REVIEW: http://review.gluster.org/14838 (core: use readdir(3) with glibc, and associated cleanup) posted (#10) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 4 Vijay Bellur 2016-07-17 11:22:16 UTC
REVIEW: http://review.gluster.org/14838 (core: use readdir(3) with glibc, and associated cleanup) posted (#11) for review on master by Kaleb KEITHLEY (kkeithle)

Comment 5 Vijay Bellur 2016-07-18 11:59:46 UTC
COMMIT: http://review.gluster.org/14838 committed in master by Jeff Darcy (jdarcy) 
------
commit 561746080b0b7154bfb3bdee20d426cf2ef7db17
Author: Kaleb S. KEITHLEY <kkeithle>
Date:   Thu Jul 7 08:51:08 2016 -0400

    core: use readdir(3) with glibc, and associated cleanup
    
    Starting with glibc-2.23 (i.e. what's in Fedora 25), readdir_r(3)
    is marked as deprecated. Specifically the function decl in <dirent.h>
    has the deprecated attribute, and now warnings are thrown during the
    compile on Fedora 25 builds.
    
    The readdir(_r)(3) man page (on Fedora 25 at least) and World+Dog say
    that glibc's readdir(3) is, and always has been, MT-SAFE as long as
    only one thread is accessing the directory object returned by opendir().
    World+Dog also says there is a potential buffer overflow in readdir_r().
    World+Dog suggests that it is preferable to simply use readdir(). There's
    an implication that eventually readdir_r(3) will be removed from glibc.
    POSIX has, apparently deprecated it in the standard, or even removed it
    entirely.
    
    Over and above that, our source near the various uses of readdir(_r)(3)
    has a few unsafe uses of strcpy()+strcat().
    
    (AFAIK nobody has looked at the readdir(3) implemenation in *BSD to see
    if the same is true on those platforms, and we can't be sure of MacOS
    even though we know it's based on *BSD.)
    
    Change-Id: I5481f18ba1eebe7ee177895eecc9a80a71b60568
    BUG: 1356998
    Signed-off-by: Kaleb S. KEITHLEY <kkeithle>
    Reviewed-on: http://review.gluster.org/14838
    Smoke: Gluster Build System <jenkins.org>
    Reviewed-by: Niels de Vos <ndevos>
    CentOS-regression: Gluster Build System <jenkins.org>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    Reviewed-by: Kotresh HR <khiremat>
    Reviewed-by: Jeff Darcy <jdarcy>