You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
update.sh replaces itself while it runs: a syntax error after the update #67
Cause: cp -R "$TMP/new/." "$DIR/" copies the new release over /opt/skrongle, which includes update.sh itself, while sh is still running it. sh reads a script as it goes, so once its buffer ran out it read the rest from the new file at the old byte offset. The 0.1.2 and 0.2.0 scripts differ in length, so that was the middle of a case arm. A syntax error stops the shell, so nothing from the garbage ran, but it could have been a complete command.
Wrapping the body in a function is not enough: after the function returns the shell reads what follows the call from the new file too (tried under dash). The fix is to run from a copy: on its first lines the script copies itself to a temp file and re-executes from there, with the installed path kept in SKRONGLE_UPDATE_SELF for messages and for finding /opt/skrongle. scripts/release-qa/package-smoke.sh checks the shipped script does this.
The running script is always the installed, older one, so the fix protects updates from the first release that ships it onward. Updating 0.2.0 to the next release will show the message once more; it is harmless there.
Activity