jwise / naim-oscar

OSCAR support for naim, written in Lua.
4 stars 0 forks source link

naim fails to connect, work around comment out line 1705 #17

Closed z0rk closed 13 years ago

z0rk commented 13 years ago

Building naim 0.12.0 using gcc Compile flags: -g -O2 -g3 Link flags: -g -O2 -g3 -ldl Configuration results: Packaging features: --enable-debug --disable-profile --enable-detach

Installation paths: --bindir: /usr/local/bin --with-pkgmoddir: /usr/local/lib/naim --includedir: /usr/local/include --with-pkgincludedir: /usr/local/include/naim --mandir: /usr/local/share/man --with-pkgdocdir: /usr/local/share/doc/naim --without-cygwindocdir --with-pkgtarball: naim-0.12.0-x86_64-unknown-linux-gnu.tbz2

With no .naimrc [13:44:49] * A new connection of type OSCAR has been created. [13:44:49] * Ins and Del will switch between connections, and /jump (^N, M-n, F8) will jump across connections if there are no active windows in the current one. [13:44:49] * You can now /connect [] to log on. [13:44:49] * Help on topics: In the top-right corner of your screen is a "window list" window, which will display one window for each online buddy once you have signed on. The window highlighted at the top is the current window. Use the Tab key to cycle through the listed windows, or /jump buddyname to jump directly to buddyname's window.

The window list window will hide itself automatically to free up space for conversation, but it will come back if someone other than your current buddy messages you. You can press Ctrl-N to go to the next waiting (yellow) buddy when this happens. [13:44:49] * You do not have a .naimrc file, so I am using defaults. You can use the /save command to create a new .naimrc file. [13:44:49] * Added naim help (Dan Reed) [naim author] to your permanent buddy list. [13:44:49] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:1762: attempt to concatenate local 'port' (a userdata value) [13:44:49] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:710: attempt to index local 'user' (a userdata value) [13:44:49] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:1762: attempt to concatenate local 'port' (a userdata value) [13:44:49] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:710: attempt to index local 'user' (a userdata value)

With .naimrc

[14:09:02] * Connecting to OSCAR. [14:09:02] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:710: attempt to index local 'user' (a nil value) [14:09:02] * [CONNECT] Connection failed in startup, Unknown error. [14:09:02] * [READPROFILE] Can't read /home/z0rk/.naimprofile: No such file or directory. [14:09:02] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:1703: bad argument #1 to 'pairs' (table expected, got nil) [14:09:02] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:1703: bad argument #1 to 'pairs' (table expected, got nil)

jwise commented 13 years ago

That also is pretty distressing. How the hell did 'port' get to be a userdata value? I'll look at this further when I get to work.

Can you try compiling with CFLAGS=-O0 (just as an experiment), and CFLAGS="-O0 -m32" as a further experiment?

Thanks!

z0rk commented 13 years ago

Building with either of those options results in the same output, tho it does cause it to scroll by faster :/

jwise commented 13 years ago

Okay, I am super confused about this. Let's take the non-.naimrc case. You get each pair of messages, presumably, on a /connect attempt?

Try adding to the modules/OSCAR/init.lua, just below the function OSCAR:connect(server, port, sn) line,

    naim.echo("t(server) "..type(server).." t(port) "..type(port).." t(sn) "..type(sn))
    naim.echo("s(server) "..tostring(server).." s(port) "..tostring(port).." s(sn) "..tostring(sn))

I expect, with the crash, to get the results:

 *** t(server) userdata t(port) userdata t(sn) userdata
 *** s(server) userdata 0x12345 s(port) userdata 0x12345 s(sn) userdata 0x12345

If so, it will prove that what I think is happening is happening, but will provide no info on why...

z0rk commented 13 years ago

Just to be clear, weather I type /connect or not this just spams never ending until I /quit

no .naimrc: [20:15:08] * t(server) userdata t(port) userdata t(sn) userdata [20:15:08] * s(server) userdata: 00007fff5d754de0 s(port) userdata: 00007fff5d754d60 s(sn) userdata: 00007fff5d754ce0 [20:15:08] *\ Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:1764: attempt to concatenate local 'port' (a userdata value)

.naimrc:

[20:17:10] * t(server) userdata t(port) userdata t(sn) userdata [20:17:10] * s(server) userdata: 00007fff8b54f930 s(port) userdata: 00007fff8b54f8b0 s(sn) userdata: 00007fff8b54f830 [20:17:10] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:1764: attempt to concatenate local 'port' (a userdata value) [20:17:10] * Lua hook run error: ...c/naim-0.12.0-2011-09-10-0413/modules/OSCAR/init.lua:710: attempt to index local 'user' (a userdata value)

jwise commented 13 years ago

I am totally frickin' stumped. That chunk of code should never be getting hit until you /connect (or until your naimrc does it for you). The line 710 thing should only be happening if you /whois someone. Either way, userdata should never be getting passed into those two functions.

I just tried this on my x86_64 VM, and things are pretty busted there, but in a different fashion; I'm looking into this now. I'll get back to you soon.

jwise commented 13 years ago

Oh my fucking god. I would have gotten completely screwed here if I had not taken a compilers course. Apparently %al in the x86_64 ABI is used in variadic functions to mean "the number of saved vector registers", and basically, you're not allowed to cast a variadic to a non-variadic anymore on x86_64.

Holy shit.

I'm producing a fix now, but it may take me until morning.

jwise commented 13 years ago

OK, try grabbing: https://raw.github.com/jwise/naim/4f15967c85578417251a83bf0bdba8e84ab8473a/lua/pd.c

and plopping it in place of your pd.c, and rebuilding. I bet life will be a lot better for you if you do that in many respects. I think all segfaults will disappear, and so will the grief with this issue. Let me know if that helps.

z0rk commented 13 years ago

Yeah that works like a charm not only at fixing that issue, but several others I was running into. Thank you sir!

jwise commented 13 years ago

Solid. I'll push a new snap when I get to work.