3 ms·
The sorts of bugs people experience with Java mostly result in a crashed/stalled/hung process. Bash bugs erase your entire file system. The thing about Bash i
by kansface 12y ago
The sorts of bugs people experience with Java mostly result in a crashed/stalled/hung process. Bash bugs erase your entire file system. The thing about Bash is that it is trivially easy to make these sorts of mistakes- the language just isn't suitable to general purpose scripting.
- yourad_io 12y ago> Bash bugs erase your entire file system. EMPTY="" rm -rf $EMPTY/ Is this the kind of bug you're referring to? > The thing about Bash is that it is trivially easy to make these sorts of mistakes I fail to see how any other scripting language would have a different effect when you told it to do: system("rm -rf "+""+"/") > the language just isn't suitable to general purpose scripting. Yes, it is. Bash is deeper than it looks, but not by much. Learn how to handle errors and you'll be fine.
- collyw 12y agoIt shouldn't be able to erase your filesystem unless you are running as root or doing something equally stupid. That's pretty much common sense stuff for anyone that isn't a beginner.
- gambiting 12y agoYeah the "common sense stuff for anyone that isn't a beginner" argument is repeated ad nauseam, and even the largest companies make this mistake in their largest products. Take Valve - they should know how to write good code, right? And yet, last week an article was on top of HN, outlining how they put: "rm -rf '$STEAMROOT'/*" in their code, used to remove the library. But hey, no one checked if $STEAMROOT is not empty, so when it was for one user, Steam deleted all of his personal files, whole /home and /media directories next time it started. I'm not saying that command line tools shouldn't be used,but sometimes they are just too powerful for some users,and stupid mistakes like this happen.
- anthony_d 12y agoYou're right to an extent, but this isn't relevant to the Java vs Bash discussion. The largest companies make this kind of mistake in whatever language they happen to use. People delete data and screw things up in MapReduce jobs for Hadoop. A lot.
- vidarh 12y agoIf you're worried about that, don't give the script permissions to access your entire filesystem. Easily handled with separate users, cgroups, assorted containerisation, and more.