Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 917ce6fcd764544d2cf12ade55a804fcff97dbc4450e817c698ca9af2e55b210
Ticket: 92564326a98b551099d3e61bbe88e3b5f9720c15
Open file descriptor leak: better align dir operations(opendir/readdir/closedir) all to either 64bit or 32bit ones.
User & Date: wrenashe on 2018-05-08 07:02:43
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    We recently got "file operator leaks" on AIX from Tcl 8.5.19/8.6.3 which was built by ourselves on AIX for 32-bit Tcl target. 
    
    build@aixbuild 8>xlC_r -qversion
    IBM XL C/C++ for AIX, V13.1.3 (5725-C72, 5765-J07)
    Version: 13.01.0003.0000
    
    The sympton was like,
    <-libc.a:opendir() = 3603f978		0.000000
    495.8273:        getdirent(161, 0x360ADD78, 4096) = 1024
    496.6565:        getdirent(161, 0x360ADD78, 4096) = 0
    ->libc.a:closedir(0x3603f978)
    <-libc.a:closedir() = 0		0.000000
    ->libc.a:opendir(0x35caf13c)
    498.2069:        getdirent(161, 0x360ADD78, 4096) = 116
    <-libc.a:opendir() = 3603f978		0.000000
    498.2097:        getdirent64(161, 0x360ADD78, 4096) = 160
    498.2100:        getdirent64(161, 0x360ADD78, 4096) = 0
    ->libc.a:closedir(0x3603f978)
    <-libc.a:closedir() = ffffffffffffffff		0.000000
    
    You can see closedir() fails at the end and then the file operator is leaked then.
    
    The problem is caused by closedir() call after readdir64() which is enabled by "-DHAVE_STRUCT_DIRENT64=1" instead of readdir() during the build.
    
    The warning is issued during the build.
    "/work/app/external/tcl8.5.19/unix/../unix/tclUnixFile.c", line 392.35: 1506-280 (W) Function argument assignment between types "struct dirdesc64*" and "struct dirdesc*" is not allowed.
    
    The suggestion is to align all the DIR operations in either 64-bit or 32-bit ones to avoid build warning and file operator leak in the runtime. Tcl now only has TclOSreaddir defined for readdir/readdir64().
    
    Tao
    
  5. foundin changed to: "8.5.19 and above"
  6. is_private changed to: "0"
  7. login: "wrenashe"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "f5e96bd3168d173a07f11b6f7040c085db1fb97d"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "wrenashe"
  14. subsystem changed to: "37. File System"
  15. title changed to:
    Open file descriptor leak: better align dir operations(opendir/readdir/closedir) all to either 64bit or 32bit ones.
    
  16. type changed to: "Bug"