Error loading lua file seems to get corrupted



I have been having a problem with lua files after editing them, or sometimes just after viewing them (in vi via ssh client on a Mac OSX), when I execute an aggregate in aql I get this error: 2015-01-22 06:50:43 ERROR Lua Create Error: error loading module ‘myonlinebookings’ from file ‘./myonlinebookings.lua’: ./myonlinebookings.lua:1: unexpected symbol near '?' Error: (100) AEROSPIKE_ERR_UDF

It appears as if a byte marker is being loaded into the file somehow. The only way to make it work again is to delete the file and rekey the contents into a new file. Has anybody else had this or a similar problem? I’m thinking it may be a feature of the Mac ssh client (running in terminal window). I’m running the Aerospike Community Edition 3.4.1 on a Ubuntu 14.04.01 LTS server build on an Azure A1 Basic instance.




It would be good to check, after the UDF registration, the content of the lua file as seen on the Server side - it should be under /opt/aerospike/usr/udf/lua/myonlinebookings.lua, and see if there is a ‘?’ in there.



The file doesn’t have a question mark in it, but in a hex editor I can see extra bytes at the start of the file. It looks like a byte order marker, so I’m guessing it’s my Mac doing something weird.