Skip to content
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!: download electron checksum failure #226

Closed
wants to merge 2 commits into from

Conversation

BlackHole1
Copy link
Member

@BlackHole1 BlackHole1 commented Aug 8, 2022

Bug context see: electron/fiddle#1156

This bug is only triggered in the electron-renderer and when Webpack is packaged.

Break Changes

  1. Node.js version must >= 12.0.0

@BlackHole1
Copy link
Member Author

CI failed reason: Cannot find a definition for job named test-linux-12. cc @malept

@erickzhao erickzhao requested review from a team and malept August 8, 2022 18:03
.circleci/config.yml Show resolved Hide resolved
@erickzhao erickzhao changed the title fix: download electron checksum failure fix!: download electron checksum failure Aug 8, 2022
Copy link
Member

@malept malept left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why this change requires got to be updated? This seems like a pretty large change for a single bug.

@BlackHole1
Copy link
Member Author

It may take time to explain this matter from beginning to end, so please wait. In the meantime, you can start by checking out: electron/fiddle#1156

@BlackHole1
Copy link
Member Author

Tips

  1. It is difficult to write the corresponding unit tests in electron/get. Because the problem only occurs in the electron-renderer process and uses the Webpack build. This can be reproduced at https://github.com/electron/fiddle/releases/tag/v0.29.2 (Select China Mirrors)
  2. This bug is fixed at Do not ignore decompress-response when bundling sindresorhus/got#1105
  3. There is a discussion of this bug in got. Gzip seems not work in my project sindresorhus/got#945

Why update got

Yesterday, I found that my electron-fiddle was not downloading electron, and after some troubleshooting, I figured out that it was not parsing gzip when downloading with got.stream. So when @electron/get uses got.stream to download SHASUMS256.txt, the response returns gzip, which causes @electron/get to fail the checksum.

get/src/index.ts

Lines 131 to 141 in 5c81f9a

shasumPath = await downloadArtifact({
isGeneric: true,
version: artifactDetails.version,
artifactName: 'SHASUMS256.txt',
force: artifactDetails.force,
downloadOptions: artifactDetails.downloadOptions,
cacheRoot: artifactDetails.cacheRoot,
downloader: artifactDetails.downloader,
mirrorOptions: artifactDetails.mirrorOptions,
});
}

get/src/index.ts

Lines 151 to 153 in 5c81f9a

await sumchecker('sha256', shasumPath, path.dirname(tempDownloadPath), [
path.basename(tempDownloadPath),
]);

const downloadStream = got.stream(url, gotOptions);

This seems like a pretty large change for a single bug.

We talked about "no longer supporting node.js < 10" once before. See: #214 (comment)

Because we have other problems caused by the low version of got #224

I think this is the time to do it.

@malept
Copy link
Member

malept commented Aug 9, 2022

It would be helpful if you could split out the changes into separate logical commits so that it's easier to review.

@BlackHole1
Copy link
Member Author

It would be helpful if you could split out the changes into separate logical commits so that it's easier to review.

Sorry, I didn't quite understand it. This PR is already a minimal change and cannot be split any further

@malept
Copy link
Member

malept commented Aug 9, 2022

It would be helpful if you could split out the changes into separate logical commits so that it's easier to review.

Sorry, I didn't quite understand it. This PR is already a minimal change and cannot be split any further

You can start with #225 and build upon it.

@BlackHole1
Copy link
Member Author

OK, I will close this PR as there are duplicate PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants