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

Issue:
ENV - Variables - Strip Whitespace + Make "Add" better
- Make "Add" better: When adding ENV variables to a game, you click ADD. Space is allocated for the ENV variable, but nothing actually happens visually (perhaps depending on Color Scheme?).

Expected: When you click add, cursor is set to input field of the ENV variable. This indicated where you should put it, and most likely will give a blinking cursor indicating where it is.

- Strip Whitespace: Accidental whitespace in front / behind ENV variable gets stored. Perhaps it would be better to strip it.


Discussion:

Resolving patch:
diff --git a/lutris/gui/widgets/common.py b/lutris/gui/widgets/common.py
--- a/lutris/gui/widgets/common.py
+++ b/lutris/gui/widgets/common.py
@@ -255,6 +255,9 @@ def __init__(self, data, columns):
 
     def on_add(self, widget):
         self.liststore.append(["", ""])
+        row_position = len(self.liststore)-1
+        self.treeview.set_cursor(row_position, None, False)
+        self.treeview.scroll_to_cell(row_position, None, False, 0.0, 0.0)
         self.emit("changed")
 
     def on_delete(self, widget):
@@ -264,7 +267,7 @@ def on_delete(self, widget):
         self.emit("changed")
 
     def on_text_edited(self, widget, path, text, field):
-        self.liststore[path][field] = text
+        self.liststore[path][field] = text.strip()
         self.emit("changed")
 
     def get_data(self):


Test patch:
Repository: lutris/lutris

Issue:
AMDVLK ICD Loader not available in settings
The Vulkan ICD Loader chooser implemented by https://github.com/lutris/lutris/commit/121a735341bcf94dc719f17663961096f7a5a787 only looks for ICD Loaders located at `/usr/share/vulkan/icd.d` and `/opt/amdgpu-pro/etc/vulkan/icd.d/`, which is fine for RADV and (probably) AMDGPU-PRO.

AMDVLK's loader is installed at `/etc/vulkan/icd.d` (on Ubuntu), so it doesn't show up in Lutris.

A workaround to this is simply linking the file located at `/etc/vulkan/icd.d` to either `/usr/share/vulkan/icd.d` or `/opt/amdgpu-pro/etc/vulkan/icd.d/`, but this isn't the optimal way to fix the issue (eg. if you remove the amdvlk package the symlink created will remain there, broken).


Discussion:

Resolving patch:
diff --git a/lutris/sysoptions.py b/lutris/sysoptions.py
--- a/lutris/sysoptions.py
+++ b/lutris/sysoptions.py
@@ -22,16 +22,16 @@ def get_optirun_choices():
 
 def get_vk_icd_choices():
     """Return available Vulkan ICD loaders"""
+    loader_paths = ["/usr/share/vulkan/icd.d/*.json",  # standard location
+                    "/opt/amdgpu-pro/etc/vulkan/icd.d/*.json",  # AMD GPU Pro - TkG
+                    "/etc/vulkan/icd.d/*.json"]  # AMDVLK - Ubuntu
     choices = [("Auto", "")]
 
-    # Add loaders from standard location
-    for loader in glob.glob("/usr/share/vulkan/icd.d/*.json"):
-        choices.append((os.path.basename(loader), loader))
+    # Add loaders
+    for path in loader_paths:
+        for loader in glob.glob(path):
+            choices.append((os.path.basename(loader), loader))
 
-    # Also add loaders for the AMD GPU Pro driver
-    # https://github.com/Tk-Glitch/PKGBUILDS/tree/master/amdgpu-pro-vulkan-only
-    for loader in glob.glob("/opt/amdgpu-pro/etc/vulkan/icd.d/*.json"):
-        choices.append((os.path.basename(loader), loader))
     return choices
 
 


Test patch:
Repository: lutris/lutris

