Hi Tierry,

Huge work ! I've not played with it yet, but I've already compiled it successfully ;-)

Some early feedbacks :
- It appears that the code requires at least LUA 5.2.

- Maybe we'll have to work on the Makefile to ease the compilation. For example, on debian, I have to add -llua5.2 instead of -llua

- There's a small typo in an error message (hlua.c:423) : "Malformad argument mask" instead of "Malformed argument mask" for the hlua_lua2arg_check() function.
I'll send a patch later for that.

- Talking about hlua_lua2arg_check(), There are 2 other points :
1. The function comments has some typos. While trying to fix them, I'm realizing I don't understand the comment and I'm not sure to rewrite it correctly. Can you have a look at it ?
2. I think we can have a buffer overflow with the following test :
  if (idx >= ARGM_NBARGS && argp[idx].type != ARGT_STOP)

The calling function (hlua_run_sample_fetch) already allows a same buffer overflow :
  struct arg args[ARGM_NBARGS];
  args[i].type = ARGT_STOP;
where `i' can be equal to ARGM_NBARGS.

- As it is done for other libraries, maybe we can add the compiled version of LUA when "haproxy -vv" is called.
I'll also send a patch for that.

- Still about the version : maybe we can add a #error when LUA_VERSION_NUM is not defined or less than 502 :
# LUA 5.0.x : not devined
# LUA 5.1.x : equal to 501
# LUA 5.2.x : equal to 502
# LUA 5.3.x : equal to 503

I think I'll try some LUA scripts before the end of the week-end (which is approaching too quickly) ;-)

Cyril Bonté

Reply via email to