You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "David Rauschenbach (JIRA)" <ji...@apache.org> on 2017/11/21 14:15:00 UTC

[jira] [Created] (THRIFT-4391) Lua library leaks 42 globals due to lack of module encapsulation

David Rauschenbach created THRIFT-4391:
------------------------------------------

             Summary: Lua library leaks 42 globals due to lack of module encapsulation
                 Key: THRIFT-4391
                 URL: https://issues.apache.org/jira/browse/THRIFT-4391
             Project: Thrift
          Issue Type: Bug
          Components: Lua - Library
    Affects Versions: 0.10.0
            Reporter: David Rauschenbach


The Lua library defines or clobbers 42 global variables, due to its lack of module encapsulation, making it an intrusive library that is atypically difficult to get working in my application context, and unnecessarily lowering its likelihood of working in other environments with diverse dependencies.

Ideally callers would access resources like this:

{code:lua}
local TCompactProtocol = require 'Thrift'.TCompactProtocol
{code}

And the Thrift library would publish them like this:

{code:lua}
-- Thrift.lua

local M = {}
M.ttype = function(obj) ...
M.terror = function(e) ...
M.version = 0.10
M.TType = ...
M.__TObject = ...
M.TProtocolBase = ...
M.TCompactProtocol = M.__TObject.new(M.TProtocolBase, {...
return M
{code}

The source codes should survive a check like this:

{code:sh}
$ luacheck --std max+busted --codes src/lua test/lua --no-self --ignore 213 311 611 631
{code}

Globals:

# __TClient
# __tobj_index
# __TObject
# __TProcessor
# base64_encode
# ch
# client
# CompactTypeToTType
# EscapeCharVals
# JSONCharTable
# JSONNode
# StringToTType
# TBinaryProtocol
# TBinaryProtocolFactory
# TBufferedTransport
# TCompactProtocol
# TCompactType
# terror
# TException
# TFramedTransport
# TFramedTransportFactory
# thrift_print_r
# THttpTransport
# THttpTransportFactory
# TJSONProtocol
# TMemoryBuffer
# TMessageType
# TProtocolBase
# TProtocolException
# TServer
# TSimpleServer
# ttable_size
# TTransportBase
# TTransportException
# TTransportFactoryBase
# ttype
# TType
# TTypeToCompactType
# TTypeToString
# version



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)