Issue:
Do not remove install folder after cancelling installer if it existed before the installation
I recently had a very unpleasant experience of running an installer over existing prefix to update stuff, cancelling by mistake and losing all my precious save files and 34GB of game data :( Would be nice to avoid such situations.


Discussion:

Resolving patch:
diff --git a/lutris/gui/dialogs/__init__.py b/lutris/gui/dialogs/__init__.py
--- a/lutris/gui/dialogs/__init__.py
+++ b/lutris/gui/dialogs/__init__.py
@@ -99,6 +99,9 @@ def __init__(self, dialog_settings):
         )
         self.set_markup(dialog_settings["question"])
         self.set_title(dialog_settings["title"])
+        if "widgets" in dialog_settings:
+            for widget in dialog_settings["widgets"]:
+                self.get_message_area().add(widget)
         self.result = self.run()
         self.destroy()
 
diff --git a/lutris/gui/installerwindow.py b/lutris/gui/installerwindow.py
--- a/lutris/gui/installerwindow.py
+++ b/lutris/gui/installerwindow.py
@@ -474,10 +474,15 @@ def create_shortcuts(self, *args):
 
     def cancel_installation(self, widget=None):
         """Ask a confirmation before cancelling the install"""
+        remove_checkbox = Gtk.CheckButton.new_with_label("Remove game files")
+        if self.interpreter:
+            remove_checkbox.set_active(self.interpreter.game_dir_created)
+            remove_checkbox.show()
         confirm_cancel_dialog = QuestionDialog(
             {
                 "question": "Are you sure you want to cancel the installation?",
                 "title": "Cancel installation?",
+                "widgets": [remove_checkbox]
             }
         )
         if confirm_cancel_dialog.result != Gtk.ResponseType.YES:
@@ -486,6 +491,7 @@ def cancel_installation(self, widget=None):
             system.execute([system.find_executable("wineserver"), "-k9"])
             return True
         if self.interpreter:
+            self.interpreter.game_dir_created = remove_checkbox.get_active()
             self.interpreter.revert()
             self.interpreter.cleanup()
         self.destroy()


Test patch:
Repository: lutris/lutris

Issue:
[Flatpak] 'libgamemodeauto.so' from LD_PRELOAD cannot be preloaded
**Describe the bug**

The full path of libgamemodeauto.so is hard-coded. For this reason, [Feral's Gamemode does not work when using Flatpak to install Lutris](https://github.com/flathub/net.lutris.Lutris/issues/22#issuecomment-515764890).

**Expected behavior**

The linker should find the library, and provide Lutris with the correct path. 

**Current behavior**

Feral's Gamemode does not work because the library cannot be found in the hard-coded directory.

**Steps to reproduce**

- Install Lutris from flathub-beta via Flatpak
- Run it from a terminal, and enable Feral's Gamemode
- Start a game, and pay attention to the terminal output

**Lutris debugging output**

https://gist.github.com/Bryophyllum/e1bb8ec09449b1047173d9c674597ae2


Discussion:
My suggestion is to remove full path and use just `libgamemodeauto.so` here
https://github.com/lutris/lutris/blob/b908769a96e6dd2c00b3b1e439895dd61751eb30/lutris/game.py#L471
The dynamic loader should handle it and pick the library of correct architecture it's present in system library search paths. This may even fix #1304.

Resolving patch:
diff --git a/lutris/game.py b/lutris/game.py
--- a/lutris/game.py
+++ b/lutris/game.py
@@ -470,7 +470,7 @@ def configure_game(self, prelaunched, error=None):
                     path
                     for path in [
                         env.get("LD_PRELOAD"),
-                        "/usr/$LIB/libgamemodeauto.so",
+                        "libgamemodeauto.so",
                     ]
                     if path
                 ]


Test patch:
Repository: lutris/lutris

Issue:
Lutris does not check for icd files in /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/ 
**Describe the bug**

Lutris doesn't check for icd files in /usr/lib/x86_64-linux-gnu/GL/vulkan/icd.d/. This is where Flatpak stores them.

**Expected behavior**

Lutris finds installed icd files and shows them.

**Current behavior**

Under Flatpak, Lutris does not show any icd files and only shows Auto. 

