Re:Plan9 has been forked: 9front
by thristian on Sunday July 17, 2011 @09:30AM
(#2773275)
After having some experience trying to write portable Bourne Shell scripts, I recently came across Tom Duff's paper[1] describing the "rc" shell used by Plan 9. I was quite blown away by the number of common shell-scripting problems it solves, and the elegance of the resulting language. There's no chance of it replacing, say, Python, but I'm sorely tempted to install Plan 9 From User Space and try out rc the next time I need to script something.
Re:Plan9 has been forked: 9front
by guns on Sunday July 17, 2011 @02:03PM
(#2773788)
I was intrigued by your comment and took a look at the rc feature list, but I couldn't see any features that aren't available in bash 3.1 and above.
This takes nothing away from rc of course, which was around when bash was a simple re-implementation of sh, and may very well have been the inspiration for some of bash's modern features. [1]
With regards to scripting, since perl/python/ruby has supplanted shell for moderate to difficult tasks, I think it's perfectly reasonable to use bash/zsh for the occasional simple shell script. Arch Linux, for example, writes rc scripts in modern bash, significantly increasing legibility (given you can read modern bash).
Even if you stick to sh for maximum portability, if you use bash/zsh as an interactive shell, I would strongly encourage diving into the man page; modern shells, for all their shell\ quoting woes, have an amazing amount of concise constructs that make life at the command line quite pleasurable.
[1]: More likely is that Korn shell is the inspiration for both
Re:Plan9 has been forked: 9front
by sigil on Monday July 18, 2011 @02:05AM
(#2775273)
I'm not an rc expert, merely a disgruntled POSIX shell scripter, so here are some attractive rc features [1] missing from sh and bash:
> Rc captures command exit status in the variable $status. For a simple command the value of $status is just as described above. For a pipeline $status is set to the concatenation of the statuses of the pipeline components with | characters for separators.
Both bash and ksh have the pipefail option, which at least makes the pipeline fail if any component fails. (Horrifyingly, POSIX sh lacks even this.) Actually seeing which component failed can be really handy. In other shells, you only get $?.
> Arbitrary file descriptors may be sent through a pipe by typing, for example, "vc junk.c |[2] grep -v ’^$’" This deletes blank lines from the C compiler’s error output.
POSIX sh, bash, and ksh can only connect stdout to stdin across a pipe. Connecting arbitrary descriptors is nice, particularly in logging applications.
> There is no need for the distinction between $* and $@. There is no need for four types of quotation, nor the extremely complicated rules that govern them.
How many people understand the difference between $* and $@ in POSIX sh or bash, or for instance the difference between "$@" and $@? These are critical things any POSIX shell scripter should know, yet I've met very few that actually do. One approach is to educate people about these things. Another is to avoid the need to educate them in the first place.
I like that rc cleans up quoting, which I've seen single-handedly scare developers off of shell scripting.
Re:Plan9 has been forked: 9front
by gcb on Monday July 18, 2011 @03:32AM
(#2775440)
so you call one command and want just to know if it failed... but that command triggered a series of pipes internally, now you have to trim the status mess?
Re:Plan9 has been forked: 9front
by sigil on Monday July 18, 2011 @11:53AM
(#2776776)
but that command triggered a series of pipes internally, now you have to trim the status mess?
No. If you run an external command from an rc script, ie the shell is doing the fork and exec for you, then $status will have a single number just like $?.
It doesn't matter if the external command is an rc script that, internally, runs a pipeline at the end. You will only get a multi-status if the previous statement within the current rc script was a pipeline. Under sh, bash, or ksh, people rarely bother to look at $? in this situation, since it's either potentially irrelevant (without -o pipefail), or you don't know which program it's from (with -o pipefail).
so you call one command and want just to know if it failed
Re:Plan9 has been forked: 9front
by anon_d on Sunday July 17, 2011 @08:29PM
(#2774636)
rc solves problems with sh by replacing annoying/problematic features. bash adds the same features, but keeps all the problems with sh. Read the "Design Principles" section for specific examples.
Re:Plan9 has been forked: 9front
by uriel on Sunday July 17, 2011 @10:59AM
(#2773393)
rc is a truly beautiful thing.
I wrote a pretty complex web framework and CMS with it ( http://werc.cat-v.org ), and the more I used it, the more I loved it.
I found it to be extremely well crafted, with every feature fitting beautifully with the rest, it misses many fancy things people expect, but once you know your way around what it has, you can do almost anything.
Like awk, is one of those few languages that you can fully keep in your head, and that plus the power of calling other Unix/Plan 9 commands makes it very effective.
Re:Plan9 has been forked: 9front
by rednaught on Sunday July 17, 2011 @01:43PM
(#2773739)
Thanks for creating that framework. I had seen it in use a few times but it didn't dawn on me until reading your comments above the relation to Plan 9.
Re:Plan9 has been forked: 9front
by EthanG on Sunday July 17, 2011 @05:14AM
(#2772912)
Oh no, they're taking us seriously! Quick, add more swastikas!
Heh, seriously, 9front development is done more in fun than anything else, but the 3 main developers are sufficiently talented that rapid progress is being made in several areas where most 9fans tend to struggle. Not only that but 9front's developers seem to be very good at avoiding getting bogged down in peripheral features which divert effort from the drivers and cleanups which Plan 9 really needs.
Re:Plan9 has been forked: 9front
by rkalla on Sunday July 17, 2011 @09:36AM
(#2773285)
Ethan, the fun vibe of the project really shows through. I think it is inspiring and inviting. Glad to see you guys having fun with some really cool tech. Keep pushing it forward and keeping us posted!
The native Go integration was a really good move; a lot of interested cross-overs I am sure from the Go community will get into 9front because of that attractive piece.
Re:Plan9 has been forked: 9front
by mycroftiv on Sunday July 17, 2011 @04:30AM
(#2772843)
I see several good things on the list of new features. The rc-based boot process is definitely a good idea. I haven't had the issues with the fossil filesystem that some have, so I don't know about cwfs as the main on-disk fileserver, but I'm looking forward to trying it out. A lot of the contributors have been doing good things in the Plan 9 world for quite awhile now. A list of some of the new features is at http://code.google.com/p/plan9front/wiki/features
Re:Plan9 has been forked: 9front
by 1337p337 on Sunday July 17, 2011 @12:59PM
(#2773632)
The IRC channel (#cat-v on freenode) has been extra helpful and responsive. I've now got 9front mostly up and running on qemu and my T60, thanks to devs fixing drivers on the fly while I passed along screenshots of error messages. I've been interested in hacking on Plan 9 for a while but have had little luck getting it to boot before 9front (even 9atom).
A couple of years down the road, it would be delightfully perverse to end up with Plan 9 running in the server room and Linux/OSX on the devs' desktops. Maybe unlikely, but fun to consider.
Re:Plan9 has been forked: 9front
by cdcarter on Sunday July 17, 2011 @03:40AM
(#2772782)
This is the first big step to actually creating an ecosystem for plan9. It's a fantastic OS, though there's not much I can do with it, unfortunately. Maybe that will change now!
Re:Plan9 has been forked: 9front
by RexRollman on Sunday July 17, 2011 @12:33PM
(#2773572)
Personally, when considering the number of ex-Bell Labs employees there, I had hopes that Google would pick up the rights to Plan 9 and continue it. Plus, Google has the deep pockets needed to ensure proper device driver support for modern hardware.
Re:Plan9 has been forked: 9front
by katovatzschyn on Sunday July 17, 2011 @02:42PM
(#2773875)
Maybe it's not reasonable now or ever but I'd quite love to think of Google as a company capable of doing things that are immensely interesting but have no obvious, immediate, practical "use."
I don't know if they are there quite yet. It seems to me that they still strongly incentivize shipping products and making things people will use within in their corporate culture. I might be wrong. There could be a light coming on.
Re:Plan9 has been forked: 9front
by thristian on Sunday July 17, 2011 @11:17PM
(#2774965)
The linked web-page spells out the full name as "Plan 9 from the People's Front of cat-v.org" - perhaps a reference to the "Judean People's Front/People's Front of Judea" split described in Monty Python's Life of Brian.
Re:Plan9 has been forked: 9front
by rkalla on Sunday July 17, 2011 @09:32AM
(#2773278)
It takes no effort to be a wet blanket; all you have to do is lie there, covered in water, and drown out anyone else trying to do anything.
How many emails/comments/posts EXACTLY like what you just wrote happened in 1991?
No one is saying what Plan9 will or won't become, but that also means you have no idea where it is going in 10 years or what fun innovations will come out of it.
Don't make a habit of shitting on people thinking outside the box, you'll miss a lot of interesting things.
Re:Plan9 has been forked: 9front
by 1337p337 on Sunday July 17, 2011 @12:45PM
(#2773603)
Even if Plan 9 and 9front go nowhere, the ideas have already crept into other operating systems and userland tools. Linux has had 'mount --bind' for a while, and has last year introduced in-kernel support for 9P2000 (for mounting Plan 9 resources). bash and gawk have some weak support for interacting with the network via the filesystem. wmii actually speaks 9P2000 and uses it for scripting.
[1]: http://doc.cat-v.org/plan_9/4th_edition/papers/rc
This takes nothing away from rc of course, which was around when bash was a simple re-implementation of sh, and may very well have been the inspiration for some of bash's modern features. [1]
With regards to scripting, since perl/python/ruby has supplanted shell for moderate to difficult tasks, I think it's perfectly reasonable to use bash/zsh for the occasional simple shell script. Arch Linux, for example, writes rc scripts in modern bash, significantly increasing legibility (given you can read modern bash).
Even if you stick to sh for maximum portability, if you use bash/zsh as an interactive shell, I would strongly encourage diving into the man page; modern shells, for all their shell\ quoting woes, have an amazing amount of concise constructs that make life at the command line quite pleasurable.
[1]: More likely is that Korn shell is the inspiration for both
> Rc captures command exit status in the variable $status. For a simple command the value of $status is just as described above. For a pipeline $status is set to the concatenation of the statuses of the pipeline components with | characters for separators.
Both bash and ksh have the pipefail option, which at least makes the pipeline fail if any component fails. (Horrifyingly, POSIX sh lacks even this.) Actually seeing which component failed can be really handy. In other shells, you only get $?.
> Arbitrary file descriptors may be sent through a pipe by typing, for example, "vc junk.c |[2] grep -v ’^$’" This deletes blank lines from the C compiler’s error output.
POSIX sh, bash, and ksh can only connect stdout to stdin across a pipe. Connecting arbitrary descriptors is nice, particularly in logging applications.
> There is no need for the distinction between $* and $@. There is no need for four types of quotation, nor the extremely complicated rules that govern them.
How many people understand the difference between $* and $@ in POSIX sh or bash, or for instance the difference between "$@" and $@? These are critical things any POSIX shell scripter should know, yet I've met very few that actually do. One approach is to educate people about these things. Another is to avoid the need to educate them in the first place.
I like that rc cleans up quoting, which I've seen single-handedly scare developers off of shell scripting.
[1] http://doc.cat-v.org/plan_9/4th_edition/papers/rc
thankfully truly posix stuff doesn't have it
No. If you run an external command from an rc script, ie the shell is doing the fork and exec for you, then $status will have a single number just like $?.
It doesn't matter if the external command is an rc script that, internally, runs a pipeline at the end. You will only get a multi-status if the previous statement within the current rc script was a pipeline. Under sh, bash, or ksh, people rarely bother to look at $? in this situation, since it's either potentially irrelevant (without -o pipefail), or you don't know which program it's from (with -o pipefail).
so you call one command and want just to know if it failed
This works perfectly fine in rc:
From the rc docs:> Any $status containing only 0’s and |’s has boolean value true. Any other status is false.
There is nothing weird about ifs' behavior once you understand it.
Byron's rc tried to 'fix' ifs, and made everything worse.
I wrote a pretty complex web framework and CMS with it ( http://werc.cat-v.org ), and the more I used it, the more I loved it.
I found it to be extremely well crafted, with every feature fitting beautifully with the rest, it misses many fancy things people expect, but once you know your way around what it has, you can do almost anything.
Like awk, is one of those few languages that you can fully keep in your head, and that plus the power of calling other Unix/Plan 9 commands makes it very effective.
Heh, seriously, 9front development is done more in fun than anything else, but the 3 main developers are sufficiently talented that rapid progress is being made in several areas where most 9fans tend to struggle. Not only that but 9front's developers seem to be very good at avoiding getting bogged down in peripheral features which divert effort from the drivers and cleanups which Plan 9 really needs.
The native Go integration was a really good move; a lot of interested cross-overs I am sure from the Go community will get into 9front because of that attractive piece.
A couple of years down the road, it would be delightfully perverse to end up with Plan 9 running in the server room and Linux/OSX on the devs' desktops. Maybe unlikely, but fun to consider.
http://plan9.stanleylieber.com/9front/
I don't know if they are there quite yet. It seems to me that they still strongly incentivize shipping products and making things people will use within in their corporate culture. I might be wrong. There could be a light coming on.
lol
How many emails/comments/posts EXACTLY like what you just wrote happened in 1991?
No one is saying what Plan9 will or won't become, but that also means you have no idea where it is going in 10 years or what fun innovations will come out of it.
Don't make a habit of shitting on people thinking outside the box, you'll miss a lot of interesting things.
It's not GPL-compatible, but it's definitely Free.
http://plan9.bell-labs.com/plan9/license.html
http://www.gnu.org/licenses/license-list.html#lucent102