-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(NSIS): prevent partial overwrites #6547
fix(NSIS): prevent partial overwrites #6547
Conversation
`Nsis7z::Extract` ignores the errors when copying the files and thus can leave us with the app that has old asar and bindings, but new assets. In addition to that, the app will firmly believe that it is still running an old version and would attempt to repeatedly auto-update until fixed, leading to excessive bandwidth use and very unhappy customers. This change extracts the contents of 7z archive into a separate directory before attempting to copy them with `CopyFiles` function that (unlike `Nsis7z::Extract`) does detect and report failures. To make our lives easier the `CopyFiles` will also erase all files on a failure so after retrying a few times we will ultimately have to fallback to old 7z extraction directly into output folder.
🦋 Changeset detectedLatest commit: d7c4edd The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✔️ Deploy Preview for car-park-attendant-cleat-11576 ready! 🔨 Explore the source changes: d7c4edd 🔍 Inspect the deploy log: https://app.netlify.com/sites/car-park-attendant-cleat-11576/deploys/61df2fe2760c6b0008426cfd 😎 Browse the preview: https://deploy-preview-6547--car-park-attendant-cleat-11576.netlify.app |
@@ -90,5 +90,45 @@ | |||
!macroend | |||
|
|||
!macro extractUsing7za FILE | |||
Nsis7z::Extract "${FILE}" | |||
Push $OUTDIR | |||
CreateDirectory "$PLUGINSDIR\7z-out" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: NSIS promises that $PLUGINSDIR
is a temporary folder that is removed after the installation.
Yay. Thanks for merging it so quickly! |
Nsis7z::Extract
ignores the errors when copying the files and thus canleave us with the app that has old asar and bindings, but new assets. In
addition to that, the app will firmly believe that it is still running
an old version and would attempt to repeatedly auto-update until fixed,
leading to excessive bandwidth use and very unhappy customers.
This change extracts the contents of 7z archive into a separate
directory before attempting to copy them with
CopyFiles
function that(unlike
Nsis7z::Extract
) does detect and report failures. To make ourlives easier the
CopyFiles
will also erase all files on a failure soafter retrying a few times we will ultimately have to fallback to old 7z
extraction directly into output folder.
Testing
The easiest way to trigger the failure is to:
tmp.exe
tmp.exe
(thus locking the asar, bindings, and dlls)