**Steps to reproduce**

Grab the Lutris Flatpak from flathub-beta

**Screenshots**

![image](https://user-images.githubusercontent.com/38067056/64596943-c259a000-d3ac-11e9-9219-4520649ccef7.png)




Discussion:

Resolving patch:
diff --git a/lutris/sysoptions.py b/lutris/sysoptions.py
--- a/lutris/sysoptions.py
+++ b/lutris/sysoptions.py
@@ -8,6 +8,17 @@
 from lutris.discord import DiscordPresence
 
 
+VULKAN_DATA_DIRS = [
+    "/usr/local/etc/vulkan",  # standard site-local location
+    "/usr/local/share/vulkan",  # standard site-local location
+    "/etc/vulkan",  # standard location
+    "/usr/share/vulkan",  # standard location
+    "/usr/lib/x86_64-linux-gnu/GL/vulkan",  # Flatpak GL extension
+    "/usr/lib/i386-linux-gnu/GL/vulkan",  # Flatpak GL32 extension
+    "/opt/amdgpu-pro/etc/vulkan"  # AMD GPU Pro - TkG
+]
+
+
 def get_optirun_choices():
     """Return menu choices (label, value) for Optimus"""
     choices = [("Off", "off")]
@@ -22,13 +33,11 @@ def get_optirun_choices():
 
 def get_vk_icd_choices():
     """Return available Vulkan ICD loaders"""
-    loader_paths = ["/usr/share/vulkan/icd.d/*.json",  # standard location
-                    "/opt/amdgpu-pro/etc/vulkan/icd.d/*.json",  # AMD GPU Pro - TkG
-                    "/etc/vulkan/icd.d/*.json"]  # AMDVLK - Ubuntu
     choices = [("Auto", "")]
 
     # Add loaders
-    for path in loader_paths:
+    for data_dir in VULKAN_DATA_DIRS:
+        path = os.path.join(data_dir, "icd.d", "*.json")
         for loader in glob.glob(path):
             choices.append((os.path.basename(loader), loader))
 


Test patch:
Repository: lutris/lutris

Issue:
Lutris doesn't show right and left panel by default
This is a very serious issue, because now new users, by default, only see this:
![image](https://user-images.githubusercontent.com/10602045/65707831-f8c63900-e095-11e9-8845-78819d1e3fdc.png)
which is very confusing, as Lutris is missing half of its UI, and it's not obvious it even exists as it's hidden under an option in a menu!
If you already have Lutris installed, reproduction is very easy: you just need to remove `lutris.conf` file from `~/.cache`.


Discussion:

Resolving patch:
diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py
--- a/lutris/gui/lutriswindow.py
+++ b/lutris/gui/lutriswindow.py
@@ -266,12 +266,12 @@ def filter_installed(self):
 
     @property
     def left_side_panel_visible(self):
-        show_left_panel = settings.read_setting("left_side_panel_visible").lower() == "true"
+        show_left_panel = settings.read_setting("left_side_panel_visible").lower() != "false"
         return show_left_panel or self.sidebar_visible
 
     @property
     def right_side_panel_visible(self):
-        show_right_panel = settings.read_setting("right_side_panel_visible").lower() == "true"
+        show_right_panel = settings.read_setting("right_side_panel_visible").lower() != "false"
         return show_right_panel or self.sidebar_visible
 
     @property


Test patch:
Repository: lutris/lutris

Issue:
Importing of Steam games that are already in the library (uninstalled) does not make them appear installed
How to reproduce:
1. Add a game to your game library on Lutris.Net
2. Relaunch Lutris to let it fetch the new data and add the game to the library
3. Have that game installed locally through Steam
4. Import the game through "Import Games" menu

Expected behavior: the game now appears in the library as installed and is ready to be launched
Observed Behavior: nothing happens, the game remains uninstalled in the library until you manually run the installer it

A lot of users get confused by this because they think the Importing process failed as nothing happens after the importing process.


Discussion:
going to mark this as a bug because games imported from the steam service should be set as installed.
I took a stab at this and did not manage to fix it, but can provide some more information in hopes someone more familiar with the project can resolve it.

The issue is in "lutris/services/steam.py", when a game is already added to the Lutris library and then is installed via the steam application (outside of Lutris), the game's installation status is not synced to Lutris. Lutris will not sync the game properly because an entry in the SQlite database already exists and shows it as uninstalled.

More specifically, under the sync() method:
```
if steamid not in self.lutris_steamids:
    added_games.append(game.install())
else:
    pga_game = self.get_pga_game(game)
        if pga_game:
            added_games.append(game.install(pga_game))
```
The steamid is already in self.lutris_steamids, so the game is not added here. I believe you'd need some kind of check under this else statement, or an elif, that compares steam's manifest files (using lutris.util.steam.appmanifest) to the .db file and reconciles conflicting install statuses. I tried doing this, but didn't quite figure out how to do it.
@vahtos I like your attempt to solve the problem. I think it should be re-implemented to only add steamids of games that actually installed and not just because they're in the library.

I'd say a message should popup to the user telling them to install all their steam games from the steam client before importing them.

Resolving patch:
diff --git a/lutris/services/steam.py b/lutris/services/steam.py
--- a/lutris/services/steam.py
+++ b/lutris/services/steam.py
@@ -127,7 +127,7 @@ def get_pga_game(self, game):
         for pga_game in self.lutris_games:
             if (
                     str(pga_game["steamid"]) == game.appid
-                    and pga_game["runner"] == self.runner
+                    and (pga_game["runner"] == self.runner or not pga_game["runner"])
                     and not pga_game["installed"]
             ):
                 return pga_game


Test patch:
Repository: lutris/lutris

Issue:
Don't show Steam Linux Runtime when importing games
Link to the tool on steamdb: https://steamdb.info/app/1070560/


Discussion:

Resolving patch:
diff --git a/lutris/services/steam.py b/lutris/services/steam.py
--- a/lutris/services/steam.py
+++ b/lutris/services/steam.py
@@ -20,6 +20,7 @@ class SteamGame(ServiceGame):
     installer_slug = "steam"
     excluded_appids = [
         "228980",  # Steamworks Common Redistributables
+        "1070560", # Steam Linux Runtime
     ]
 
     @classmethod


Test patch:
Repository: lutris/lutris

Issue:
wine/winesteam: option to use system winetricks
Winetricks is often updated, and winetricks binary provided by lutris is not updated often enough.
As workaround i use
```
rm -f "$XDG_DATA_HOME/lutris/runtime/winetricks/winetricks"
ln -sfv /usr/bin/winetricks "$XDG_DATA_HOME/lutris/runtime/winetricks/winetricks"
chmod 555 "$XDG_DATA_HOME/lutris/runtime/winetricks"
```


Discussion:

Resolving patch:
diff --git a/lutris/runners/commands/wine.py b/lutris/runners/commands/wine.py
--- a/lutris/runners/commands/wine.py
+++ b/lutris/runners/commands/wine.py
@@ -337,12 +337,17 @@ def winetricks(
         disable_runtime=False,
 ):
     """Execute winetricks."""
-    winetricks_path = os.path.join(settings.RUNTIME_DIR, "winetricks/winetricks")
-    if not system.path_exists(winetricks_path):
-        logger.warning(
-            "Could not find local winetricks install, falling back to bundled version"
-        )
-        winetricks_path = os.path.join(datapath.get(), "bin/winetricks")
+    wine_config = config or LutrisConfig(runner_slug="wine")
+    system_winetricks = wine_config.get("system_winetricks")
+    if system_winetricks:
+        winetricks_path = "usr/bin/winetricks"
+    else:
+        winetricks_path = os.path.join(settings.RUNTIME_DIR, "winetricks/winetricks")
+        if not system.path_exists(winetricks_path):
+            logger.warning(
+                "Could not find local winetricks install, falling back to bundled version"
+            )
+            winetricks_path = os.path.join(datapath.get(), "bin/winetricks")
     if wine_path:
         winetricks_wine = wine_path
     else:
diff --git a/lutris/runners/wine.py b/lutris/runners/wine.py
--- a/lutris/runners/wine.py
+++ b/lutris/runners/wine.py
@@ -205,6 +205,14 @@ def dxvk_vulkan_callback(widget, option, config):
                     'selected "Custom" as the Wine version.'
                 ),
             },
+            {
+                "option": "system_winetricks",
+                "label": "Use system winetricks",
+                "type": "bool",
+                "default": False,
+                "advanced": True,
+                "help": "Switch on to use /usr/bin/winetricks for winetricks.",
+            },
             {
                 "option": "dxvk",
                 "label": "Enable DXVK",


Test patch:
Repository: lutris/lutris

Issue:
Can't use any installers
When I try to install Epic Games Store, for example https://lutris.net/games/epic-games-store/
the installer eventually fails on this:
```
2019-12-29 10:35:48,329: Error while completing task <bound method CommandsMixin.execute of <lutris.installer.interpreter.ScriptInterpreter object at 0x7f3f726e59a0>>: sequence item 1: expected str instance, list found
<class 'TypeError'> sequence item 1: expected str instance, list found
  File "/usr/lib/python3.8/site-packages/lutris/util/jobs.py", line 30, in target
    result = self.function(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/lutris/installer/commands.py", line 152, in execute
    command.start()
  File "/usr/lib/python3.8/site-packages/lutris/command.py", line 116, in start
    logger.debug("Running %s", " ".join(self.wrapper_command))
```
It seems to affect all installers though, not just this one.



Discussion:
commit d394a1750f541ae4a802c9bb2482bac4836a53b9 added self._title to the list of values returned which then causes an error when no title argument was given to the class

Resolving patch:
diff --git a/lutris/command.py b/lutris/command.py
--- a/lutris/command.py
+++ b/lutris/command.py
@@ -61,7 +61,7 @@ def __init__(
 
         self._stdout = io.StringIO()
 
-        self._title = title if title else command
+        self._title = title if title else command[0]
 
     @property
     def stdout(self):


Test patch:
Repository: lutris/lutris

Issue:
Problem with user directories when sandboxing is disabled
Hi, i have strange problem in recent version. I have disabled wineprefix sandboxing, so my user directories were configured as symlinks. But in recent version programs (or even wine config) do not start with error:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/lutris/runners/wine.py", line 676, in run_winecfg
    self.prelaunch()
  File "/usr/lib/python3.7/site-packages/lutris/runners/wine.py", line 778, in prelaunch
    self.sandbox(prefix_manager)
  File "/usr/lib/python3.7/site-packages/lutris/runners/wine.py", line 926, in sandbox
    wine_prefix.desktop_integration(restore=True)
  File "/usr/lib/python3.7/site-packages/lutris/util/wine/prefix.py", line 132, in desktop_integration
    os.rename(old_path, path)
NotADirectoryError: [Errno 20] není adresářem: '/home/petr/.local/share/lutris/runners/winegames/drive_c/users/petr/Plocha.winecfg' -> '/home/petr/.local/share/lutris/runners/winegames/drive_c/users/petr/Plocha'

which is true, because "Plocha" is symlink to proper Desktop directory. When i delete "Plocha.winecfg", same error moves to next user directory "Mé dokumenty" (Documents). When i delete all "winecfg" files, all symlinks to existing user directories are replaced by empty directories. I.e. i am not able to run programs linked to standard user directories despite sandboxing is disabled.


Discussion:

Resolving patch:
diff --git a/lutris/util/wine/prefix.py b/lutris/util/wine/prefix.py
--- a/lutris/util/wine/prefix.py
+++ b/lutris/util/wine/prefix.py
@@ -117,7 +117,11 @@ def desktop_integration(self, desktop_dir=None, restore=False):
                     except OSError:
                         os.rename(path, old_path)
 
-                if restore and not os.path.isdir(path):
+                # if we want to create a symlink and one is already there, just skip to the next item.
+                # this also makes sure the elif doesn't find a dir (isdir only looks at the target of the symlink).
+                if restore and os.path.islink(path):
+                    continue
+                elif restore and not os.path.isdir(path):
                     os.symlink(xdgshortcuts.get_xdg_entry(DESKTOP_XDG[i]), path)
                     # We don't need all the others process of the loop
                     continue


Test patch:
Repository: lutris/lutris

Issue:
Commit 9102071 Breaks Gentoo compatibility
Using a relative path breaks Gentoo compatibility.

Due to Gentoo's ability to have multiple versions of python installed simutaneously, they do some symlink resolution magic that determines which python interpreter should be used for a package based on the constraining flags applied at installation.

Because of this lutris script is not located in /usr/bin/lutris. This is a symlink to the resolver that then performs its magic. This causes lutris to fail to be able to call the python-wrapper script.

Recommend non-relative path to lutris-wrapper.
Commit 9102071 Breaks Gentoo compatibility
Using a relative path breaks Gentoo compatibility.

Due to Gentoo's ability to have multiple versions of python installed simutaneously, they do some symlink resolution magic that determines which python interpreter should be used for a package based on the constraining flags applied at installation.

Because of this lutris script is not located in /usr/bin/lutris. This is a symlink to the resolver that then performs its magic. This causes lutris to fail to be able to call the python-wrapper script.

Recommend non-relative path to lutris-wrapper.


Discussion:
And that's what I was waiting for.

@sharkwouter please send a fix or I'll revert your PR before the release.
Will do
And that's what I was waiting for.

@sharkwouter please send a fix or I'll revert your PR before the release.
Will do

Resolving patch:
diff --git a/lutris/command.py b/lutris/command.py
--- a/lutris/command.py
+++ b/lutris/command.py
@@ -17,6 +17,15 @@
 from lutris.util import system
 
 WRAPPER_SCRIPT = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "../share/lutris/bin/lutris-wrapper"))
