Bug #47348 Error messages indicate line number + 1
Submitted: 16 Sep 2009 3:19 Modified: 13 Oct 2009 10:18
Reporter: Diego Medina Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Core Severity:S3 (Non-critical)
Version:0.8.0 OS:Any
Assigned to: Jan Kneschke CPU Architecture:Any

[16 Sep 2009 3:19] Diego Medina
Description:
Whenever you get an error message about an error on your lua scripts, it indicates the real line number + 1

How to repeat:
1- Use this lua script

function read_query(packet)
  print
end

2- Start the proxy like this:

./sbin/mysql-proxy --proxy-backend-addresses=127.0.0.1:5132 \
--proxy-lua-script=delete.lua 

3- Send a query through the port 4040

4- On the terminal where you started the proxy, you will see:

(critical) network-mysqld-lua.c:232: lua_load_file(/Applications/mysql/enterprise/mysql-proxy-0.8.0-osx10.5-x86/delete.lua) failed: [string "/Applications/mysql/enterprise/mysql-proxy-0.8.0-osx10.5-x86/de..."]:4: '=' expected near 'end'

indicating line 4, but the problem is line 3

Suggested fix:
Show the real line number, if this is not possible, subtract 1 from the line number you are abot to print.
[21 Sep 2009 14:42] Jan Kneschke
revno: 842
committer: jan@mysql.com
branch nick: trunk
timestamp: Mon 2009-09-21 16:40:31 +0200
message:
  fixed the off-by-one line-number in stack-traces (fixes #47348)
------------------------------------------------------------
revno: 841
committer: jan@mysql.com
branch nick: trunk
timestamp: Mon 2009-09-21 16:34:47 +0200
message:
  added a failing test-case for the off-by-one linenumbers in the stack-traces (#47348)
[28 Sep 2009 15:20] Enterprise Tools JIRA Robot
Diego Medina writes: 
Verified fixed on version 0.8.0 revno: 842
[13 Oct 2009 10:18] MC Brown
Added a note to the 0.8.0 changelog: 

The line numbers provided in stack traces would be out by one line.