Conversation with #inferno at Fri Nov 23 18:58:14 2012 on powerman-asdf@irc.freenode.net (irc) (19:04:17) Aram [~aram@unaffiliated/aramdune] entered the room. (20:52:45) jbrhee [~jess@cpe-76-174-171-57.socal.res.rr.com] entered the room. (21:22:02) Aram left the room (quit: Quit: .). (23:33:44) raphaelsc [~raphaelsc@187-127-57-95.user.veloxzone.com.br] entered the room. (01:51:49) raphaelsc left the room (quit: Remote host closed the connection). (04:49:56) raphaelsc [~raphaelsc@187-127-57-95.user.veloxzone.com.br] entered the room. (05:29:54) raphaelsc left the room (quit: Quit: Leaving). (05:54:52) raphaelsc [~raphaelsc@187-127-57-95.user.veloxzone.com.br] entered the room. (06:25:08) flazz [~flazz@2001:4800:780e:510:8f7b:f0fa:ff04:5a20] entered the room. (06:26:14) flazz: i just got inferno running on osx, where are some good docs to start with, and why does emu quit when i press delete? (06:29:00) leetspete: flazz: Congrats! What do you want to start doing, and where are you pressing delete? (06:29:26) flazz: i was pressing delete to remove the text i didn't want (06:29:50) leetspete: In raw emu, or inside a shell in the wm? (06:30:03) flazz: i started emu from my terminal (06:30:15) flazz: i believe it loads up rc? (06:31:19) leetspete: Ah. It starts up a shell, but I'd not be surprised if it does the Plan 9-ish behavior of Delete meaning ^C. (06:31:47) flazz: wow, strange. so what is this wm thing you talk about? (06:31:57) leetspete: I didn't bump into that on OSX, but I used rlwrap to interact with emu. (06:32:06) flazz: ahh (06:32:18) leetspete: rlwrap -a, to be specific; emu wants your terminal. (06:32:58) leetspete: The wm is the window manager. MJL used to have a pretty good introduction, but his site's emptied out recently and his code moved to bitbucket. (06:33:33) leetspete: Ah, it's still there: http://www.ueber.net/who/mjl/inferno/getting-started.html (06:34:05) flazz: rlwrap -a works great thanks, i read some pages a while back from some guy who is using inferno at work (06:34:21) flazz: blew my mind how /env is the current procs env (06:34:23) leetspete: That may have been me. :) (06:34:41) flazz: thanks for that! :) (06:35:03) leetspete: Glad you enjoyed it. :) Actually, shortly after posting that, I resigned, haha. (06:35:27) flazz: from that job? (06:35:57) leetspete: Yeah. It was a little nuts overall. The work was fine, though, and it was nice getting to use Inferno. (06:36:13) leetspete: A few things you'll (probably) want to do before starting wm/wm: (06:36:19) flazz: sure (06:40:52) flazz: ? (06:42:09) leetspete: Sorry, had to sanitize my script. Was typing them all out, but realized that since the script has a few comments, it might be better to just paste it. (06:42:26) leetspete: http://unsane.reverso.be/basic-init.sh.txt (06:43:00) leetspete: I usually run that before running the wm. (06:43:25) flazz: thanks (06:43:27) leetspete: Inferno's default environment is spartan to put it mildly. :) (06:43:40) flazz: this is a good opportunity to learn what it does too (06:44:35) leetspete: You will also probably want to copy the inferno user's homedir ($wherever_inferno_is/usr/inferno) to a home directory for yourself. (06:45:33) flazz: so $wherever_inferno_is/usr/ is the equivalent of /home? (06:45:43) leetspete: Yeah. (06:46:09) leetspete: As it turns out, ancient Unix used /usr instead of /home, but then historical accidents created /home. (06:46:48) flazz: stupid questinon, how do i get that script into inferno? is the inferno fs just layered on top of $wherever_inferno_is on the host os? (06:47:21) leetspete: Yeah. Inside Inferno, / is the host OS's Inferno root. (06:47:26) leetspete: Not a stupid question. :) (06:47:49) leetspete: So if you've installed it into /usr/inferno, that'll show up as / inside Inferno. (06:48:07) leetspete: I've stuffed it into /usr/pete/dis/base-init. (06:49:14) flazz: dis is the name of the vm right? and a dir named dis would imply something like bin? (06:49:43) leetspete: MJL's document is pretty good for explaining what the paths mean, but the high-level summary is that executables are in /dis, random mountpoints live under /n, and services usually expose themselves under /mnt. (06:49:47) leetspete: Yeah, exactly. (06:50:20) flazz: the mjl oneis gone, do you know another copy? (06:50:20) leetspete: The tinytk bind command in that script is subjective; I like them more than the regular icons. (06:51:06) leetspete: And you may want to adjust the time zone bind if you're not on the US west coast. (06:52:38) leetspete: The MJL one (luckily) still exists, but isn't linked from his home page any more. The URL ought to work. (http://www.ueber.net/who/mjl/inferno/getting-started.html) (06:53:07) flazz: sweet, i was getting a 404 (06:53:12) flazz: must have mispasted (06:54:32) leetspete: And being on OSX, you'll also probably want to adjust the "and {ftest -d '#U*/home/'^$user} {bind -c '#U*/home/'^$user /n/home}" line to use /Users instead of /home. (06:55:06) flazz: will do (06:56:15) leetspete: If you don't mind sharing homedirs, you could just replace that with "bind -bc '#U*/Users' /usr". I personally hate having to see the 10k or so dotfiles Linux stuffs in my home directory, though. (06:56:30) flazz: so that last line mounts my home dir inthe host os under /n/home ? (06:56:58) flazz: that is my first instinct (sharing homes) (06:57:06) leetspete: Yeah. Devices are under a special path in Inferno/Plan 9, that starts with '#'. (06:58:04) leetspete: 'cat /dev/drivers' will get you a list of them. The host OS's full filesystem (except on Windows, where there's some drive letter wonkery that I don't remember), '#U*/' is the root of the host OS's filesystem. (06:58:27) leetspete: You can cd to it like anywhere else, but I tend to mount some bits of it under /n/$foo for convenience. (06:59:26) flazz: cool, also what is the pager called? or should i be using the wm? (07:00:21) leetspete: The pager is 'p', but overall things are nicer if you use the wm. The typical way to start it is 'wm/wm&' from inside emu, or (depending on what you want to do) 'wm/wm wm/logon [-u $user]'. (07:00:46) flazz: will i need a 3 button mouse? (07:01:31) leetspete: I always use one. I believe there are some combinations of control/shift/command/alt/whatever that let you click other buttons on a single-button mouse. (07:02:23) leetspete: It's pretty usable even without one, although copying and pasting can be a chore if you don't have it. (07:03:07) leetspete: And acme is basically impossible to use without that. (07:04:22) flazz: to make the basic-init executable chmod just like unix? (07:05:15) leetspete: Yep. It runs under 'sh -n', so it doesn't fork the namespace, so the shell that runs it will be able to see the stuff it mounts, etc. (07:05:48) leetspete: The shell's equivalent of bash's 'source'/'.' is 'run', so there's that, too. (07:06:04) flazz: ahh (07:06:24) flazz: i was just running it, but i guess the state changes would not go back to the parent proc (07:06:46) leetspete: Yeah, except for the -n flag passed to the shell in the #! line. (07:06:59) leetspete: So they make it back to the parent. (07:07:37) flazz: so much to learn (07:08:12) flazz: that is what you meant by forking the namespace (07:08:22) flazz: so its complaining about /usr/flazz/lib/plumbing not existing (07:09:08) leetspete: Yeah. You'll need to copy the contents of the inferno user's home dir to wherever your home dir is. (07:09:26) leetspete: It has some basic plumbing, most of the directories you'll need, etc. (07:09:50) flazz: shouldn't i be able to "mount or bind" it as some sort of a prototype? (07:10:29) leetspete: You can, yeah, but it means your changes will end up there. (07:10:43) flazz: hmm (07:12:19) leetspete: It's nearly transparent for reads, but basically, the rules are that when you write a file, the OS looks for a directory with that name, and then finds the first one in the process's namespace that is writable. (07:14:29) leetspete: $home/lib/plumbing is actually kind of incredible. It's essentially pattern->conditions->action for anything sent to 'the plumber'. Right-clicking in the shell plumbs something, for example. So if you look at the section for things resembling man pages, it has something that pops up the man page viewer. (07:16:33) leetspete: You do an ls, an image shows up, right click and the image viewer shows the image. Sort of like a more powerful version of OSX's open(1). (07:17:58) flazz: wow, i just did (07:19:17) leetspete: Yeah. It uses brutus for a lot of stuff by default. I can't quite recommend it as an editor, but it and wm/edit do a little nicer job of not requiring many mouse buttons. (07:19:56) flazz: so far two finger tap works as right click fine, and three finger drag can move windows (07:21:51) leetspete: Nice. It might be a bit of a pain when you need to hold a mouse button down to get a menu or something, but you can get by without that. (07:22:40) flazz: is there a way to make the wm's window larger? (07:23:46) leetspete: Inferno uses a fixed size on boot. (I hear rumors that there have been efforts to fix this.) (07:24:02) leetspete: So, you will need to pass -gXxY to it. (07:24:14) flazz: hah, fair enough (07:24:33) leetspete: I was on a 1080p monitor and I full-screened it, so I always started with -g1920x1080. (07:26:07) leetspete: (I didn't want to carry personal *and* work laptops around, so I just left the work laptop plugged into monitor/mouse/keyboard and pretended it was a desktop with a UPS.) (07:33:24) flazz: thanks a bunch for getting me started, i'm heading out for the night. (07:35:00) leetspete: Sure thing! (07:35:21) leetspete: I'm around here semi-frequently, and happy to help when present. :) (07:36:15) leetspete: I'm going to be heading out in a few anyway, so the timing's good. (08:24:43) powerman-asdf: leetspete: I'm using few more tricks to setup initial environment, which you may find useful. I'll gather everything together to show, 1 min… (08:26:50) powerman-asdf: first is /lib/sh/profile (which is empty by default): http://pastebin.com/XL7uwEKM (08:28:32) powerman-asdf: your way to create real dir for new users in /usr will work if inferno installed by your host OS user in his home, and fail if it installed system-wide in /usr/inferno/ by root (08:29:31) powerman-asdf: also, I found it _very_ useful to dynamically define where is inferno user's home dir actually located on host os filesystem (08:31:01) powerman-asdf: for example, I'm running a lot of separate inferno projects/services using same host os user account (me), but I'd like each of these services to have it's own home directory, with it's own ~/keyring/, own ~/profile, etc. (08:33:42) powerman-asdf: so, all I need to do is: (08:33:42) powerman-asdf: $ cp -r /usr/inferno/usr/inferno ~/new-inf-proj (08:33:42) powerman-asdf: $ INFERNO_HOME=~/new-inf-proj emu-g (08:34:37) powerman-asdf: and I got contents of host os ~/new-inf-proj/ available in /usr/powerman inside emu while host os doesn't even have real /usr/inferno/usr/powerman/ (08:40:33) powerman-asdf: second trick is about your ~/dis and ~/lib - I'm prefer to use /opt hierarchy instead to make non-standard apps/modules available. using /opt is better in many ways, this was already discussed here few times, you can search irc archives if you like to get full background (08:45:26) powerman-asdf: inferno already has /opt mountpoint for this, but it's empty. there should be companion script opt(1) to setup /opt (mentioned in /opt/README), but it isn't exists yet. I'm using this script to setup /opt: http://pastebin.com/HnuDZhXh (08:47:26) powerman-asdf: I suppose it will become opt(1) when Charles close this ticket http://code.google.com/p/inferno-os/issues/detail?id=261 (08:48:01) powerman-asdf: but for now I keep it in my ~/opt/setup.sh (08:48:44) powerman-asdf: then, in ~/namespace: bind -b opt /opt (08:48:44) powerman-asdf: and in ~/profile: /opt/setup.sh (08:50:43) powerman-asdf: this way you can keep your stuff like own modules/apps in /opt/leetspete/PROJNAME/ in nice self-contained and ease to distribute hierarchy (with appl/lib/, appl/cmd/, module/, dis/, mkfiles, etc. in each project's dir) (08:52:22) powerman-asdf: last trick is about console sh usability. add this to ~/profile: (08:52:22) powerman-asdf: fn . { args:=$*; if {! ~ $#args 0} { .=$* }; $. } (08:52:58) powerman-asdf: this way you can easily repeat any command: (08:52:58) powerman-asdf: ; . echo ok (08:52:58) powerman-asdf: ok (08:52:58) powerman-asdf: ; . (08:52:58) powerman-asdf: ok (08:56:52) powerman-asdf: also, to make it possible to develop projects in /opt (i.e. run limbo to compile/check syntax; run mk to build and run tests) both in host os and within inferno you may need some extra configuration. large part of setup is done in mkfiles, you can see examples in my projects: http://code.google.com/hosting/search?q=inferno-contrib (08:57:34) powerman-asdf: probably it's worth to prepare skel for new project with all mkfiles ready to go (09:01:05) powerman-asdf: I'm not sure is I found all pieces, here is what I see right now: (09:01:05) powerman-asdf: ~/.bashrc: function mk() { /usr/inferno/Linux/386/bin/mk "$@" ROOT=/usr/inferno; } (09:01:05) powerman-asdf: $INFERNO_HOME/profile: fn limbo { builtin limbo -I/ $* } (09:04:10) powerman-asdf: in host os "mk ROOT=" is needed to use things like "<$ROOT/mkfiles/mksubdirs" in mkfiles when running mk in host os (09:12:24) powerman-asdf: next, when running limbo in host os it should have -I$INFERNO_HOME param, to find everything in your $INFERNO_HOME/opt you may need to build current app/module. this is archived by using "LIMBOFLAGS=$LIMBOFLAGS -I$INFERNO_HOME" in mkfiles and by adding this -I param to limbo configured as syntax checker in your host os IDE (vim? :)) (09:13:15) powerman-asdf: when running limbo inside emu everything already bind to /opt, so using -I/ in "fn limbo" above will do the same thing (09:14:22) powerman-asdf: as result you can use /opt modules in any app in this way: (09:14:22) powerman-asdf: include "opt/powerman/tap/module/t.m"; (09:14:22) powerman-asdf: and be able to compile it both in host os and in emu (09:16:34) powerman-asdf: I've also extra setup in mkfile for tests, which let me run tests both using "mk test" (which work both in host os and emu), and using "prove -r" (perl's standard way to run tests), which output test results in much more readable way than "mk test" (09:20:03) leetspete: powerman-asdf: Cool! Reading backlog... (09:23:32) leetspete: 'fn .' is really neat. (09:24:38) powerman-asdf: yep. someone show it to me many years ago, either here or in maillist (09:29:12) leetspete: As far as the bash stuff, I don't actually pop outside Inferno for much any more besides IM and browser. :) (09:30:16) leetspete: I was thinking actually of using bitlbee and ircfs, but ircfs needs a bit of modification. (09:31:30) leetspete: As I recall, it was just changing a thing that handles hosts into handling net!host!port, so that I could run bitlbee on a different port. In retrospect it seems easy, but there was something that looked painful that kept me from doing it, so I may be forgetting something. (09:33:25) leetspete: I'd followed some of the /opt discussions. I like the versioning stuff, but /opt feels a little odd to me overall. (09:33:47) powerman-asdf: one more dev-related thing is documentation. that's have a lot with personal preferences, but I hate troff - it makes not really fun task of writing docs really painful. so I've developed backend for asciidoc which let me convert asciidoc documents to inferno man pages and make mkfile to get doc compiled/installed in man/2/ by project's "mk install" (09:34:59) leetspete: Nice! (09:37:41) leetspete: I'd never learned troff, unfortunately. I'm working on getting better with yacc recently, though. (09:39:32) powerman-asdf: the /opt make it really ease to use, distribute and install extra modules/apps. but it really feels a little odd when you setup it for the first time. good news is you need to do this just once. :) (09:40:45) leetspete: I mean the concept is a little odd to me. Not necessarily bad, but odd. :) (09:42:21) powerman-asdf: I think part of this feeling happens because /opt/setup.sh is somewhat ugly and not as trivial as it feels should be. But that has a lot with general recursive bind issues, and there is no ideas how to solve it now AFAIK. (09:43:16) powerman-asdf: Part happens because of long "opt/author/app/module/INEEDTHIS.m" which also feels needlessly redundant. (09:44:04) leetspete: Yeah, that's my feeling roughly. I'm still just stuffing things into /dis, /dis/lib, /lib, etc., and anything I don't want system-wide, I put in $home/whatever. (09:47:25) powerman-asdf: if you drop everything in ~/dis, ~/lib etc. then it quickly become unmanageable - actually, this happens as soon as you try to use someone else's stuff or try to distribute your own. upgrading/uninstalling/etc. quickly become a nightmare - this already happens in all OSes before (09:49:04) powerman-asdf: using simultaneously different versions of same app/module also nearly impossible in this way (but it's rarely needed in real world) (09:50:06) leetspete: Yeah. I understand the trickiness. :) (09:51:01) leetspete: Long-time Linux user. :) GTK is the bane of my existence, haha. (09:51:08) doublec: Is there a way to recursively grep through directories? (09:51:21) doublec: I use this often from linux to grep through a large code base (09:51:36) leetspete: doublec: grep [stuff] `{du -an | grep some-filter} (09:51:36) doublec: (or rather I "os find" a lot) (09:51:59) doublec: thanks! (09:52:32) leetspete: MJL did an implementation of find that is Inferno-ish but more like what one expects from find(1). (09:53:02) leetspete: doublec: https://bitbucket.org/mjl/find (09:53:42) powerman-asdf: I just trying to say the concept of ~/dis is much more odd than /opt. :) So, while I 100% agree with /opt oddness, it's still best available way to go. Maybe mjl's way with system-wide "mk install" is also an option, but it probably will require some "package manager" like ports in *bsd or portage in Gentoo to make it ease to manage installed packages. (09:54:37) leetspete: Yeah. Package management is unfortunate. (09:55:26) powerman-asdf: probably it's should be s/probably/surely/. because we've already seen plain "make install" in *nix and it quickly result in same unmanageable system with a lot of conflicting junk installed (09:55:50) leetspete: I like CRUX's: "there is a tarball, installation untars it and remembers what files were in it, uninstallation rm's those files". I like it better than Debian's or Gentoo's, but still less than ideal. (09:57:19) powerman-asdf: also I think /opt is good because it force you to package your stuff in standard way, so if we at some point move from /opt to some mk install-based package management it will be easier to convert (or just use) /opt packages than random files in ~/dis (10:02:30) powerman-asdf: tarballs works ok only for really trivial packages. when it comes to updating config files, or pre/post-install scripts, or managing dependencies - it just fails. at this point your begin to extend it with "special" dirs/files in tarball which should be automatically executed on install/uninstall and since this point it doesn't "tarball" anymore - it become rudiment of normal package management system with a lot of weaknesses (10:04:14) leetspete: Hm...I wonder why have to convert? Just thinking aloud, but using the regular '