[00:05] <Keybuk> whoah
[00:05] <Keybuk> now I've hit a segfault that looks like mr pointer went west
[00:08] <ion_> Thought flow: West. Go west. Someone should feed Go West to Songsmith and post it to Youtube.
[00:08] <Keybuk> huh?
[00:09] <ion_> You haven’t seen the numerous Songsmith versions of songs on Youtube?
[00:09] <Keybuk> nope
[00:09] <Keybuk> exampel?
[00:14] <ion_> http://www.youtube.com/watch?v=YSWmh9ZTLOY http://www.youtube.com/watch?v=_V1DuHUs22Q http://www.youtube.com/watch?v=itsT9zgWRoM http://www.youtube.com/watch?v=ypycpKQxXR0 http://www.youtube.com/watch?v=e1e_h1OJfS4 http://www.youtube.com/watch?v=6iCJHTzH5DY http://www.youtube.com/watch?v=WmC28cXWqLc http://www.youtube.com/watch?v=Um6WeRFC934
[00:19] <Keybuk> wonderfully bad
[00:20] <ion_> Yeah
[00:21] <ion_> So, what was the segfault problem?
[00:23] <Keybuk> not sure yet
[00:24] <Keybuk> it's uninitialised data
[00:24] <Keybuk> which is surprising
[00:24] <Keybuk> I was expecting write to freed memory
[00:31] <Keybuk> it _is_ happening inside a destructor though
[00:34] <Keybuk> (gdb) p source->files->bins[4]
[00:34] <Keybuk> $52 = {prev = 0x7fff2454a6f0, next = 0x7fff2454a6f0}
[00:34] <Keybuk> hah
[00:36] <Keybuk> now, how the hell does that happen?
[00:36] <Keybuk> ohhhhhhhhhhhhhhhhhhhhh
[00:36] <Keybuk> I know what that is
[00:36] <Keybuk> that's a list iterator!
[00:37] <Keybuk> this is the bug I knew there was with cursors in NIH_LIST_FOREACH_SAFE
[00:37] <Keybuk> that makes me happy
[00:37] <ion_> How is the bug triggered?
[00:38] <Keybuk> iterating a linked list while iterating a linked list with NIH_LIST_FOREACH_SAFE
[00:38] <Keybuk> honestly, the real problem here is that the ConfFile destructor is bogus
[00:38] <Keybuk> it does all sorts of heavy work, which really isn't appropriate
[00:39] <Keybuk> destructors are for cleaning up a structure, not for going around and restarting other jobs ;)
[00:39] <ion_> Yeah...
[00:42] <ion_> 2009-01-26 22:38:22 < ion_> Note to self: ask Keybuk why: * nih_config_parse() now reads the file into memory, instead of using mmap().
[00:42] <Keybuk> truncate a file while it's mmapped and try reading from it ;)
[00:43] <ion_> Ok
[00:43] <sadmac> Keybuk: take file lock?
[00:43] <Keybuk> sadmac: how does that help?
[00:43] <Keybuk> file locks only work if everyone co-operates
[00:43] <sadmac> Keybuk: never mind
[00:44] <Keybuk> you can core the process with just :> filename
[00:44] <ion_> At least the command is happy.
[00:47] <Keybuk>                 /* Mark the job to be deleted when it stops, in case            
[00:47] <Keybuk>                  * it cannot be deleted here.                                   
[00:47] <Keybuk>                  */
[00:47] <Keybuk>                 file->job->deleted = TRUE;
[00:47] <Keybuk> ...
[00:47] <Keybuk> what does _that_ do?
[00:48] <Keybuk> this whole job deletion stuff always scares me
[00:48] <Keybuk> it's just a bag or corner cases
[00:49] <ion_> Heh
[01:04] <Keybuk> aha
[01:04] <Keybuk> this makes sense
[01:04] <Keybuk> conf_file_new () doesn't do anything with a job
[01:05] <Keybuk> so the destructor bloody well shouldn't either
[01:05] <Keybuk> code gets easier to understand by being less clever
[01:06] <sadmac> Keybuk: can you make the alloc system error when someone tries to code this way?
[01:09] <Keybuk> I don't see how
[02:02] <Keybuk> sweet
[02:02] <Keybuk> nih and upstart are now valgrind-clean
[02:07] <sadmac> nice
[02:15] <Keybuk> fixed the issue where test_job_process sometimes locks up too
[02:23] <sadmac> ah. don't remember that one
[02:31] <Keybuk> damn
[02:31] <Keybuk> grepping for usage of nih_free() and many of these are quite valid
[02:31] <Keybuk> 1) clean-up in case of function error
[02:32] <Keybuk> but most importantly
[02:32] <sadmac> Keybuk: shouldn't that be an nih_local thing now?
[02:32] <Keybuk> 2) hanging workers
[02:32] <Keybuk> sadmac: not really, since the parent is passed in
[02:33] <Keybuk> here's an example of #2
[02:34] <Keybuk> nih_io_reopen (job, ...)
[02:34] <Keybuk> ie. create an nih_io structure that's a child of job, but never actually make job know about it
[02:34] <Keybuk> it's just doing something on job's behalf
[02:34] <Keybuk> nih_timer_new (job, ...)
[02:34] <Keybuk> in fact, I do this for just about everything
[02:34] <Keybuk> if you free job, the io or timer are automatically cancelled and cleaned up
[02:34] <Keybuk> but they're only doing work on its behalf
[02:35] <Keybuk> many of them are handled from the main loop and self-free
[02:35] <Keybuk> timer's a good example, the main loop frees timers
[02:35] <sadmac> hm
[02:40] <Keybuk> also NihError relies on its quite heavily ;)
[02:40] <Keybuk> but then NihError is an aberration since it's the only part of libnih you can't reference <g>
[02:40] <Keybuk> (except you can now - but don't <g>)
[02:43] <sadmac> Keybuk: ...I have complete working code in another project for try{}catch{}
[02:44] <Keybuk> using setjmp?
[02:44] <sadmac> yeah
[02:45] <sadmac> its amazing what it does to clean up code. especially with the wrapper macros.
[02:45] <Keybuk> usually try looks something like
[02:45] <Keybuk> setjmp, if (! error)
[02:45] <Keybuk> and catch something like
[02:46] <Keybuk> if (error)
[02:46] <sadmac> not quite
[02:46] <sadmac> its if (! error)
[02:46] <sadmac> and else if (error == foo)
[02:46] <sadmac> and a bunch of for loops which don't loop but throw code after the block.
[02:47] <sadmac> but once all the bits are in place
[02:47] <sadmac> if (! bytes = read(...)) { /* handle error in 2 or 3 lines */ }
[02:47] <sadmac> becomes bytes = e_(read(...))
[02:51] <Keybuk> why read?
[02:51] <sadmac> Keybuk: just an example.
[02:51] <sadmac> Keybuk: I have 2 or 3 character wrappers to turn all the varying POSIX errno-based semantics into exception throws
[02:57] <Keybuk> ah
[02:57] <Keybuk> why e_?
[02:57] <Keybuk> oh, I see
[02:57] <Keybuk> dpkg has something a bit different
[02:57] <Keybuk> you push cleanup handler functions with push_cleanup()
[02:57] <Keybuk> and you set checkpoints
[02:57] <Keybuk> if an error occurs, you call ohshit() or ohshite()
[02:58] <Keybuk> that rolls back to the last checkpoint, calling up cleanup handlers on the way
[02:58] <sadmac> Keybuk: I do memory management that way :)
[02:58] <sadmac> Keybuk: Memory is allocated on obstacks, and then simply forgotten about, like it had been malloc'd and there was a garbage collector
[02:59] <sadmac> Keybuk: and then at a few points in the program, particular obstacks are simply dumped out completely
[02:59] <Keybuk> it was one of my original ideas for nih_alloc
[02:59] <Keybuk> that the contexts would match the error handling contexts
[02:59] <sadmac> there's a few cases it doesn't work for. but I'm ok with it varying
[03:29] <sadmac> Keybuk: have you looked at the way lisp does exceptions?
[03:40] <Keybuk> no?
[03:41] <sadmac> Keybuk: its something like this:
[03:42] <sadmac> on_error("fooerror") do { /*closure*/ }
[03:42] <sadmac>  /* stuff that might trigger error */
[03:42] <sadmac> restore_handler("fooerror")
[03:44] <sadmac> we could do it in C, but to do it right we'd need nested functions and pointers thereto (read: trampolines (read: executable stack (read: in pid 1 (read: cancer))))
[03:44] <Keybuk> err
[03:44] <Keybuk> ??
[03:44] <sadmac> Keybuk: they call it signals, and it works a bit like unix signals.
[03:45] <sadmac> Keybuk: you install a function to handle a particular type of error.
[03:45] <sadmac> Keybuk: but its lisp, so this can be done for very granular short-term cases
[03:45] <sadmac> (because defining a function in lisp is simple)
[03:46] <Keybuk> and the function lasts for the inner scope?
[03:48] <sadmac> Keybuk: in most cases. If it makes sense to install a global function as an error handler you do it
[03:48] <sadmac> Keybuk: but the big technical difference is you don't rewind the stack when you get an error. You execute the handler in place. meaning its more likely that you can get at state info and see what happened
[03:49] <sadmac> You then have the /option/ to rewind the stack.
[03:49] <Keybuk> yeah, I often wish you could do that with exceptions in Python
[03:49] <Keybuk> except KeyboardInterrupt:
[03:49] <Keybuk>   bank
[03:50] <sadmac> bank?
[03:50] <Keybuk> any language that has a "pass" keyboard should have a "bank" keyword ;)
[03:51] <sadmac> ...I get the sense there's a language barrier here.
[03:51] <sadmac> is this a British pun?
[03:51] <Keybuk> you have "Weakest Link" in the US, right?
[03:52] <sadmac> we did for a bit
[03:52] <sadmac> don't think we do anymore
[03:52] <sadmac> which is sad
[03:52] <Keybuk> ahh
[03:52] <sadmac> because it was awesome
[03:52] <sadmac> Keybuk: in this system it would look like (in python
[03:52] <sadmac> on_error("KeyboardInterrupt", lambda: pass)
[03:53] <sadmac> # go about your business
[04:08] <sadmac> Keybuk: http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html
[04:11] <Keybuk> I love my test suite
[04:13] <sadmac> I like it too
[04:14] <Keybuk> I feel nice and safe about making far sweeping changes
[04:24] <sadmac> what far sweeping changes are you making now?
[04:26] <Keybuk> I was just thinking in terms of rewriting the fundamental function call that manages memory
[04:32] <sadmac> what will you change?
[04:32] <sadmac> right now isn't it just a realloc?
[04:32] <Keybuk> no, I mean what I've changed
[04:32] <Keybuk> ie. the switch to multi-reference nih_alloc
[04:33] <sadmac> ah.
[05:18] <Keybuk> gnargh
[05:18] <Keybuk> I wish gcc could understand the TEST_ALLOC_FAIL loop
[05:19] <sadmac> what's it doing wrong?
[05:20] <Keybuk> it thinks variables can be unused
[05:20] <Keybuk> err, used unused I mean
[05:20] <Keybuk> used uninitialized
[05:20] <Keybuk> :)
[05:21] <sadmac> we got there eventually
[05:24] <sadmac> damn. every time I commit a 2-line change to a Fedora Infrastructure project, they give me commit access, and it comes with a mailing list that emails me every time someone changes something
[05:24] <Keybuk> heh
[05:24] <Keybuk> we have similar problems
[05:24] <Keybuk> customer bugs as generally private at first, since they often involve NDA hardware
[05:25] <Keybuk> so if you want to read the bug (or have to), they join you to the team working on that hardware
[05:25] <Keybuk> which usually means you get flooded with all the bug traffic, commits,e tc.
[05:25] <sadmac> heh
[05:25] <sadmac> Our IT system at work has public and private comments.
[05:26] <sadmac> Public are... public. Private can be seen by me (the engineer), and either an L2 or a TAM
[05:27] <sadmac> If its an L2, you give your usual nerdy harshing-shit-up spiel about the problem, and the L2 tells the customer in much more polite terms
[05:27] <sadmac> TAMs get you in trouble.
[05:27] <sadmac> rh.com email, but they live, work, and eat with the people having the issue.
[05:27] <sadmac> You try to whisper through them and then realize they're on the other side.
[05:33] <Keybuk> Yeah I've heard about that
[05:33] <sadmac> Its all good, I mean, we're all "on the same side"
[05:33] <sadmac> its just a tone selection.
[06:04] <sadmac> Keybuk: what error should I raise if the reply hasn't been received somehow within the callback?
[06:04] <sadmac> Keybuk: I almost think it should be an nih_assert, since why would dbus have called us if there was no reply?
[06:05] <Keybuk> hmm
[06:05] <Keybuk> if the reply is corrupt you mean?
[06:06] <Keybuk> or missing entirely?
[06:06] <sadmac> Keybuk: dbus_pending_call_steal_reply returns the reply or NULL if none received.
[06:06] <Keybuk> ah, yeah, I'd assert on that one()
[06:06] <sadmac> ok
[06:06] <Keybuk> a more interesting question is what do you do when the arguments in the reply don't match what you're expecting <g>
[06:06] <Keybuk> (call the error handling with the NIH_DBUS_INVALID_ARGS error)
[06:08] <sadmac> the current type error raises ENOMEM. I don't know how that works out...
[06:08]  * sadmac was pretty sure that part of the code was copypasta...
[06:09] <sadmac> also neither of the error conditions for the marshaller unref anything before returning
[06:10] <Keybuk> they all get attached to the message object, I think
[06:10] <Keybuk> which gets unref'd
[06:10] <sadmac> mem_error unrefs reply but type_error doesn't
[06:11] <sadmac> I'm in ur black box, bein white?
[06:11] <Keybuk> dunno, I'd have to read the code again ;)
[06:32] <sadmac> Keybuk: nih_free is type void and takes one type void* right?
[06:36] <Keybuk> returns an int
[06:36] <Keybuk> and takes void *
[06:36] <sadmac> ah, that explains that
[06:36] <Keybuk> oh?
[06:37] <sadmac> Keybuk: why it wasn't a valid DBusFreeFunction
[06:39] <Keybuk> heh
[06:39] <Keybuk> yeah
[06:40] <Keybuk> of course, shouldn't that be nih_discard? :)
[06:41] <sadmac> Keybuk: I hate you >:(
[06:43] <Keybuk> why?
[06:43] <sadmac> stupid discard is for poopy-heads
[06:44] <Keybuk> heh
[06:51] <sadmac> Keybuk: go look at that async branch again
[06:51] <sadmac> bzr+ssh://bazaar.launchpad.net/~cjdahlin/libnih/async/
[06:58] <sadmac> Keybuk: did you get that?
[07:00] <Keybuk> sadmac: I got your branch URL
[07:01] <sadmac> Keybuk: ok, there was nothing after that
[07:01] <sadmac> Nice release name
[07:02]  * sadmac hits McDonalds
[07:02] <sadmac> bbs
[07:15] <sadmac> I return
[07:19]  * Keybuk shall just brain dump review again
[07:20] <Keybuk> you still have the extra names() functions, what are those about?
[07:20] <sadmac> Keybuk: for bulk-passing a group of variables to a function
[07:21] <sadmac> Keybuk: where using vars would yield foofunc(int foo, int bar)'
[07:21] <Keybuk> do you use it anyway?
[07:21] <sadmac> using names would yield foofunc(foo, bar)
[07:21] <Keybuk> oh, I see
[07:21] <sadmac> I use it
[07:23] <Keybuk> mem_error/type_error
[07:23] <Keybuk> you raise the errors then return
[07:23] <Keybuk> which means the errors will get eaten somewhere inside libnih-dbus
[07:23] <Keybuk> I expect you meant to call the error handler there?
[07:23] <Keybuk> style, errno = ENOMEM, nih_error_raise_system () - instead of doing it by hand
[07:23] <sadmac> Keybuk: line number?
[07:23] <Keybuk> 1363..
[07:24] <Keybuk> also missing _() around NIH_DBUS_INVALID_ARGS_STR on 1369
[07:24] <sadmac> Keybuk: copypasta. That should be your code
[07:24] <sadmac> Keybuk: I don't think it gets it. its defined with N_ already
[07:25] <Keybuk> N_ just marks for translation
[07:25] <Keybuk> N_ stuff needs _() called on it later
[07:25] <Keybuk> userdata -> data
[07:26] <Keybuk> NihAsyncNotifyData -> NihDBusPendingCall ?
[07:26] <sadmac> Keybuk: I dunno about that one
[07:26] <sadmac> I don't think those are the same thing
[07:26] <Keybuk> NihDBusCallback_%s -> YourFunctionNameInCapsCallback
[07:26] <Keybuk> NihDBusErrback_%s -> YourFunctionNameInCapsErrorHandler
[07:27] <sadmac> is there a underscore-to-camel converter in this already?
[07:27] <Keybuk> probably not
[07:27] <sadmac> one liner
[07:29] <Keybuk> wouldn't bother with the async_notify_data_free function
[07:29] <Keybuk> just cast it
[07:29] <Keybuk> cf. nih-dbus/dbus_connection.c
[07:29] <sadmac> Keybuk: cf. ?
[07:30] <Keybuk> compare to
[07:30] <sadmac> ok
[07:31] <Keybuk> can you stick a changelog entry on that, and I'll merge it
[07:32] <sadmac> Keybuk: I had just casted nih_free before, and then I moved to the function. If you pop off the top commit you get that one fixed.
[07:32] <sadmac> I'll do a revert commit and then add the changelog and push
[07:33] <Keybuk> if you can be reasonable detailed (at least describe each new function, etc.) that would be muchly appreciated
[07:53] <sadmac> Keybuk: pull
[08:06] <sadmac> and now sleep
[08:38] <keesj> morning
[11:54] <suihkulokki> Keybuk: http://repository.maemo.org/pool/fremantle/free/u/upstart/
[12:01] <keesj> suihkulokki: doing maemo stuff?
[12:34] <suihkulokki> keesj: yes
[12:40] <keesj> as maemo platform developer?
[12:41] <ion_> Nokia is both cool and extremely evil.
[12:43] <keesj> suihkulokki: I also work on upstart for an embedded platform. 
[12:46] <keesj> ion_: it greatly depends at what side of Nokia you look.
[12:57] <keesj> suihkulokki: are you also going to fosdem?
[13:20] <suihkulokki> keesj: unfortunately not this year
[13:46] <keesj> alright
[13:49] <keesj> I am looking into the problems faced while creating as state machine inside upstart
[13:52] <keesj> I currently implmented as upstart job but that gives a few problems
[13:57] <keesj> first of all I can't recieve all events becasue the events don't get send while my state machine is running. for example I did start on event_a or event_b and if emit event_a and event_b one after the oder I can miss the second event
[14:03] <hiciu> I have problem with upstart on armv4 machine (Neo Freerunner)
[14:03] <keesj> what kind?
[14:03] <hiciu> as far as I can see the code works up to line 308 here: http://pastebin.com/d6558c132
[14:03] <hiciu> then it jumps here: http://pastebin.com/d7dbb1990
[14:04] <hiciu> on screen I can see everything up to last "return!"
[14:04] <hiciu> and it stops
[14:05] <hiciu> any idea how to debug it?
[14:06] <hiciu> (the code if from: http://upstart.ubuntu.com/download/0.5/upstart-0.5.0.tar.bz2, compiled with "--exec-prefix=/ --enable-compat=sysv")
[14:09] <Keybuk> hiciu: does "make check" pass?
[14:10] <hiciu> I will check that now
[14:13] <keesj> does that mean that event is NULL?
[14:14] <keesj> hiciu: given the arguments I guess you must be using sbox or compiling on the target?
[14:14] <hiciu> yes
[14:16] <keesj> the only configure magic I have going is adding export ac_cv_func_malloc_0_nonnull="yes"
[14:17] <keesj> but I can't remember why..
[14:18] <keesj> but the configure doesn't use it
[14:29] <keesj> suihkulokki: acting dead mode is battry charging?
[14:31] <hiciu> I mean, under 'sbox2' :)
[14:31] <hiciu> in event_new, on return event != null
[14:32] <hiciu> but it does not pass tests: http://pastebin.com/d2154bba0
[14:33] <Keybuk> you might need to do some porting
[14:33] <keesj> ./.libs/libnih.a: could not read symbols: File in wrong format??
[14:33] <Keybuk> keesj has Upstart working on ARM, I believe?
[14:34] <keesj> yes, I have it running without modifs on qemu-arm and arm11
[14:34] <hiciu> http://pastebin.com/d5b909a81
[14:35] <suihkulokki> keesj: da
[14:35] <suihkulokki> maemo also has upstart workin on arm (obviously)
[14:35] <suihkulokki> but that still 0.3.x
[14:55] <keesj> hiciu: how do you run upstart anyway under qemu?
[14:56] <keesj> (I run a full system including a kernel)
[14:56] <hiciu> i'm running it on freerunner
[15:30] <hiciu> ok, I will try to build it on freerunner (on device, not crosscompiling) later (when I manage to boot freerunner ;]).
[15:31] <hiciu> in meantime, simple bash script should work
[15:31] <hiciu> thanks for help! :)
[15:35] <keesj> :P
[15:36] <keesj> Keybuk: would it be possible to listen to /(and consume) to all the events perfomed by upstart?
[15:37] <keesj> much like 0.3.9 had "initctl events" but with the addition that the event only get probatated once the "jobs" consumed the event
[16:10] <keesj> why can't I gdb --pid 1 ?
[16:11] <sadmac2> keesj: kernel too old?
[16:11] <sadmac2> keesj: (its veeery recent that they made that actually work)
[16:11] <sadmac2> like, during the end of the 0.5.0 dev cycle that started working for me
[16:12] <keesj> thanks for the tip . so .28 or something?
[16:12] <sadmac2> keesj: not quite that recent
[16:13] <sadmac2> 27, maybe late 26
[16:13] <keesj> alright 
[21:56] <KDesk> hi
[21:56] <KDesk> Will upstart 0.5 be in Jaunty?
[22:35] <sadmac> KDesk: I don't think so
[22:36] <KDesk> hi sadmac, isn't it ready, is the version 0.3 better?
[22:38] <sadmac> KDesk: its proven a bit shaky so far (0.5.1 should fix a /lot/ of that). Keybuk could tell you more if he were around
[22:40] <KDesk> sadmac oh, hopefully the new upstart will be in ubuntu some time in the future. Thanks for your explanation.
[23:39] <mbiebl> Keybuk: hi