yarnpkg / yarnpkg/berry

[Bug?]: checksum is different from windows and unix

Open
#5,136 3 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Self-service
  • I'd be willing to implement a fix
Describe the bug

yarn install fails on windows machine for the same dependency.

Doing yarn install on mac you get the following file inside the cache test-github-dependency-git+ssh-298a2e1cf5-17a50be342.zip

On windows it fails with:

yarn install
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ test-github-dependency@git+ssh://git@github.com:angel-git/test-gith
➤ YN0018: │ test-github-dependency@git+ssh://git@github.com:angel-git/test-githu
b-dependency.git#commit=a9558b728dfcee08264f221211d859e3417a4971: The remote arc
hive doesn't match the expected checksum
➤ YN0000: └ Completed in 7s 544ms
➤ YN0000: Failed with errors in 7s 559ms

If i change the .yarnrc.yml with checksumBehavior: update then windows generates: test-github-dependency-git+ssh-298a2e1cf5-a5121ebaf2.zip. You can see that the checksum is different (17a50be342 vs a5121ebaf2 )

Doing an hexdump for both of files and comparing ( hexdump -C test-github-dependency-git+ssh-298a2e1cf5-17a50be342.zip):
image

The difference is some small character, after more investigating the issue is coming from the bash script gradlew that lives inside the dependency. If i remove that gradlew file, the issue is not longer reproducible

To reproduce
git clone https://github.com/angel-git/yarn-issue
cd yarn-issue
yarn install

do the same on windows machine

Environment
MAC:

System:
    OS: macOS 13.0.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 16.18.0 - /private/var/folders/l0/vlwfh6h92q7fx1g68qxp53140000gp/T/xfs-7f3cfcc9/node
    Yarn: 3.3.0 - /private/var/folders/l0/vlwfh6h92q7fx1g68qxp53140000gp/T/xfs-7f3cfcc9/yarn
    npm: 8.19.2 - /opt/homebrew/bin/npm

WINDOWS:

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
  Binaries:
    Node: 16.12.0 - ~\AppData\Local\Temp\xfs-3a0cc209\node.CMD
    Yarn: 3.3.0 - ~\AppData\Local\Temp\xfs-3a0cc209\yarn.CMD
    npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD
Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked yarn-issue reproduction and run yarn install on macOS and Windows with the default checksum behavior. Compare the generated cache archives, then inspect how the gradlew file is handled during fetching; done means the same dependency produces a matching checksum across both platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, shell, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.