Mord3rca / gamma-launcher

Just another Launcher to setup S.T.A.L.K.E.R.: G.A.M.M.A.
GNU General Public License v3.0
91 stars 13 forks source link

unrar doesn't work #65

Closed maxastyler closed 8 months ago

maxastyler commented 1 year ago

It might be worth adding a note saying to use the full path (not relative, or using ~ or something...)

unrar specifically doesn't work when using relative paths, leading to a bit of a cryptic error:

unrar.rarfile.BadRarFile: Invalid RAR file.unrar.rarfile.BadRarFile: Invalid RAR file.

It might be worth just adding in Path(folder).resolve() to resolve full paths on instantiation of the FullInstall class

maxastyler commented 1 year ago

Ok, the error wasn't anything to do with using a full path. For me unrar doesn't work, giving that BadRarFile error. Strangely, when I run the RarFile.extractall function from the library's main function, then it can extract files. I wonder if this is something to do with extracting to temporary directories?

I fixed this by changing rar extraction to use the patool library instead of unrar.

Mord3rca commented 1 year ago

Hello,

Which version of rarfile are you using, which distro, ... ? rarfile is using an helper to do decompression. If the helper do not support it, decompression will fail. Do you have unrar installed ?

maxastyler commented 1 year ago

I'm using Fedora 38, and the versions of software I'm using are: Python 3.11 rarfile 4.1 unrar (unrar-free 0.1.3)

I've just seen this issue on the rust wrapper for unrar, which indicates that the newest version of unrar has a regression and isn't able to extract to temporary directories, which would match what I've seen.

I'll try to use an older version of rarfile/unrar and see if that works.

maxastyler commented 1 year ago

I've got it working, it looks like it was a problem with unrar currently distributed with fedora.

I have compiled from source the newest version of unrar from rarlabs (6.2.12), to produce a library (.so). I swapped the python dependency from rarfile to unrar (unrar still has a RarFile class with similar interface), and use the UNRAR_LIB_PATH environment variable to pass the library's location through when running gamma-launcher.

It might be worth putting a warning in the readme file about this?

Mord3rca commented 1 year ago

You can use RPM Fusion repo for Fedora 38 and install unrar 6. Limitation is documented by rarfile: https://pypi.org/project/rarfile/ - unrar-free is not supported.

And yes, it might be good to document this in the Troubleshoot part of the README.

Tokinvee commented 1 year ago

Using Linux Mint, all I had to do was install rar and unrar and the installer continued past the first .rar file. I installed using the env method, still going well. I'll update this post after it completes.

Actionb commented 1 year ago

I also had an error related to unrar/rarfile. Like Max, the distro is Fedora 38. Installing unrar from RPM Fusion fixed it. Just going to mention this here, in case somebody else stumbles upon the same error.

./gamma-launcher full-install --anomaly ./Anomaly/Anomaly-1.5.1.2/ --gamma ./Gamma/
...
[+] Installing mod:  Lsz AI tweak
  - Downloading Lsz.9.rar
Traceback (most recent call last):
  File "gamma-launcher", line 8, in <module>
  File "launcher/cli.py", line 64, in main
  File "launcher/commands/install.py", line 248, in run
  File "launcher/commands/install.py", line 193, in _install_mods
  File "launcher/commands/install.py", line 159, in _install_mod
  File "launcher/archive.py", line 50, in extract_archive
  File "launcher/archive.py", line 43, in <lambda>
  File "rarfile.py", line 875, in extractall
  File "rarfile.py", line 940, in _extract_one
  File "rarfile.py", line 955, in _make_file
  File "shutil.py", line 197, in copyfileobj
  File "rarfile.py", line 2284, in read
rarfile.BadRarFile: Failed the read enough data: req=65536 got=0
[196158] Failed to execute script 'gamma-launcher' due to unhandled exception!
Mord3rca commented 8 months ago

Documented in #93