internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: lutris/lutris

Issue:
Cannot paste GoG login credentials into login helper window
Using `lutris-0.5.2.1` I cannot paste my GoG login credentials into the GoG login helper window. This is quite annoying as I have a password with 40+ characters and typing such a password is quite error-prone.
Neither Linux middle mouse button works nor CTRL+V but typing from keyboard works.


Discussion:
I can duplicate this inconsistently.  It's strange.  The paste option appears when you right click, but nothing gets pasted.  Same with ctrl+v/middle click.  For testing, I made the WebView editable, and could paste into the box.  Disabled that again, because it makes the whole page editable.  However, I launched lutris with the debug flag, and could then paste into the field.  Then I closed it completely and launched again without debug, and could still paste.  There's something really fishy here, but I think it's a GTK problem.
> I can duplicate this inconsistently. It's strange. The paste option appears when you right click, but nothing gets pasted.

Same. And I rerun Lutris and not paste works.

Then I alt tab to get my password from KeepassXC and the paste doesn't work anymore.

- Distro: Arch Linux
- lutris 0.5.2.2-1
- gtk2 2.24.32-1
- gtk3 1:3.24.10-1
- webkit2gtk 2.24.4-1
- qt5-webkit 5.212.0alpha3-3

Ok I get it, it's when I go to KeepassXC, do ctrl-c on a text (it can even the text in the search field) that when I paste in Lutris's GOG window, that the empty string is pasted. Thus clearing the field if there was something else.

When I restart Lutris, open a GOG login window, then I can paste text that I copied from Firefox for example. But If I copy something from KeepassXC, then the GOG login window is broken (about pasting) for the rest of the session until Lutris's restart
Yes, I can confirm this happens in combination with keepassxc. Sorry I didn't mention this in my initial report.
Great that we nailed down how to reproduce :)
This is also the case with the new humble bundle integration.

Resolving patch:
diff --git a/lutris/services/gog.py b/lutris/services/gog.py
--- a/lutris/services/gog.py
+++ b/lutris/services/gog.py
@@ -279,7 +279,8 @@ def connect(parent=None):
     """Connect to GOG"""
     logger.debug("Connecting to GOG")
     dialog = WebConnectDialog(SERVICE, parent)
-    dialog.run()
+    dialog.set_modal(True)
+    dialog.show()
 
 
 def disconnect():
diff --git a/lutris/services/humblebundle.py b/lutris/services/humblebundle.py
--- a/lutris/services/humblebundle.py
+++ b/lutris/services/humblebundle.py
@@ -152,7 +152,8 @@ def is_connected():
 def connect(parent=None):
     """Connect to Humble Bundle"""
     dialog = WebConnectDialog(SERVICE, parent)
-    dialog.run()
+    dialog.set_modal(True)
+    dialog.show()
 
 
 def disconnect():


Test patch:
Repository: lutris/lutris

Issue:
lutris lutris:rungameid/ does not work
**Describe the bug**

Using desktop shortcut does work, lutris not starting the game.

**Steps to reproduce**

- Install kubuntu 20.10 + lutris 0.5.8.
- Install game, create a desktop shortcut from lutris.
- Try to launch game using desktop shortcut

**Lutris debugging output (Optional)**

