packwiz / packwiz-installer

An installer for packwiz modpacks, with automatic auto-updating and optional mods! Works well with MultiMC and on servers.
https://packwiz.infra.link/
MIT License
54 stars 23 forks source link

Invalid hashes generated when updating on Windows #44

Closed MsKarMagick closed 1 year ago

MsKarMagick commented 2 years ago

java.lang.Exception: Invalid mod file hash at link.infra.packwiz.installer.metadata.IndexFile$File.downloadMeta(SourceFile:45) at link.infra.packwiz.installer.DownloadTask.downloadMetadata(SourceFile:94) at link.infra.packwiz.installer.UpdateManager.processIndex$lambda-9(SourceFile:310) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:290) at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

Working on a modpack with a friend, he's on linux, I'm on windows 10, when he updates a file the existing hashes remain as they were, when I update a file however, a lot of seemingly random hashes change in index.toml and it renders the instance unlaunchable. Not every hash is affected, only a portion of them.

index-pack tomls.zip

Apologies if this isn't formatted right or doesn't have all the necessary info, not exactly super experienced with this stuff, I'll try to provide anything else that may be missing as need be.

comp500 commented 2 years ago

Are you using Git to share files? You'll want to turn off line ending conversion so that both systems calculate the same hashes, and make sure you're using an editor that can handle UNIX line endings (the vast majority; even Notepad can do it now).

MsKarMagick commented 2 years ago

That looks like it'd be the solution to our issue, I'll try that tomorrow and close the issue if that works out. HUGE thanks for the quick reply!

MsKarMagick commented 2 years ago

We added the .gitattributes file with * -text, I added a mod from Windows using packwiz curseforge install, that didn't mess with the hashes. However, when I do packwiz refresh to generate the necessary files for configs and recipes I've edited, most of the hashes get changed and rendered unusable, even if I've not made a single change from the last push my friend made from Linux.

comp500 commented 2 years ago

You might have to reclone the repository (or re-checkout?) since the line ending conversion was already done when you cloned the repo.