Fault Tolerant Shell
Paul Howe writes "Roaming around my school's computer science webserver I ran across what struck me as a great (and very prescient) idea: a fault tolerant scripting language. This makes a lot of sense when programming in environments that are almost fundamentally unstable i.e. distributed systems etc. I'm not sure how active this project is, but its clear that this is an idea whose time has come. Fault Tolerant Shell."
Also, I would appreciate (not quite the same) a auto-completing python interpreter and editor (which can complete methods and objects from modules)... Such kind of stuff really increases productivity !
Spelling mistakes: My is english spoken not tongue of mother.
The real benefit is in having a system which is sufficiently distributed that any program running on top of it can continue to do so despite any sort of underlying failure.
Blaming GW Bush for the Iraq war is like blaming Ronald McDonald for the poor quality of food.
It's a well meaning idea, but it would cause more problems than it would solve. It would just encourage sloppy code; people would rationalize "I don't need to fix errors because it doesn't matter", which is a very bad habit to get into when programming, ignoring errors, or even warnings
... or probably Perl or Python, either.
It doesn't actually seem to grok the commands that are being run, so something like
proc try {times script} {
if { [catch [uplevel $script] err] } { cleanup ; retry }
}
is all that's needed (of course to do it right you'd need a bit more, but still...).
try {5 times} {
commands...
}
Although Tcl is a bit lower level, and would require you to do exec ls, you could of course wrap that too so that all commands in the $script block would just be 'exec'ed by default.
In any case, better to use a flexible tool that can be tweaked to do what you need then write highly specialized tools.
http://www.welton.it/davidw/
This will not improve people's skills. In fact, it willl make them more prone to mistakes, and more likely to get the result that they didn't expect. It's similat to computer spell checkers. Ever since people started relying on these, their spelling has gone way downhill simly because they don't bother thinking. Computer do all the spelling for them. They don;t need a spell checker. They need spelling lessons.
This si even worse. Computers will try to second guess what the user means, get get it wrong half tyhe time.
A qualified shell scripter will be not make these mistakes in the first place. Anyone who thinks they need this shell actually just need to learn to spell and to ytype accuratly.
auto-completing python interpreter and editor
An auto completing Python interpreter and editor:
Pythonwin (Windows only).
When it expands a class or module, select the one you want with the up and down arrows (or just keep typing to narrow the selection down), then press tab to select it.
While, yes, you manage distributed systems from the center, you don't *push* updates, changes, modifications because, it doesn't scale. You end up having to write stuff like this fault tolerant shell which is frankly backwards thinking.
Instead, you automate everything and *pull* updates, changes, scripts etc. That way if a system is up, it just works, if it's down, it'll get updated next time it's up.
I won't go into details but I'll point you at http://infrastructures.org/
Government of the people, by corporate executives, for corporate profits.
on a loosely configured network, not saying this tool doesn't seem interesting, but it seems prone for use in DOS attacks...
Cloud City Digital: DVD Production at its cheapest/finest
how many times have you hacked something together in perl that ended up being relied on for some pretty important stuff, only to find 6 months down the track that there's some condition (db connects fine, but fails halfway through script execution as an example) you didn't consider and the whole thing just collapses in a heap - a nasty to recover heap cause you didn't write much logging code either.
This would REALLY be useful when you're connecting to services external to yourself - network glitches cause more problems with my code than ANYTHING else, and it's a pain in the arse to write code to deal with it gracefully. i'd really really like to see a universal "try this for 5 minutes" wrapper, which, if it still failed, you'd only have one exit condition to worry about. hey, what the hell, maybe i'll spend a few days and write one myself.
Perhaps the answer to the problem of teenagers dropping bricks from motorway and railway bridges is to sue Tetris.
All the programmers who need the environment to compensate for their inadequacies, step on one side. All the programmers who want to learn from their mistakes and become better at their craft, get on the other side.
Most of us know where this line is located.
The idea of being to timeout and exception handle in scripts is a great idea......assuming you want to use scripts. I think most people end up resorting to Perl, Python or whatever for anything more complex. But perhaps with this facility Scripts would be more useful? But...now I come to a related topic. I build factory wide systems, systems which have eg. Automatic warehouses and whatever in the middle. I do a lot of stuff with VB6 not because it is fault tolerant but because it is 'fix tolerant'. During the comminssioning phases I can leave a program running in the debugger and, if it freaks out, I can debug, fix, test by iterating forwards and **backwards** in the the function that caused the hitch, and then continue to run were I left off. Many minor problems get fixed on the fly without users even realizing anything was amiss. In every other respect (syntax, structure, error trapping etc) VB6 is a disaster and not really suited at all to these types of progects, so the fact that I use it is a measure of how important this feature is. Like the fault tolerant shell, it is a 'non-pure' extension insofar as purists say it should not be neccessary, but in pratice it is a godsend. Anybody know an alternative for VB6 in this respect?
And if you thought that was boring you obviously havn't read my Journal ;-)
So what happens if the files are crucial (let's use the toy example of kernel modules being updated): The modules get deleted, then the update fails because the remote host is down. Presumably the shell can't rollback the changes a la DBMS, as that would involve either hooks into the FS or every file util ever written.
Now I think it's a nice idea, but it could easily lead to such sloppy coding; if your shell automatically tries, backs off and cleans up, why would people bother doing it the 'correct' way and downloading the new files before removing the old ones?
...people start pronouncing "ftsh" as "fetish". Actually, I've started already, just ask the girl sitting next to me. ;-)
- import rlcompleter, readline
and
- here
autocompletion in the editor is availible in vim here______________________________________________
sigamajig...
You obviously didn't read the article.
"It [ftsh] is especially useful in building distributed systems, where failures are common, making timeouts, retry, and alternation necessary techniques."
It doesn't protect you from typos in the script, it handles failures in the commands that are executed.
"Password fairly correct. Root login granted."
I want my karma, and I want it now!
It seems like a bad example to me since wget already has a lot of retrying build in.
Do you care about the security of your wireless mouse?
since it cannot really do a lot (of damage) in the first place!
Anyway, a shell is just a shell is just a shell...
Hey, that's my password you are typing
what they seem to essentially want is
- a try statement and error catching and
- a fortran like syntax for testing and arithmetic
I think the authors were a bit misguided. Instead of creating a whole new shell how about just extending a good existing shell with a new try statement a described.it can even be done without extending the shell:
as for the new syntax of .eq. .ne. .lt. .gt. .to.
certainly looks like fortran-hugging to me , yuck
as for integer arithmetic, that can be done with by either using backticks or the $[ ] expansion
______________________________________________
sigamajig...
"On two occasions I have been asked [by members of Parliament!], 'Pray, Mr.
Babbage, if you put into the machine wrong figures, will the right answers
come out?' I am not able rightly to apprehend the kind of confusion of ideas
that could provoke such a question."
-- Charles Babbage
-Erik -- --This message was written using 73% post-consumer electrons--
I'm sorry, but I can't understand why a Windows port (even if not native) is even attempted. Seems kind of useless in a totally GUI environment. Of course, maybe it's just me?
-- There is no spoon. Only fork.
Well.. besides pipes of course
In monopolistic America, you tolerate faulty shell.
I am a viral sig. Please copy me and help me spread. Thank you.
Shell scripts should be short and easy to write. I have seen plenty of them fail due to some resource or another being temporarily down. At first people are neat and then send an email to notify the admin. When this then results in a ton of emails everytime some dodo knocks out the DNS they turn it off and forget about it.
Every scripting language has their own special little niche. BASH for simple things, perl for heavy text manipulation, PHP for creating HTML output. This scripting language is pretty much like BASH but takes failure as given. The example shows clearly how it works. Instead of ending up with PERL like scripts to catch all the possible errors you add two lines and you got a wonderfull small script, wich is what shell scripts should be, that is none the less capable of recovering from an error. This script will simply retry when someone knocks out the DNS again.
This new language will not catch your errors. It will catch other peoples errors. Sure a really good programmer can do this himself. A really good programmer can also create his own libraries. Most find of us in admin jobs find it easier to use somebody elses code rather then constantly reinvent the wheel.
MMO Quests are like orgasms:
You may solo them, I prefer them in a group.
For a scripting language, just follow the VB approach which is already ultra efficient and completely fault-tolerant:
On Error Resume Next
I have often had to write such wrappers myself. Sure even easier/better would have been if somebody added this to say BASH as an extension but perhaps that is not possible.
How often have you needed to write horrible bash code just to pull data from an unreliable source and ended up either with a script that worked totally blind "command && command && command &&" wich never reported if it failed for days on end or ended up with several pages just to catch all the damn network errors that could occur.
I will definitly be giving this little language a try in the near future. Just another tool for the smart sys-admin. (smart people write as little code as possible. Let others work for you)
MMO Quests are like orgasms:
You may solo them, I prefer them in a group.
joshua:~#rm -Rf //tmp /tmp
Probable typing error detected. Parsed as rm -Rf /
-
Roses are #FF0000, Violets are #0000FF, find / -name '*base*' |xargs chown -R us && mv zig greatjustice
Screen is a terminal which can survive connection problems. You can start your script, detach terminal, and then came back 10 minutes later and watch what its doing. I know, that's not "fault tolerant", but, most of the times, its enaugh.
I've always wanted a shell that deletes into a 'garbage' folder, but in a native way so programs calling a delete function would also. I've also wanted a 'file versions' feature to bring safety to accidently overwriting. Then it would really be tolerant of user faults.
While we're at it: a config file library so every config file is the same format; exportable functions so gimp can export gmp.imageResize fileName 800 600 to the shell; and a codecs folder with libraries for image, video, document, and data compression.
Not every might see that last one's benefit, but I think if every app exported its format there (quicktime, realmedia) and let it be universally called, apps would be judged by interface, not filetype support.
Another idea: make every shortcut in X the config file. That way, a simple copy+edit makes two easily created+accessed differently configed programs. (I don't know about network-wide configs, though.)
... was mentioned a few months back in one of the magazines I pick up almost monthly (forget which one out of the several it was).
I think the shell was called dsh. I believe this is the project site: http://dsh.sourceforge.net/
Are the aims of this fault tolerant shell and dsh the same? I'm not a programmer, but I'm trying to teach myself *nix system administration.
Eventually I'm hoping to cluster some older x86 systems I'm going to get at auction together for a Beowulf cluster. It sounds to me like one if not both of these two shells might come in handy!
ftsh has great utility in the realm it's written for. Obviously, it's not a basis for installing kernels or doing password authentication. In a Grid (not just distributed) environment, things break for all sorts of reasons all the time. You're dealing with a Friendly Admin on another system, one who may well be unaffiliated with your institution, project or field of study. He doesn't have any particular reason to consult with you about system changes.
Now you find yourself writing a grid diagnostic or submitter or job manager. One does not need strongly typed compiled languages for this. Shell scripts are almost always more efficient to write, and the speed difference is unimportant. Right now, most Grid submitters are being written in bash or Python or some such. Bash sucks for exception handling of the sort we're talking about. Python does better with its try: statements, but there's room for improvement. ftsh is a good choice for a sublayer to these scripts. One writes some of the machinery that actually interacts with the Grid nodes and supervisors in this easy, clear and flexible form.
Now there are a lot of specific points to answer:
One needs a Windows port to be able to make the Grid software we write in Linux available to the poor drones who are stuck with Win boxes.
This is not a code spellchecker or coding environment. At all.
This is not a crutch for inadequate programmers. This is a collection of methods to deal with a specific set of recalcitrant problems.
As I was pointing out before, this is, after all, an unstable system. One is using diverse resources on diverse platforms in many countries at many institutions. I appreciate the comment made by unixbob about operating in heterogeneous environments.
This isn't a substitute for wget. One uses wget as an example because it's clear.
The "pull" model breaks down immediately when there is no unified environment, as is described on infrastructures.org. When you're not the admin, and your software has to be wiped out the minute your job is done, "push" is the only way to do it. This is the case with most Grid computing right now (that I know about)
:) Use the right tool for the job and save time.
:)
All the woe and doom about the sloppy coding and letting the environment correct your deficiencies is... ill-thought-out. That's what a compiler is, folks. Should we all be coding in machine language?
I do agree, however, that one should indeed hone one's craft. Sloppy coding in projects of importance is inexcusable (M$). There is no reason to stick to strict exception handling, however, in the applications being discussed by ftsh's developers (the same folks who brought you Condor). When code becomes 3/4 exception handling, even when the specific exceptions don't matter, there's a problem, IMHO.
This was an obscure typo bug I found this morning (after 3 months)
:P
Argh.
Wish the shell would have added the (obvious) ' > '
That shell script can be improved a lot by using " set -e " to exit on failure, as follows:
#!/bin/sh
set -e # exit on failure
cd
rm -rf bar
cp -r
This means that, if any command in the script fails, the script will exit immediately, instead of carrying on blindly.
The script's exit status will be non-zero, indicating failure. If it was called by another script, and that had "set -e", then that too will exit immediately. This is a little bit like exceptions in some other languages.
perl -e 'fork||print for split//,"hahahaha"'
Comment removed based on user account deletion
Fault tolerant languages, have been tried, and never found to be a food idea. Computer languages are very precise for a reason - What if it reads "der *.*" as "del *.*" not "dir *.*"???
***You learn something Every day. And then you die.***
Ofcourse bash can do it as well using the proper constructions. That is not the point. Care should be taken not to view bash as a golden hammer when it comes to shell scripting. The same goes for 'ftsh', ofcourse. It won't try to replace bash for every script out there.
The author merely thinks it would be nice to have a shell in which such fault-tolerant constructions are natural by design. Just to save people headaches when writing simple scripts which are there to get some job done, not to waste time dealing with every single possible failure and time-out by hand.
Then it compiled (on Fedora Core 1).
Then it failed the functions test, because my computer does not have the file /etc/networks. For a fault tolerant shell, it does not seem very tolerant of my machine! After sudo touch /etc/networks, make succeeded.
Anyway, those were the only two problems, and now it's installed. Let's see if it's worth building into an RPM package.
Erlang (http://www.erlang.org) has it.
You can have multiple linked interpreters and
even fault-tolerant database!
It is a scripting language.
From the FAQ:
1.1. In a nutshell, what is Erlang?
Erlang is a general-purpose programming language and runtime environment. Erlang has built-in support for concurrency, distribution and fault tolerance. Erlang is used in several large telecommunication systems from Ericsson. The most popular implementation of Erlang is available as open source from the open source erlang site.
Remounting a filesystem with ACID on, a process sets a rollback point , executing a series of commands with the operating system keeping a record of the changes to the filesystem made by the process and its children. The process would inform the OS to either commit or rollback the changes.
This still raises questions on how to deal with with two or more competing "transactional" processes which rely on read information which another process chooses to rollback to an early state.
this works also:
but "set -e" hits the nail on its headadditionally you could also "set -x" to see where the script exited exactly
______________________________________________
sigamajig...
The system you pull from is a distribution server, all it does is distribute files. If it's slow, it's slow for all the machines sucking data and you need a bigger infrastructure. If it's down, the client scripts fail safe and do nothing.
l l. shtml
Even here, pull scales better than push, look at a web server as an example thousands of machines sucking web pages from a server is not uncommon. Try pushing those pages out to the same number of machines.
Push methodologies simply don't scale, I've been there, done that and it's a bad architecture for more than trivial numbers of machines and I'm not the only one to notice:
http://www.infrastructures.org/bootstrap/pushpu
Government of the people, by corporate executives, for corporate profits.
ftsh provides a mechanism aimed at making it easier to catch and handle error conditions correctly. How does that encourage sloppy coding?
As for your bash example, it only demonstrates the most basic capability of ftsh - exiting on error. It does not differentiate between conditions where the error is likely to be temporary - which happens all the time in distributed systems - and conditions where immediate termination is justified.
I think perl is where it is because so many people use it as "super script." To me that says, a) we recode all the Bourne and csh and bash in perl or b) we look at why people do shell scripting in perl or other languages and add that to the shell. I couldn't tell you which is right. It's a neat idea though and I'm glad they made it.
A real example I can think of, I had a test machine that had some kind of ext3 corruption and so it mounted up in read-only mode when it booted. I spent time diagnosing an application error in our application because nothing caught that; these are redhat type startup scripts. I noticed that our app couldn't write logs and began to debug the system. More interestingly, a dozen or so start-up scripts failed to start up critical components and their failure wasn't noticed. If you can't write to the filesystem, you can't create a socket(AF_UNIX) and all sort's of things go tits up then. If that's how you debug it's only going to get more difficult as you add more and more complexity, you have to detect the lower level failures and report them. Perversely, this wouldn't have been noticed had a different partition been read-only. Turns out that a drive was going bad. Had it been a different partition, it would have been noticed at catastrophic system failure time when the drive died.
I've done a fair amount of embedded work and there is always a test for new guys, you can tell the new guy (new college grad, whatever) because he skips half or more of the error checking in his code. You know printf returns a value? Funnier still, if you develop something like a consumer app in embedded space, you'll eventually see things like printf fail. We know it never should, but with 20,000+ users in different environments and what not, things like that can and do fail and usually point to a greater problem, like a dead drive or something. Instead of logging/alerting something to the critical and unusual printf failure, the app fails in a different way because this printf failed. Heaven forbid that it was sprintf that failed and then you shove bad data in to a database or configuration file and not just fail the system but corrupt the data too. Inspite of all of that, even veterans will forget error checking at times, it's a common bug and so having higher level tools to help assist, like exception in the shell can only be a good thing.
"fault-tolerant coding encouraging sloppy coding" was addressing a common misconception in this thread:
namely a shell that will recognize misspelt commands such as the spelling correction mechnism in tcsh
the rest of the comment was an example that demonstrated that the simple functionaly of ftsh could be done in bash *without* entending bash with a new statement operator. Not a solution. The solution would be to extend an existing shell and not write a complete new shell. If the ftsh happens to be a fork of an existing shell, well then good for him, but I didn't find any reference anywhere in the ftsh site, manual or paper. So basically the ftsh is a new shell that can do
basically this is just a repost of the original post. hope you understand now. flame on.
______________________________________________
sigamajig...
Funny you should mention this, because I was going to write something about pipes. Getting pipes right with good error semantics is hard. For all the "just use set +e in bash" weenies out there, try running
Where's your error?If you think about the unix process and pipe primitives, you will see the difficulty. To create a pipeline, you normally fork, create the pipe, fork again, and run the two ends of the pipeline in the two sub-processes. This is scalable to deeply nested pipelines, but has a cost: Only one of the sub-processes is a child of the shell, so only one exit status can be monitored. To work around this, you really need to build a mini-OS environment on top of unix.
This demonstrates that unix was fundamentally not designed with concern for error semantics (consider Erlang as a diametric example). And this, I'm sure, is why ftsh doesn't have pipes (yet).
The evaluation of an action as 'practical' . . . depends on what it is that one wishes to practice.
I know this isn't exactly on-topic, but I always thought the idea of moving a running process from one machine to another would be pretty cool. Is there any OS that implements this? I mean the actual program state, not something like screen (which lets you detach and re-attach from another shell).
Ever heard of DWIM? :-)
thanks for the link in your sig, very interesting :)
If your comment on fault-tolerant coding adressed shells that correct misspellings, that doesn't make it any more insightful. There is no reason to assume such a shell would encourage sloppy coding - the many examples in this article demonstrates very well why no such shell has been written: It could create dangerous situations from otherwise harmless mistakes - there is no indication that it would in any way make "sloppy coding" any safer, and hence no indication that it would encourage sloppy coding.
As for extending an existing shell, you specifically made the point that you didn't need to extend bash to provide the functionality of ftsh, while your example only show the most trivial functionality. You now "clarify" in a way that to me reads as backtracking. Fine. Yes you can handle errors in bash in a slightly more elegant way than the ftsh website indicates. I pointed out that this was only a small part of the functionality ftsh provides.
Your complaints about ftsh being written from scratch just reinforces the impression I got of your first message. Yes, writing a shell from scratch just to add this functionality might be a waste from your perspective. But we're talking about about 4000 lines of code here - hardly years of work - where providing the "try" functionality and error handling is the ONLY focus (gee, I actually bothered downloading and looking at the source).
It is not a bash replacement. It is not something you would want to use as an interactive shell. It is a shell with the specific purpose of providing more fault tolerant access to distributed, error prone resources. Which is also how it is presented on the website: As a tool to solve a specific problem in a generic, reusable way. Very much in the Unix tradition.
It's possible it would be significantly smaller if written as a bash script. But if it came at the cost of a syntactic kludge it would defeat much of the purpose: Making the appropriate error behavior default throughout the script.
I see you're trying to vaporize your UNIX system. Would you like to:
Join the TWIT army now!
The biggest problem with spell checkers is that they don't handle homonyms at all. Further, their handling of misspelled words can be weak as well: how many times have you seen allot where the person meant "a lot." The problem is that the person used the common misspelling alot, which the spell checker identifies as allot. T.f. the person changes to allot instead of correcting to a lot, totally changing the meaning of the sentence (it would actually have been easier to read the misspelled alot).
To, too, and two and for and four are common examples of words that go through a spell checker misspelled. Replacing the contraction 've with of is another example (e.g. should've is written should of). A spell checker will never catch that. People who rely on spell checkers (even if they feedback immediately) will find that they miss a lot of common misspellings.
Spell checkers are *not* a substitute for knowing how words are spelled. Spelling seems simple (just a dictionary lookup) but is actually heavily context dependent. Computer programs remain bad at that (and even a separate human being can be bad at that; to do this properly, one must have as much understanding of that particular topic as the original writer; clearly, the best person to resolve these issues is the original writer, who knows what she or he was trying to say).
Nope, pull doesn't break down in heterogeneously managed/owned or even platformed environments. It works best in these environments. The www is an ideal example of such, apt-get is another, seti@home is another, distributed.net, I could go on.
/work/foo /fresh/data .
/work/foo
/work/foo && \ /fresh/data . && \
In Grid based computing environments, jobs queue until they can be started, and as it happens, they tend to be architected as pull based systems whether you see that as a user or not.
Again, I can't see a reason for ftsh in this case. I'm sure there's a niche for it somewhere but even their examples don't give any good reason for it's existence.
Their cd example for instance resolves to a silly script:
----- FFS!Bloody slashdot compressionfilter
#!/bin/sh
cd
rm -rf bar
cp -r
----------Bloody slashdot compressionfilter
*They* resolve this to:
-----
#!/bin/sh
for attempt in 1 2 3
cd
if [ ! $? ]
then
echo "cd failed, trying again..."
sleep 5
else
break
fi
done
if [ ! $? ]
then
echo "couldn't cd, giving up..."
return 1
fi
-----Bloody slashdot compressionfilter
Just for the cd statement, it's just silly. It simply shows that they are either trying to justify the writing of another shell or they don't understand how to shell script.
It should resolve to something more like:
-----
#!/bin/sh
JOBDONE=1
until $JOBDONE
do
cd
rm -rf bar && \
cp -r
JOBDONE=0
sleep 30
done
-----
You simply don't have to test every statement the way they suggest you do. It's a ridiculous premise. Even the decades old bourne shell has an easy way to only execute commands if they depend on a previous success.
Government of the people, by corporate executives, for corporate profits.
given his example: /work/foo /fresh/data
/work/foo && rm -rf bar && cp -r /fresh/data
cd
rm -rf bar
cp -r
would this not suffice:
cd
my undertanding of && was that it only executes in the previous command didn't throw some sort of error. i understand its not as powerful as what he's talking about, but there is some degree of fault tolerance there.
secondly, i don't know about you, but i would be very uncomfortable with something that tries a few thousand times or for a particular amount of time - it could really lock up threads or disk IO quite sunstantially if not well considered.
The language even allows you to create file "variables" which are safely allocated and destroyed during the operation of a script, analogous to automatic varibles in C++/Java or what-have-you. The point of this language is that it is entirely focused on exception handling. This is _excellent_ programming practice.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
Haven't used it myself, but I hear it's a rather "complete" environment, chock full of these and more you-wouldn't-know-why-you'd-need-it-until-you-need -it features.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
I think what you might use ftsh for is as an upper layer that calls the perl/python scripts. The perl/python scripts would just wrap some logic in a try, then exit on exception. ftsh would see it, and then attempt to restart the task as required. The ftsh can be the resource management layer, while the perl/python scripts do the complicated grunt work that may fail.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
ftsh creates a new session for each process, with the intention of using signals to forcably kill it if it runs over a time limitation. Handling this properly for multiple processes in parallel and getting the resource clean-up right sounds a little tricky.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
MS-DOS is already a fault tolerant shell, it can work with Windows.
It's similat to computer spell checkers. Ever since people started relying on these, their spelling has gone way downhill simly because they don't bother thinking. ... ...
Computer do all the spelling for them.
They don;t need a spell checker.
This si even worse.
what the user means, get get it wrong half tyhe time....
etc.
Well, I can't say whether or not you're using a spellchecker (i'd guess not) but I'd bet my right arm your spelling couldn't get any worse if you did.
I strongly suggest you try one.
We suffer more in our imagination than in reality. - Seneca
In order for this to work, it might need changes in the OS level. /dev/mt0 and the tape needs rewinding and it takes 6 minutes, you don't want to have your script aborted after 5 minutes.
Imagine you access a block/char device or an NFS mounted directory and the device driver never returns from the system call. Your script would hang, and a kill would produce a zombie process.
If you want fault tolerance, you'd have to have a timeout mechanism for all device drivers. But if you read from
Um... no, that doesn't do the same thing. The whole point of ftsh is that the 'try' block encloses a set of statements which must all be executed or it fails. If the 'cd /tmp' fails, bash will blindly run the 'rm -f data' anyway, whereas ftsh will stop and jump to the start of the try block to have another go.
set -e
If you look in the Jargon Dictionary under DWIM, you will find a much older example of this mis-smartness.
What's with all of the people claiming that FTSH will ruin the world because it makes it easier to be a sloppy programmer. Did you freaking read the documentation?
To massively oversimplify, FTSH adds exceptions to shell scripting. Is that really so horrible? Is of line-after-line of "if [$? -eq 0] then" really an improvement? Welcome to the 1980's, we've discovered that programming languages should try and minimize the amount of time you spent typing the same thing over and over again. Human beings are bad at repetitive behavior, avoid repetition if you can.
Similarlly FTSH provides looping constructs to simplify the common case of "Try until it works, or until some timer or counter runs out." Less programmer time wasted coding Yet Another Loop, less opportunities for a stupid slip-up while coding that loop.
If you're so bothered by the possibility of people ignoring return codes it should please you to know that FTSH forces you to appreciate that return codes are very uncertain things. Did diff return 1 because the files are different, or because the linker failed to find a required library? Ultimately all you can say is that diff failed.
Christ, did C++ and Java get this sort of reaming early on? "How horrible, exceptions mean that you don't have to check return codes at every single level."
Search 2010 Gen Con events
A system library that makes unlink "safe", called entomb.
.ini file syntax, as far as I'm concerned.
Versioning can be provided by some userspace-fs combinations (atfs comes to mind). I also understand reiser5 will have built-in versioning support.
GConf is supposed to be the new way to store configuration information. Although I see a lot of new programs using XML (for example, ogle) which is kinda nice. But there's nothing wrong with the shell/windows
Gimp does let you do stuff in the shell, using script-fu and a perl script. However, what you really want is "convert" which is a part of the ImageMagick toolset, which handles tons of file formats, converting between them, and doing simple transformations (crop, scale, add text, color balance, etc) from the command line.
mplayer is the other equivalent that is basically a command-line front end to ffmpeg and win32 codecs.
You need a user-space tool to effectively expose the features of codecs or a library set. This is what mplayer (and also xine) do, besides just play media files.
Until realplayer, quicktime, etc. all conform to the same API, you won't see an interface driven engine.
On windows, this tool is called "graphedit" and it is part of the DirectShow SDK.
Finally, your X "shortcut" idea is superflouous. You don't really make "shortcuts" in linux desktop environments. What you do is make icons that run actions. So, you edit your configuration file, save it as something else in your home directory, then copy the icon, modify it so that the -f or -config option (application dependant) points to your config file, and off you go!
Let's not try to re-invent the wheel too much. Unix environments give you a lot of tools already to do much of what you suggest.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
Either the reader process blocks until it's resources have been released by an outstanding transaction, or the process provisionally accepts a non-guarantee of correctness (signaled by the read) that says "I'll send you a signal if they finally commit or rollback", but program logic would have to handle it.
We might assume that the inital read would give EBUSY or something, which would be the signal that the data is unstable. A non-transaction aware program might quit, or back off and retry. A transaction aware program might use a special ioctl with the same offset would allow successive reads to the area with the guarantee of a signal delivery on end-of-transaction.
Presumably the process would block at the absolute last second, waiting for the go/no go signal... or it would ignore the warning with a result that would be unreliable.
Non-transaction aware programs would either halt or loop endlessly because of the EBUSY condition on read.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
This would allow me to use somebody elses code to save me work. Call me a lazy bastard. For sysadmins that is a compliment.
You are wrong when you see shell scripting as a step up. In many ways when you are a sysadmin shell scripting remains one of the basic needs.
What I disagree with is that this will teach people wrong programming routines. Look at the code out there. They don't need a retry shell script to do that. Bad code has been with us since we invented programming. Rejoice. It means someone is going to be paid to clean it up.
MMO Quests are like orgasms:
You may solo them, I prefer them in a group.
As a side-bar, is the FTSH acronym pronounced... fetish?
All kidding aside, this sounds like a great idea.
As for the comments about encouraging sloppy code, it is clear those posters have never worked in demanding moving-target environments. The kinds of errors encountered cannot be solved easily in code - this extension would help.
As for the comments on "you can do this in Perl, Python, and ", this is true, but if I know Bash and want tolerance, why should I have to learn a new language to get it? Likely all I'm doing is copying files, forking off subprocesses, and the like.
For the comments on "why another shell," I would tend to agree that it would be best integrated into Bash - but then, you change the implementation of Bash, create incompatible situations, and have to retest volumes of existing scripts. It's best to have this as a separate shell with close look/feel semantics to Bash (or Csh).
Something perhaps like this?
Does that mean they were (wait for it...) existentialists?
HSJ$$*&#^!#+++ATH0
NO CARRIER
The proper answer to this loaded and overly complex question is of course: "Countless." I did not need a "fault tolerant" shell, though, but real asynchronous I/O with good exception handling subsystem and events. That is why I look forward to Perl 6 and Parrot.
Good luck then.
Sincerely,
Pan Tarhei Hosé, PhD.
"Homo sum et cogito ergo odi profanum vulgus et libido."
I spent the better part of three year implementing a fault tollerant programming environment and released it under GPL. Please visit Askemos to find it.
a mem fault... map around it (linux has a kernel patch for this), stack audit (linux secure kernel mod), and Pre-Fork a secure shell instance for each script (ha ha ha, kill -9 it when done). Run your shell config scripts off a ROM media, and spawn the whole process inside a virtual machine unlike your actual hardware (PC in PPC etc.) resistant indeed... ;]
Please explain how you are accurately updating $SECONDS once each second (especially while wget is running), as well as how you stop the wget process if it exceeds the 30 minute time limit. Thank you.
--
Promoting critical thinking since 1994.
/bin/sh! ain't good enough for you, huh? why not make one of them new fangled gui shells why back in the day assembly was state of the art now you want a fault tolerent shell interpreter. bah weakness.
I may be wrong, but we're talking about integrated logic that will decide for itself when somthing went wrong and come up with the right way of dealing with it, right? I understand that this is deeper than an error-handler. I think that it sounds wonderfully useful. I don't, however, see it as an end-all solution. I think that it is a nice concept but what if you're making a request that will only be true 1 in 1 million times? Consider a conditional statement which is false 99.9% of the time, yet is extremely crucial to be checked in case it happens to be that .1% of the time. that means that you're adding redundancy to 99.9% of your requests. Alot of times errors occur because somthing is simply broken and requesting somthing again won't fix it, but slow down everything else.
I hope maybe I made some sense, I'm not an english major nor a philosopher, but it made sense in my mind.
A long time ago, I had a similar idea: reversible commands.
.trash) mv .trash/foo .
Basicly, the regular commands are wrapped with some scripting (perl, python, whatever) that saves the reverse of whatever commands the shell interprets. If an error is found, it just applies each of the reversed commands in reverse order, and the system is back where you started.
This would be good for a lot of sysadmin scripts like creating users, moving files, etc. where the system should be kept in a known state.
There are many commands which can't be reversed, but with some clever help, most things can be.
gzip gunzip
mv mv
rm (mv foo
never really spent much time on it, but maybe it's an idea related to what this topic is about.
sort of like transaction logs in a database too
AND the Linux Zealots wonder why their OS can't be user friendly.. Someone comes up with an idea to make the shell harder to screw up for a beginner scripter and all the penguins lose it.
Sad, really.
I don't think MEPs (Members of the European Parliament) existed in Babbage's day.
I think there's already a way to implement it using a combination of file type actions and MIME magic. I will post a quick tutorial on how to get it working for you.
Question: what software were you hoping to operate with multiple configuration files in particular? Also, what environment are you using? (KDE, Gnome, CDE, etc. etc.) That way I can tailor the example to your specific situation.
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
First, we need to make sure that your configuration file is always "tagged" so that we can make it behave specially no matter how many modifications or forks you make.
:-)
/usr/local/bin/VisualBoyAdvance -c
We'll use MIME types for this purpose.
The easiest way is the most direct: edit the file "/etc/gnome-vfs-mime-magic" with a text editor as root (this is the only time you need root access).
Somewhere near the bottom, add a line like this:
0 [TAB] string [TAB] \#somethingunique [TAB] mime/type
[TAB] indicates you can use as many tabs or spaces to line up the data like the other columns in the file, but it doesn't actually matter to the system.
The first part (zero, then "string") indicates that the type tagger should look at the beginning of the file for a string to match. The string that needs to be at the beginning of the file is \#somethingunique, which can be whatever you want, but the first letter should be a comment character for the configuration file format (usually a hash mark "#").
The backslash is necessary to "escape" the hash mark because this gnome-vfs-mime-magic file ALSO uses the hash mark for a comment character, and you need to tell it that you mean for it to look for the hash mark, and not comment the rest of the line out.
The last part, "mime/type" is any MIME type of your choosing. (MIME types are things like text/html, image/jpeg, etc. etc. and are used to uniquely identify file formats).
It has to be unique for the application you want to automate. So if it was "Visual Boy Advance", I might choose personal/vba-conf. I'm going to suggest you use the prefix "personal" to let you know that YOU added it for your own use.
Okay, now that you've done that, find the configuration file you want to be able to run by just double clicking.
Add in a line (it has to be the FIRST line) that matches the #somethingunique you chose earlier. Now, whenever the GNOME file browser sees this file, it will detect it as "personal/vba-conf" or whatever instead of the default "text/plain" for text configuration files.
Okay, now open up "File Types and Programs" from your "foot" menu, under Preferences. Click "Add File Type...". Fill in the description, choose a goofy icon, and in the MIME type box, type personal/vba-conf or whatever the new MIME type you're using for these configuration files.
There doesn't seem to be an appropriate Category choice for what we're doing, so I just picked "Misc".
Go all the way down to the Actions section, and go to Program to Run. Type in the full path to the program that uses the configuartion file. Make sure to add any command line options you want, and make the last one be the one that lets you choose a _different_ configuration file. In the case of VisualBoyAdvance, that's the -c option. So I type in:
in the box. The system will always add the path of the configuration file as a last option to the program, so that's why you need to end it with the -c or whatever.
If you need a terminal window open to interact with the program or to read error messages, make sure "Run in Terminal" is checked.
When you think you have it straight, hit "OK".
That's it.
Do a ps -ef , and grep for "nautilis". Kill that process, so it restarts the file manager for good measure.
Now whenever you double click the configruation file, it'll call your custom command line with that configuration file as an argument.
You can copy the configuration file, edit it, rename it, move it, whatever, and it'll still launch the program when you double click it.
Only thing you have to watch out for is to make sure you keep that first "magic" line in there. A fresh, virgin configuration file will not have this magic behavior until you add the magic line. Of course, any modified copies you make will.
What do you think of that?
THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON