3 ms·
Why should shells encourage this behaviour (piping unknown stuff to them?) You should at least download, verify the size and checksum (if available), take a pe
by edwintorok 12y ago
Why should shells encourage this behaviour (piping unknown stuff to them?)
You should at least download, verify the size and checksum (if available), take a peek at it, and only then run it.
- dllthomas 12y agoBecause you might be piping known stuff to them. Receiving a partial input stream is not necessarily reliant on networking.
- edwintorok 12y agoOK, but the detection of partial vs complete script is not as simple as 'does last line have EOL'? There are various builtins that require an end token, like case/esac, if/fi, etc. Do these work properly when truncated at an arbitrary line?
- dllthomas 12y agoThose control structures do work properly - the shell reads ahead until it finds the end token, and fails if it's absent. It is true that there remains the problem of potential truncation exactly at the end of a top-level line, but I contend that "it stops running here" is a much easier thing to reason about (and, strictly, could always happen if hit with a SIGKILL anyway) than "does the meaning of this line change if we cut it off in a weird place".