/srv/irclogs.ubuntu.com/2012/10/09/#bzr.txt

=== mmrazik is now known as mmrazik|otp
=== mmrazik|otp is now known as mmrazik
mgzmorning08:11
=== mmrazik is now known as mmrazik|lunch
=== mmrazik|lunch is now known as mmrazik
=== mmrazik is now known as mmrazik|afk
=== mmrazik|afk is now known as mmrazik
=== deryck is now known as deryck[lunch]
=== deryck[lunch] is now known as deryck
=== slank` is now known as slank
exarkunhi, I wonder if anyone who knows about the smart server jail saw my question in the logs from the weekend and can shed some light on my issue19:29
* fullermd has half of that covered 8-}19:30
lifelessexarkun: I did not.19:47
lifelessexarkun: I might be able to.19:47
fullermdlifeless: He was doing something with writing some file in a hook, that complained about jailbreaking.19:48
fullermdI can probably dig up the logs...19:48
fullermdhttp://paste.ubuntu.com/1269933/  is a quick block of it.19:55
exarkunah, a keyboard20:09
exarkunfullermd: thanks20:09
exarkunlifeless: any thoughts?20:09
lifelessexarkun: ok20:22
lifelessexarkun: can I see your hook ?20:22
exarkunlifeless: http://twistedmatrix.com/~exarkun/restart_server.py20:22
lifelessexarkun: which line throws the error ?20:23
exarkunoh, codepad.org is broken :(  http://pastebin.com/KkUbcrAJ20:25
exarkunline 30, params.branch.create_checkout(to_location=checkout.path, lightweight=False)20:25
exarkunlightweight=True succeeds20:25
lifelessok20:29
lifelessso here is what I suspect is happening20:29
lifelessfirstly the jail20:29
lifelesswhat happens is that code in the server runs with a transport url like chroot-1234://foo20:29
lifelesswhere // is rooted at the repository20:29
lifeless / branch (may be distinct for distinct verbs, I'd need to check)20:30
lifelessthis is so that code can't accidentally traverse up outside the repository20:32
lifelesse.g. due to bugs20:32
lifelessits only a soft chroot through20:32
lifelessyou can escape it by opening a new transport on local disk / memory / wherever20:32
lifelessor by poking through the chroot object innards20:32
lifelessso, lightweight=True has no reason to chdir to .. repeatedly20:33
lifelessbecause its using the branch and the branches repository20:33
lifelesslightweight=False has to search for a containing repository to reuse for its new branch20:34
lifelessexarkun: if you look in bzrlib/smart/request.py you'll see that the pre_open_hook has a list of allowed transports, thats thread specific20:35
lifelessexarkun: and knows to translate file:// into any of those transports (by mapping across).20:35
lifelessexarkun: so, long story short, you probably want to explicitly allow the transport you're going to be using20:36
lifelessthe jail is entirely there to prevent awfuck moments when you delete your hard drive due to a badly written hook that assumes its running in a user context, for instance.20:37
exarkunI don20:38
exarkun't see an API for adding to the allowed transports though20:39
exarkunShould I just mutate the thread-local directly?20:39
lifelessexarkun: yes, its a public symbol20:45
lifelessexarkun: bzrlib.smart.request.jail_info.transports.append(transport.open('file:///home/foo'))20:46
lifelessor whatever20:46
exarkunhee hee, "symbol"20:46
lifelessattribute20:46
lifelessdoohicky20:46
lifelessthingamy20:46
exarkunfile:///home/foo doesn't have to be a bzr branch or repository or anything?  I don't really know what a bzrlib transport is.20:47
=== ccxCZ_ is now known as ccxCZ
lifelessexarkun: a transport is just a vfs directory20:59
exarkunlifeless: Thanks.21:22
exarkunlifeless: Regarding the transport.open, I don't see a bzrlib.transport.open function.  Maybe get_transport?21:22
exarkunHm, seems not, with the result of get_transport appended to the list, I still get a jail error.21:24
exarkunlifeless: Once I add get_transport('file:///home/foo'), the error just changes to be about file:///home/21:26
exarkunI guess I could just add file:///21:26
lifelessexarkun: there is/was a standalone=True you could pass I think21:36
lifelesswhich would tell it not to seek a containing repository21:36
exarkunI used file:/// it works :/21:38
exarkunthus ends my interest in the matter for the time being21:38
exarkunthanks again for getting me there21:38
lifelessexarkun: np21:38

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!