4 ms·
I read TFA. Why would a truncated partial download happen and still run the script?
by oneepic 2y ago
I read TFA. Why would a truncated partial download happen and still run the script?
- loeg 2y agoI believe 'curl XXX | sh' will start executing any complete shell statements in the input, before the full script is downloaded.
- LukeShu 2y agoThe most obvious answer is `curl | sh`. But also perhaps a network blip interrupting curl/wget, but the user failing to notice and going ahead and executing the file anyway.
- deleted 2y ago[deleted]
- wongarsu 2y agoA truncated download might happen for all sorts of reasons, like your internet connection dropping while you download the script. If you don't notice you might accidentally run an incomplete script and leave your system in some broken or at least confusing state. They wrapped everything in a main function to prevent that from happening
- loeg 2y agoBrowsers typically emit downloads to temporary files until they are complete, then rename them into the final location, to prevent this kind of issue.