flathub / net.lutris.Lutris

https://flathub.org/apps/details/net.lutris.Lutris
127 stars 26 forks source link

Winetricks downloads corefonts incorrectly from install scripts #365

Closed fkrull closed 1 year ago

fkrull commented 1 year ago

It looks like winetricks can't correctly download corefonts when run from an install script. I only tested with the Epic Games Store installer, so maybe I'm extrapolating too much, but it certainly happens and is reproducible with EGS:

Apparently, the corefonts files get... downloaded wrong? This is the file that gets downloaded for andale32 (the downloaded file is called andale32.exe, I added the txt extension for Github). Note that it's some HTML from archive.org rather than the expected file. If I manually download andale32.exe and place it in the cache dir, it does the exact same thing for whatever the next corefont is.

Weirdly, this seems to only happen with install scripts in the Lutris Flatpak:

This might technically be a winetricks bug, but I couldn't reproduce it with raw winetricks so I'm reporting it here.


Using winetricks 20220411-next - sha256sum: 50b745d7f46ead56fd0c9e6d753d53ea0ae368c988434c25d65fec66307e5d4f with wine-8.0.2 and WINEARCH=win64
Executing w_do_call corefonts
Executing mkdir -p /home/vagrant/Games
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Executing load_corefonts 
Executing w_do_call andale
Executing mkdir -p /home/vagrant/Games
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Executing load_andale 
grep: warning: stray \ before /
Executing mkdir -p /home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Executing cd /home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://mirrors.kernel.org/gentoo/distfiles/andale32.exe to /home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
[0] Downloading 'https://mirrors.kernel.org/gentoo/distfiles/andale32.exe' ...
HTTP ERROR response 404 Not Found [https://mirrors.kernel.org/gentoo/distfiles/andale32.exe]
Executing cd /home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe to /home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
[0] Downloading 'https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe' ...
HTTP response 302  [https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe]
Adding URL: https://web.archive.org/web/20180716181706/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe
[0] Downloading 'https://web.archive.org/web/20180716181706/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe' ...
Saving 'andale32.exe'
HTTP response 200  [https://web.archive.org/web/20180716181706/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe]
Executing cd /home/vagrant/.var/app/net.lutris.Lutris/data/lutris/runtime/winetricks
------------------------------------------------------
warning: sha256sum mismatch! However --force was used, so trying anyway. Caveat emptor.
------------------------------------------------------
Executing cabextract -q -d /home/vagrant/Games/epic-games-store/dosdevices/c:/windows/temp /home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/andale32.exe
/home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/andale32.exe: no valid cabinets found
------------------------------------------------------
warning: Note: command cabextract -q -d /home/vagrant/Games/epic-games-store/dosdevices/c:/windows/temp /home/vagrant/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/andale32.exe returned status 1. Aborting.
------------------------------------------------------
Monitored process exited.
Initial process has exited (return code: 256)
All processes have quit
Exit with return code 256
2023-09-29 01:02:56,691: Command exited with code 256
2023-09-29 01:02:56,691: Command exited with code 256
Traceback (most recent call last):
  File "/app/lib/python3.10/site-packages/lutris/exceptions.py", line 61, in wrapper
    return function(*args, **kwargs)
  File "/app/lib/python3.10/site-packages/lutris/installer/commands.py", line 446, in _monitor_task
    raise ScriptingError(_("Command exited with code %s") % command.return_code)
lutris.installer.errors.ScriptingError: Command exited with code 256
fkrull commented 1 year ago

Oh, and this is not either of these issues:

fkrull commented 1 year ago

Ah. It's because the Flatpak runtime includes wget2:

[📦 net.lutris.Lutris ~]$ wget --version
GNU Wget2 2.0.1 - multithreaded metalink/file/website downloader
...

With wget1 (which at least Fedora still ships as wget) the following command downloads the file as expected: $ wget -O andale32.exe -nd -c https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe

However, in the Lutris Flatpak the same command downloads the file incorrectly because of wget2.

Edit: forcing winetricks to use curl instead by setting WINETRICKS_DOWNLOADER=curl also won't work yet because winetricks doesn't handle errors correctly when using curl (https://github.com/Winetricks/winetricks/pull/2128).

fkrull commented 1 year ago

I reported the issue to wget2 (https://gitlab.com/gnuwget/wget2/-/issues/646) but decided against questioning the use of wget2 in the Freedesktop runtime. :shrug:

strycore commented 1 year ago

A workaround would be to download the fonts from a known good location (like https://github.com/pushcx/corefonts ) and place them in winetricks' cache. But that still requires some code. So the only solution left really is to patch winetricks with working URLs so we can push a working version to everyone.

fkrull commented 1 year ago

A workaround would be to download the fonts from a known good location (like https://github.com/pushcx/corefonts ) and place them in winetricks' cache. But that still requires some code.

That code already exists, that's what the web.archive.org fallback in winetricks does. It just didn't work as expected because of the wget2 thing.

So the only solution left really is to patch winetricks with working URLs so we can push a working version to everyone.

That's already been happening: https://github.com/Winetricks/winetricks/issues/2118, so I ended up focusing on the broken fallbacks. I've opened another PR to winetricks to improve compatibility with wget2 (https://github.com/Winetricks/winetricks/pull/2130) so hopefully everything ends up a little bit more robust.

strycore commented 1 year ago

It's weird because on my testing, I didn't get the Archive.org fallback. It failed to download the files from Gentoo and that was it. Gentoo didn't remove the files, they did some weird shenanigans with their folder structure but it's still possible to find the correct URLs. We can also provide a better source for those fonts. Maybe hosting them on Archive (the actual Archive, not the Wayback Machine) would be more stable than Gentoo, a Github account or hosting the files on Lutris servers.

strycore commented 1 year ago

Looks like the PR on Winetricks' side has been merged so I'll start by pushing an updated version and that might be enough to solve the issue.

darthrevan commented 1 year ago

I have encountered a similar error yesterday and I have solved it by doing the following (it doesn't require any code!!):

So the solution is:

strycore commented 1 year ago

I've published the new version of winetricks and now the fonts can install properly.

Brunvik commented 1 year ago

Still cant get past font Installation on my Steam Deck, regardless of what I am trying to Install. Will there be an Update for lutris or should I Install Something to get this working?

strycore commented 1 year ago

Still cant get past font Installation on my Steam Deck, regardless of what I am trying to Install. Will there be an Update for lutris or should I Install Something to get this working?

You just need to restart Lutris to get the updated Winetricks. Be sure to start the Lutris UI and not a game using Lutris.

Brunvik commented 1 year ago

Sadly, on SD atleast the flatpaked version of lutris just dont wan‘t to download fonts, but Here I can only talk on the Battle.net Script. RPM lutris on Fedora works as intended.

strycore commented 1 year ago

@Brunvik can you check your winetricks size and date with ls -la ~/.var/app/net.lutris.Lutris/data/lutris/runtime/winetricks

result should be

799110 Sep 28 17:55 winetricks

Brunvik commented 1 year ago

799110 Sep 29 02:55 winetricks

This is what is what I get

strycore commented 1 year ago

ok, so you have the correct Winetricks version. You're probably hitting a different issue. Do you have logs for the font error?

strycore commented 1 year ago

ok, I don't know what got uploaded but it wasn't the right winetricks build...

I've uploaded a new build and now fonts should download correctly.

Brunvik commented 1 year ago

I'll try later and provide Feedback!

Brunvik commented 1 year ago
Started initial process 168 from /home/deck/.var/app/net.lutris.Lutris/data/lutris/runtime/winetricks/winetricks --unattended arial
Start monitoring process.
------------------------------------------------------
warning: Your version of wine 5.12-23920-g2ee069136ca is no longer supported upstream. You should upgrade to 7.x
------------------------------------------------------
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Using winetricks 20230212-next - sha256sum: fe0550e0d843214f87dcb0f4aa591be0046fa93db7b8330217dd926258e628fc with wine-5.12-23920-g2ee069136ca (Staging) and WINEARCH=win64
Executing w_do_call arial
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Executing load_arial 
grep: warning: stray \ before /
Executing cd /home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe to /home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
[0] Downloading 'https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe' ...
HTTP ERROR response 404 Not Found [https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe]
Executing cd /home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe to /home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
[0] Downloading 'https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe' ...
HTTP response 302  [https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe]
Adding URL: https://web.archive.org/web/20231003055845/https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe
[0] Downloading 'https://web.archive.org/web/20231003055845/https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe' ...
Saving 'arial32.exe'
HTTP response 200  [https://web.archive.org/web/20231003055845/https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe]
Executing cd /home/deck/.var/app/net.lutris.Lutris/data/lutris/runtime/winetricks
------------------------------------------------------
SHA256 mismatch!

URL: https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/5e/arial32.exe
Downloaded: 47d8b28605f07f8d62c70dc573e66d03661777a515f6e72d3d7872c2ecf0460d
Expected: 85297a4d146e9c87ac6f74822734bdee5f4b2a722d7eaa584b7f2cbf76f478f6

This is often the result of an updated package such as vcrun2019.
If you are willing to accept the risk, you can bypass this check.
Alternatively, you may use the --force option to ignore this check entirely.

Continue anyway?
------------------------------------------------------
------------------------------------------------------
Unattended mode, not prompting for confirmation
------------------------------------------------------
grep: warning: stray \ before /
Executing cabextract -q -d /home/deck/Games/battlenet/dosdevices/c:/windows/temp /home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/arial32.exe
/home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/arial32.exe: no valid cabinets found
------------------------------------------------------
warning: Note: command cabextract -q -d /home/deck/Games/battlenet/dosdevices/c:/windows/temp /home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/arial32.exe returned status 1. Aborting.
------------------------------------------------------
Monitored process exited.
Initial process has exited (return code: 256)
All processes have quit
Exit with return code 256

This is my output

strycore commented 1 year ago

Great... I've mirrored https://mirrors.kernel.org/gentoo/distfiles/ and there's no arial32.exe anywhere...

arial32.exe isn't referenced here either: https://github.com/gentoo/gentoo/blob/master/media-fonts/corefonts/Manifest

The Internet Archive backup won't work because the file was never here to being with. Also, IA links don't work with wget2 which is used in the Flatpack.

I'm going to push a patched version of winetricks but meanwhile you can download https://github.com/pushcx/corefonts/raw/master/arial32.exe to /home/deck/.var/app/net.lutris.Lutris/cache/winetricks/corefonts/

strycore commented 1 year ago

With the new update, arial32.exe gets downloaded from Gtihub and winetricks arial works

Brunvik commented 1 year ago

Is this already Up? Would give it a try and Feedback later

strycore commented 1 year ago

Yeah, it's up. Start Lutris with -f to force the update

Brunvik commented 1 year ago

It is working!

zpackrat commented 1 year ago

In case someone like me, Running Fedora 38 and installing Lutris directly instead of flatpak the path for the fonts is ~/.cache/winetricks/corefonts Once I copied them to this path, Epic installed fine.

strycore commented 1 year ago

Lutris should download another update for Winetricks with all fonts moved from Gentoo to Github and a fix for archive.org links on Flatpak.

jwidauer commented 1 year ago

Just tried to install the battle.net client and I'm getting a certificate error:

Started initial process 528 from /home/jakob/.var/app/net.lutris.Lutris/data/lutris/runtime/winetricks/winetricks --unattended arial
Start monitoring process.
------------------------------------------------------
warning: Github down? version '' doesn't appear to be a valid version
------------------------------------------------------
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Using winetricks 20230212-next - sha256sum: 2d7770aa1f49f42ad9dafb092110dbf49fa6581738f6b80488cf0d7f59b2de72 with wine-8.0-2385-gd5a97061ec9 (Staging) and WINEARCH=win64
Executing w_do_call arial
------------------------------------------------------
warning: You are using a 64-bit WINEPREFIX. Note that many verbs only install 32-bit versions of packages. If you encounter problems, please retest in a clean 32-bit WINEPREFIX before reporting a bug.
------------------------------------------------------
Executing load_arial 
grep: warning: stray \ before /
Executing cd /home/jakob/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://github.com/pushcx/corefonts/raw/master/arial32.exe to /home/jakob/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Failed to connect: Certificate error
Executing cd /home/jakob/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Downloading https://web.archive.org/web/2000/https://github.com/pushcx/corefonts/raw/master/arial32.exe to /home/jakob/.var/app/net.lutris.Lutris/cache/winetricks/corefonts
Failed to connect: Certificate error
------------------------------------------------------
warning: Downloading https://web.archive.org/web/2000/https://github.com/pushcx/corefonts/raw/master/arial32.exe failed
------------------------------------------------------
Monitored process exited.
Initial process has exited (return code: 256)
All processes have quit
Exit with return code 256

Is this something wrong with my setup or could it be related to these issues?

strycore commented 1 year ago

Looks like you're having issues downloading from Github. Winetricks falls back to the Web Archive and gives a similar error.

Make sure your SSL certificates are up to date on your system.

jwidauer commented 12 months ago

That's what I thought as well, but downloading it any other way (like with wget: wget -O andale32.exe -nd -c https://web.archive.org/web/2000/https://mirrors.kernel.org/gentoo/distfiles/andale32.exe or git) worked without any issues. I solved the issue by individually downloading the required files using wget into the right directory, in the end.

strycore commented 12 months ago

The problem is those files hosted by Gentoo have been moved around and a lot of them were entirely deleted. That leaves Archive.org as the fallback but there is an issue with Flatpak users or wget2 users in general that prevents downloading from Archive.org (our winetricks version should fix that). I'm considering providing a package that provide most commonly used files for winetricks.