3 ms·
this isn't a code error -- it's a logic error. No amount of "safeness" in the language will save you from telling the language, without breaking the rules, from
by olliej 9y ago
this isn't a code error -- it's a logic error. No amount of "safeness" in the language will save you from telling the language, without breaking the rules, from doing something that is "wrong".
For instance:
sudo rm -rf /
Every part of that is completely sound and correct. There are no buffer overflows, emory corruption, or anything. You wrote a completely correct command to do something (probably) really wrong.
- AstralStorm 9y agoThis is preventable if you specify fully what you actually want to do. Then there are systems that just prevent ambiguous rules if you really dig into it. (Speaking of assisted theorem prover such as Coq and Isabelle.)
- zaarn 9y ago>This is preventable if you specify fully what you actually want to do. In this case it was fully specified that sudo should run rm with all privileges, which in turn will recursively deleted the root filesystem. The entire execution is fully specified and will execute without fault. There is no mistake in `sudo rm -rf /`. Logical faults may not be preventable with provers, such as when underlying assumptions are wrong. For example, a prover could have verified the parity library as fully okay because it assumes that the initialization function will not be called without delegation. This underlying assumption X -!> Y (X cannot lead to Y) is wrong and X -> Y is the case but the prover only verified that Y -!> X. Provers essentially duplicate your code, forcing you to express the solution and/or problem twice such that if you basically typo on the way, one of the pieces will complain about the other. But it cannot and is incapable of preventing higher level mistakes.