+if not os.path.isfile(WRAPPER_SCRIPT):
+    usr_path = "/usr/share/lutris/bin/lutris-wrapper"
+    usr_local_path = "/usr/local/share/lutris/bin/lutris-wrapper"
+    if os.path.isfile(usr_path):
+        WRAPPER_SCRIPT = usr_path
+    elif os.path.isfile(usr_local_path):
+        WRAPPER_SCRIPT = usr_local_path
+    else:
+        raise FileNotFoundError("Couldn't find lutris-wrapper script in any of the expected locations")
 
 
 class MonitoredCommand:


Test patch:
Repository: lutris/lutris

Issue:
Runners list is not updated on a second install/uninstall
**Describe the bug**
The second time you are trying to install a runner on a Lutris session, the runner list won't be updated anymore.

**Current behavior**
The runner list is updated only once per install/uninstall for each runner

**Steps to reproduce**
1. For the sake of this testing, make sure you don't have ZDoom installed.
2. Open Lutris.
3. Open the 'Manage runners' window.
4. Install ZDoom runner.
4.1. As expected, the runner list from the main Lutris window has added the ZDoom entry.
5. Uninstall ZDoom runner.
5.1. As expected, the runner list from the main Lutris window removed the ZDoom entry.
6. Reinstall ZDoom runner.
6.1. The runner list from the main Lutris window haven't added the ZDoom entry!


Discussion:

Resolving patch:
diff --git a/lutris/gui/widgets/sidebar.py b/lutris/gui/widgets/sidebar.py
--- a/lutris/gui/widgets/sidebar.py
+++ b/lutris/gui/widgets/sidebar.py
@@ -190,3 +190,4 @@ def update(self, *args):  # pylint: disable=unused-argument
         self.installed_runners = [runner.name for runner in runners.get_installed()]
         self.active_platforms = pga.get_used_platforms()
         self.invalidate_filter()
+        return True


Test patch: