[
https://issues.apache.org/jira/browse/THRIFT-6371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-6371.
--------------------------------
Fix Version/s: 0.26.0
Assignee: Jens Geyer
Resolution: Fixed
> Lua generator writes a uuid constant without quotes
> ---------------------------------------------------
>
> Key: THRIFT-6371
> URL: https://issues.apache.org/jira/browse/THRIFT-6371
> Project: Thrift
> Issue Type: Bug
> Components: Lua - Compiler
> Affects Versions: 0.24.0
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Priority: Minor
> Fix For: 0.26.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {{\-\-gen lua}} writes the value of a {{uuid}} constant into the generated
> code without quotes, so the generated file does not load. The {{TYPE_UUID}}
> case in
> [t_lua_generator.cc:277|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_lua_generator.cc#L277]
> streams {{value\->get_string()}} straight into {{TUUIDfromString(...)}},
> while {{TUUIDfromString()}} in {{lib/lua/Thrift.lua}} expects a string.
> {code}
> const uuid U = "00000000-4444-cccc-ffff-0123456789ab"
> {code}
> {noformat}
> $ thrift --gen lua u.thrift && grep '^U' gen-lua/u_constants.lua
> U = TUUIDfromString(00000000-4444-cccc-ffff-0123456789ab)
> $ luac -p gen-lua/u_constants.lua
> luac: gen-lua/u_constants.lua:11: malformed number near '0123456789ab'
> {noformat}
> With the value quoted,
> {{TUUIDfromString('00000000-4444-cccc-ffff-0123456789ab')}}, the file
> compiles. Checked with the 0.25.0 compiler and Lua 5.4.4 in the
> {{thrift:jammy}} image. The line is the same on master, release/0.25.0 and
> release/0.24.0; it dates from the uuid support for Lua (THRIFT-5804, 0.22.0).
> String constants in the same function are written without escaping as well;
> that part is covered by THRIFT-6236.
> _Drafted with AI assistance (Claude Opus 5.5)._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)