All log:
```
~
❯ lutris -d lutris:rungameid/1219
INFO     2020-11-15 15:53:55,474 [application.do_command_line:319]:Lutris 0.5.8
INFO     2020-11-15 15:53:55,474 [startup.check_driver:69]:Running X.Org Mesa driver 20.2.2 on Radeon RX 560 Series (POLARIS11, DRM 3.39.0, 5.9.8-xanmod1, LLVM 11.0.0) (0x67ff)
INFO     2020-11-15 15:53:55,475 [startup.check_driver:81]:GPU: 1002:67FF 1043:04BC (amdgpu drivers)
```
**System information (Optional)**
[lutris-issue-report.zip](https://github.com/lutris/lutris/files/5542468/lutris-issue-report.zip)


**Screenshots (Optional)**

If your issue is hard to explain with words, feel free to attach screenshots.



Discussion:
Same issue with lutris git build on Fedora 33 KDE.
can confirm this behaviour with the recent update (0.5.8) coming in yesterday for Debian testing. Desktop shortcuts using rungameid not working, however starting from Lutris itself, the games work.
worked in the past, broken with 0.5.8
This also affects the [Lutris Kodi Addon](https://github.com/RobLoach/lutris-kodi-addon) since it uses `lutris lutris:rungameid/` to launch games.
I have ran a `git bisect` and have found that a04c640e678e6851015ddaa311ca685f357c425a is the commit that introduced this issue. Investigating a bit more to see if I can find a fix but I have never look at lutris' code before, maybe someone will beat me to it!

Resolving patch:
diff --git a/lutris/gui/application.py b/lutris/gui/application.py
--- a/lutris/gui/application.py
+++ b/lutris/gui/application.py
@@ -462,7 +462,7 @@ def do_command_line(self, command_line):  # noqa: C901  # pylint: disable=argume
                     self.do_shutdown()
                 return 0
             game = Game(db_game["id"])
-            self.on_game_start(game)
+            self.on_game_launch(game)
         return 0
 
     def on_game_launch(self, game):


Test patch:
Repository: lutris/lutris

Issue:
python-magic dependency conflicts with file-magic (official python bindings for libmagic)
**Describe the bug**

I'm the Lutris packager for Mageia.

Lutris 0.5.8 added a dependency on `python-magic`, which is https://github.com/ahupp/python-magic

`python-magic` provides the `magic.py` module, which conflicts with the official Python bindings for libmagic provided by the `file` package (`python3-file-magic` on Mageia - previously `python3-magic` but I renamed it to make room for the conflicting `python-magic` package).

Long story short, those seem to be two competing implementations for the `magic` module and they can't be installed next to each other. Which means that once packaged in a distro, you can't install packaged software which independently require `file-magic` and `python-magic`.
Downstream issue (`rpmlint` and `lutris` can't be installed together): https://bugs.mageia.org/show_bug.cgi?id=27619

Upstream issue (8 years old, made some progress 2 years ago but still not resolved): https://github.com/ahupp/python-magic/issues/21

That's an unfortunate upstream issue and not directly related to Lutris but it does make packaging trickier. I'm not sure what the best solution would be here, but it might be worth checking if Lutris could use `python-magic` OR `file-magic`, whichever is installed? This would let distros settle on one fork as the main dependency for their packages.

**Steps to reproduce**

- Try to install a package that depends on `file`'s libmagic Python bindings together with Lutris that requires https://github.com/ahupp/python-magic


Discussion:
Quote from the Fedora Bug Report https://bugzilla.redhat.com/show_bug.cgi?id=1899279

```
Did a very quick source dive, it's used as part of the new automatic installers for gog and humble. Lutris degrades gracefully if it's not present — the install will complete, but you'll need to manually select the executable in the game's options afterward. Installers from Lutris.net should continue to work normally.
```
it should be noted that before a62c3149955416fd188b5a140de94d9831bee3f4 lutris didn't used to degrade but instead outright not work

Resolving patch:
diff --git a/lutris/util/game_finder.py b/lutris/util/game_finder.py
--- a/lutris/util/game_finder.py
+++ b/lutris/util/game_finder.py
@@ -13,8 +13,12 @@
 
 
 if not hasattr(magic, "from_file"):
-    logger.error("Your version of python-magic is too old.")
-    MAGIC_AVAILABLE = False
+    if hasattr(magic, "detect_from_filename"):
+        magic.from_file = magic.detect_from_filename
+        MAGIC_AVAILABLE = True
+    else:
+        logger.error("Your version of python-magic is too old.")
+        MAGIC_AVAILABLE = False
 
 
 def is_excluded_elf(filename):


Test patch:
Repository: lutris/lutris

Issue:
GST_PLUGIN_SYSTEM_PATH_1_0 causes errors with Skryim SE
I have a local (non-steam) installation of Skyrim Special Edition. The audio works perfectly when run in the terminal (by calling wine on the EXE), but NPC voices aren't played when run through Lutris. I'm using the system default wine in Lutris.

I found out that the culprit is the environment variable `GST_PLUGIN_SYSTEM_PATH_1_0`. Setting it in the terminal to the value that Lutris sets (`/home/rharish/.local/share/lutris/runners/wine/system/lib64/gstreamer-1.0/:/home/rharish/.local/share/lutris/runners/wine/system/lib/gstreamer-1.0/`) silences NPC voices, and removing it in the [Lutris code](https://github.com/lutris/lutris/blob/master/lutris/runners/wine.py#L878) solves the issue through Lutris.

Please add an option to the wine runner settings in the GUI to disable this environment variable.

Details:
* OS: Arch Linux
* Lutris version: 0.5.8.3
* System Wine version: 6.3 staging
* System GStreamer version: 1.18.3


Discussion:

Resolving patch:
diff --git a/lutris/runners/wine.py b/lutris/runners/wine.py
--- a/lutris/runners/wine.py
+++ b/lutris/runners/wine.py
@@ -876,11 +876,10 @@ def get_env(self, os_env=False):
         env["WINEARCH"] = self.wine_arch
         env["WINE"] = self.get_executable()
         if is_gstreamer_build(self.get_executable()):
-            env["GST_PLUGIN_SYSTEM_PATH_1_0"] = (
-                os.path.join(WINE_DIR, self.get_version(), "lib64/gstreamer-1.0/")
-                + ":"
-                + os.path.join(WINE_DIR, self.get_version(), "lib/gstreamer-1.0/")
-            )
+            path_64 = os.path.join(WINE_DIR, self.get_version(), "lib64/gstreamer-1.0/")
+            path_32 = os.path.join(WINE_DIR, self.get_version(), "lib/gstreamer-1.0/")
+            if os.path.exists(path_64) or os.path.exists(path_32):
+                env["GST_PLUGIN_SYSTEM_PATH_1_0"] = path_64 + ":" + path_32
         if self.prefix_path:
             env["WINEPREFIX"] = self.prefix_path
 


Test patch:
Repository: lutris/lutris

Issue:
0.5.9 Gamescope should default to fullscreen
Currently it defaults to a Gamescope window when the game is launched.

The Gamescope documentation states that the argument `-f` needs to be passed for the window to start in fullscreen


Discussion:

Resolving patch:
diff --git a/lutris/runner_interpreter.py b/lutris/runner_interpreter.py
--- a/lutris/runner_interpreter.py
+++ b/lutris/runner_interpreter.py
@@ -107,7 +107,7 @@ def get_launch_parameters(runner, gameplay_info):
 
 def get_gamescope_args(launch_arguments, system_config):
     """Insert gamescope at the start of the launch arguments"""
-    launch_arguments.insert(0, "--")
+    launch_arguments.insert(0, "-f --")
     if system_config.get("gamescope_output_res"):
         output_width, output_height = system_config["gamescope_output_res"].lower().split("x")
         launch_arguments.insert(0, output_height)


Test patch:
Repository: lutris/lutris

Issue:
Store banners in .cache
They have no place to be in .local/share
Store banners in .cache
They have no place to be in .local/share


Discussion:

Resolving patch:
diff --git a/lutris/settings.py b/lutris/settings.py
--- a/lutris/settings.py
+++ b/lutris/settings.py
@@ -23,7 +23,7 @@
 GAME_CONFIG_DIR = os.path.join(CONFIG_DIR, "games")
 
 TMP_PATH = os.path.join(CACHE_DIR, "tmp")
-BANNER_PATH = os.path.join(DATA_DIR, "banners")
+BANNER_PATH = os.path.join(CACHE_DIR, "banners")
 COVERART_PATH = os.path.join(DATA_DIR, "coverart")
 ICON_PATH = os.path.join(GLib.get_user_data_dir(), "icons", "hicolor", "128x128", "apps")
 


Test patch:
Repository: lutris/lutris

Issue:
Gamescope failure
Spot the issue, I can't. Just enabled gamescope with latest version but it seems there is invalid syntax. 

Started initial process 34578 from gamescope -f -- gamemoderun /home/theriddick/.local/share/lutris/runners/wine/lutris-ge-6.18-1-x86_64/bin/wine /mnt/GamesNVMe/Games/Encased A Sci-Fi Post-Apocalyptic RPG/Encased.exe
Start monitoring process.
gamescope: invalid option -- ' '
See --help for a list of options.
Monitored process exited.
Initial process has exited (return code: 256)
All processes have quit
Exit with return code 256



Discussion:
The issue is likely the unescaped "Encased A Sci-Fi Post-Apocalyptic RPG".
Ok so just renaming that folder to something without spaces should solve it.
It's not limited to paths with spaces:
```
Started initial process 117687 from gamescope -f -- gamemoderun /usr/bin/strangle 100 /home/felix/.local/share/lutris/runners/wine/lutris-ge-6.19-1-x86_64/bin/wine /home/felix/Storage/Games/warhammer-online-return-of-reckoning/drive_c/WarhammerOnline-ReturnofReckoning/RoRLauncher.exe
Start monitoring process.
gamescope: invalid option -- ' '
See --help for a list of options.
Monitored process exited.
Initial process has exited (return code: 256)
All processes have quit
Exit with return code 256
```
The command is accepted when I use it in a terminal with zsh, so something has to be different between the command as shown and the command as run.

Resolving patch:
diff --git a/lutris/runner_interpreter.py b/lutris/runner_interpreter.py
--- a/lutris/runner_interpreter.py
+++ b/lutris/runner_interpreter.py
@@ -107,7 +107,8 @@ def get_launch_parameters(runner, gameplay_info):
 
 def get_gamescope_args(launch_arguments, system_config):
     """Insert gamescope at the start of the launch arguments"""
-    launch_arguments.insert(0, "-f --")
+    launch_arguments.insert(0, "--")
+    launch_arguments.insert(0, "-f")
     if system_config.get("gamescope_output_res"):
         output_width, output_height = system_config["gamescope_output_res"].lower().split("x")
         launch_arguments.insert(0, output_height)


Test patch:
Repository: lutris/lutris

Issue:
"Could not retrieve game installer" when trying to install a game from EGS source
Whenever I try to install a game through the Epic Games source, I always get a "Could not retrieve game installer" when the installer window pops up. After I close it (which seems to put the installer window to foreground for some reason, very annoying), I can install EGS just fine.


Discussion:

Resolving patch:
diff --git a/lutris/gui/application.py b/lutris/gui/application.py
--- a/lutris/gui/application.py
+++ b/lutris/gui/application.py
@@ -502,8 +502,6 @@ def on_game_install(self, game):
             if game_id:
                 game = Game(game_id)
                 game.launch()
-            else:
-                ErrorDialog(message=_("Could not retrieve game installer."), parent=self.window)
             return True
         if not game.slug:
             raise ValueError("Invalid game passed: %s" % game)
diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py
--- a/lutris/gui/lutriswindow.py
+++ b/lutris/gui/lutriswindow.py
@@ -808,7 +808,6 @@ def on_game_collection_changed(self, _sender):
 
     def on_game_activated(self, view, game_id):
         """Handles view activations (double click, enter press)"""
-        initial_game_id = game_id
         if self.service:
             logger.debug("Looking up %s game %s", self.service.id, game_id)
             db_game = games_db.get_game_for_service(self.service.id, game_id)
@@ -837,5 +836,3 @@ def on_game_activated(self, view, game_id):
                 game.emit("game-launch")
             else:
                 game.emit("game-install")
-        else:
-            logger.warning("No game found for %s", initial_game_id)
diff --git a/lutris/services/base.py b/lutris/services/base.py
--- a/lutris/services/base.py
+++ b/lutris/services/base.py
@@ -184,7 +184,17 @@ def get_installers_from_api(self, appid):
         return service_installers
 
     def install(self, db_game):
-        """Install a service game"""
+        """Install a service game, or starts the installer of the game.
+
+        Args:
+            db_game (dict or str): Database fields of the game to add, or (for Lutris service only
+                the slug of the game.)
+
+        Returns:
+            str: The slug of the game that was installed, to be run. None if the game should not be
+                run now. Many installers start from here, but continue running after this returns;
+                they return None.
+        """
         appid = db_game["appid"]
         logger.debug("Installing %s from service %s", appid, self.id)
         if self.local:


Test patch:
Repository: lutris/lutris

Issue:
Clear log info before launching a game the second time
Lutris will combine log output from previous runs with the latest run. This can be confusing when trying to debug something or get some information, so it would be nice if Lutris cleared logs from previous sessions and only showed logs from the current session.


Discussion:

Resolving patch:
diff --git a/lutris/game.py b/lutris/game.py
--- a/lutris/game.py
+++ b/lutris/game.py
@@ -484,7 +484,8 @@ def launch(self):
         self.load_config()  # Reload the config before launching it.
 
         if str(self.id) in LOG_BUFFERS:  # Reset game logs on each launch
-            LOG_BUFFERS.pop(str(self.id))
+            log_buffer = LOG_BUFFERS[str(self.id)]
+            log_buffer.delete(log_buffer.get_start_iter(), log_buffer.get_end_iter())
 
         if not self.runner:
             dialogs.ErrorDialog(_("Invalid game configuration: Missing runner"))
diff --git a/lutris/game_actions.py b/lutris/game_actions.py
--- a/lutris/game_actions.py
+++ b/lutris/game_actions.py
@@ -16,7 +16,7 @@
 from lutris.gui.dialogs.uninstall_game import RemoveGameDialog, UninstallGameDialog
 from lutris.gui.widgets.utils import open_uri
 from lutris.util import xdgshortcuts
-from lutris.util.log import LOG_BUFFERS, logger
+from lutris.util.log import logger
 from lutris.util.system import path_exists
 
 
@@ -145,7 +145,7 @@ def on_game_stop(self, _caller):
 
     def on_show_logs(self, _widget):
         """Display game log"""
-        _buffer = LOG_BUFFERS.get(str(self.game.id))
+        _buffer = self.game.log_buffer
         if not _buffer:
             logger.info("No log for game %s", self.game)
         return LogWindow(


Test patch:
Repository: lutris/lutris

Issue:
Pass Nvidia's _GL_SHADER envars for every game
And when I mean every game, I mean for every runner Lutris has.
Nvidia has this stupid shader cache size limitation for their default folder in .cache/nvidia, so to avoid games losing their cached shader entries, especially ones with very large amounts of shaders like Overwatch, we should set a dedicated shader cache path for every game launched through Lutris. This way, the caches aren't mashed together and pruned by the nvidia driver when the folder size exceeds a certain amount (I don't remember what it is but definitely less than half a gig).
Envars that need to be set:
__GL_SHADER_DISK_CACHE=1
__GL_SHADER_DISK_CACHE_PATH=$GAMEDIR
Setting this will create a GLCache folder in $GAMEDIR.


Discussion:

Resolving patch:
diff --git a/lutris/runners/runner.py b/lutris/runners/runner.py
--- a/lutris/runners/runner.py
+++ b/lutris/runners/runner.py
@@ -147,6 +147,11 @@ def get_env(self, os_env=False):
         if os_env:
             env.update(os.environ.copy())
 
+        # By default we'll set NVidia's shader disk cache to be
+        # per-game, so it overflows less readily.
+        env["__GL_SHADER_DISK_CACHE"] = "1"
+        env["__GL_SHADER_DISK_CACHE_PATH"] = self.game_path
+
         # Override SDL2 controller configuration
         sdl_gamecontrollerconfig = self.system_config.get("sdl_gamecontrollerconfig")
         if sdl_gamecontrollerconfig:


Test patch:
Repository: lutris/lutris

Issue:
Lutris should not download files and write to $HOME just to print its version
If I want to check the version of Lutris, as per the man page, it is quite straightforward:
```
     -v, --version
              Print the version of Lutris and exit
```

But when I tried that (in my multi-user environment), what I got was the downloading of DXVK, DXVK-NVAPI, VKD3D and D3D. I also ended up with files under `$HOME/.local`, `$HOME/.config` and `$HOME/.cache` that I had to delete manually.

It seems to me that Lutris is taking too many liberties when all it needed to do was to print a string and exit, as per the documentation.


Discussion:

Resolving patch:
diff --git a/lutris/gui/application.py b/lutris/gui/application.py
--- a/lutris/gui/application.py
+++ b/lutris/gui/application.py
@@ -208,14 +208,9 @@ def do_startup(self):  # pylint: disable=arguments-differ
         action.connect("activate", lambda *x: self.quit())
         self.add_action(action)
         self.add_accelerator("<Primary>q", "app.quit")
-        init_lutris()
-        if os.environ.get("LUTRIS_SKIP_INIT"):
-            logger.debug("Skipping initialization")
-            return
-        init_dialog = LutrisInitDialog(update_runtime)
-        init_dialog.run()
 
     def do_activate(self):  # pylint: disable=arguments-differ
+        self.show_update_runtime_dialog()
         if not self.window:
             self.window = LutrisWindow(application=self)
             screen = self.window.props.screen  # pylint: disable=no-member
@@ -227,6 +222,14 @@ def do_activate(self):  # pylint: disable=arguments-differ
             # accordingly
             self.run_in_background = False
 
+    @staticmethod
+    def show_update_runtime_dialog():
+        if os.environ.get("LUTRIS_SKIP_INIT"):
+            logger.debug("Skipping initialization")
+        else:
+            init_dialog = LutrisInitDialog(update_runtime)
+            init_dialog.run()
+
     def get_window_key(self, **kwargs):
         if kwargs.get("appid"):
             return kwargs["appid"]
@@ -330,6 +333,7 @@ def do_command_line(self, command_line):  # noqa: C901  # pylint: disable=argume
             logger.setLevel(logging.NOTSET)
             return 0
 
+        init_lutris()
         migrate()
         run_all_checks()
 
@@ -614,6 +618,7 @@ def execute_command(command):
         """Execute an arbitrary command in a Lutris context
         with the runtime enabled and monitored by a MonitoredCommand
         """
+        Application.show_update_runtime_dialog()
         logger.info("Running command '%s'", command)
         monitored_command = exec_command(command)
         try:


Test patch: