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

Issue:
AttributeError: 'winesteam' object has no attribute 'get_xinput_path'
I'm getting this when trying to launch Dark Souls. Running on Arch 64 bit. Lutris 0.4.14. I searched and couldn't find any similar issues. I tried turning on and off the xinput related runner options but it had no effect.

```
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/lutris/util/jobs.py", line 38, in <lambda>
    GLib.idle_add(lambda: self.callback(result, error))
  File "/usr/lib/python3.6/site-packages/lutris/game.py", line 198, in do_play
    gameplay_info = self.runner.play()
  File "/usr/lib/python3.6/site-packages/lutris/runners/winesteam.py", line 401, in play
    launch_info['ld_preload'] = self.get_xinput_path()
AttributeError: 'winesteam' object has no attribute 'get_xinput_path'
```


Discussion:

Resolving patch:
diff --git a/lutris/runners/winesteam.py b/lutris/runners/winesteam.py
--- a/lutris/runners/winesteam.py
+++ b/lutris/runners/winesteam.py
@@ -397,9 +397,6 @@ def play(self):
         launch_info = {}
         launch_info['env'] = self.get_env(full=False)
 
-        if self.runner_config.get('xinput'):
-            launch_info['ld_preload'] = self.get_xinput_path()
-
         if self.runner_config.get('x360ce-path'):
             self.setup_x360ce(self.runner_config['x360ce-path'])
 


Test patch:
Repository: lutris/lutris

Issue:
Shortcut icons not updated when changing icons in Lutris
If you configure a game and change its icon to a custom one within Lutris, that icon does not seem to be used when creating a desktop shortcut. Instead the default icon off the website gets used.

Is this expected behavior or a bug?


Discussion:
Some desktop manager use a cache of icon. My pull request #746 should resolve the problem.

Resolving patch:
diff --git a/lutris/gui/config_dialogs.py b/lutris/gui/config_dialogs.py
--- a/lutris/gui/config_dialogs.py
+++ b/lutris/gui/config_dialogs.py
@@ -11,7 +11,7 @@
 from lutris.gui.widgets.dialogs import Dialog
 from lutris.gui.widgets.utils import get_pixbuf_for_game, get_pixbuf, BANNER_SIZE, ICON_SIZE
 from lutris.util.strings import slugify
-from lutris.util import datapath
+from lutris.util import datapath, resources
 
 DIALOG_WIDTH = 780
 DIALOG_HEIGHT = 560
@@ -402,6 +402,9 @@ def on_custom_image_select(self, widget, image_type):
             pixbuf.savev(dest_path, file_format, [], [])
             self._set_image(image_type)
 
+            if image_type == 'icon':
+                resources.udpate_desktop_icons()
+
         dialog.destroy()
 
     def on_custom_image_reset_clicked(self, widget, image_type):
diff --git a/lutris/util/resources.py b/lutris/util/resources.py
--- a/lutris/util/resources.py
+++ b/lutris/util/resources.py
@@ -39,6 +39,7 @@ def fetch_icons(game_slugs, callback=None):
 
     results = api.get_games(game_slugs=missing_media_slugs)
 
+    new_icon = False
     banner_downloads = []
     icon_downloads = []
     updated_slugs = []
@@ -55,17 +56,24 @@ def fetch_icons(game_slugs, callback=None):
                 dest_path = get_icon_path(game['slug'], ICON)
                 icon_downloads.append((game['icon_url'], dest_path))
                 updated_slugs.append(game['slug'])
+                new_icon = True
 
     updated_slugs = list(set(updated_slugs))  # Deduplicate slugs
 
     downloads = banner_downloads + icon_downloads
     with concurrent.futures.ThreadPoolExecutor(max_workers=16) as executor:
-        for url, dest_path in downloads:
-            executor.submit(download_media, url, dest_path)
+        futs = [executor.submit(download_media, url, dest_path)
+                for url, dest_path in downloads]
+        concurrent.futures.wait(futs)
+
+    if (new_icon):
+        udpate_desktop_icons()
 
     if updated_slugs and callback:
         callback(updated_slugs)
 
+def udpate_desktop_icons():
+    os.system("xdg-icon-resource forceupdate")
 
 def download_media(url, dest, overwrite=False):
     if os.path.exists(dest):


Test patch:
Repository: lutris/lutris

Issue:
Error while completing task
error after updating this morning:

ERROR    2018-02-04 08:36:44,365 [jobs]:Error while completing task <bound method LutrisWindow.sync_icons of <lutriswindow.LutrisWindow object at 0x7ff3f32d7b88 (LutrisWindow at 0x31c8280)>>: name 're' is not defined
<class 'NameError'> name 're' is not defined
  File "/src/lutris/lutris/util/jobs.py", line 29, in target
    result = self.function(*args, **kwargs)
  File "/src/lutris/lutris/gui/lutriswindow.py", line 392, in sync_icons
    callback=self.on_image_downloaded)
  File "/src/lutris/lutris/util/resources.py", line 40, in fetch_icons
    results = api.get_games(game_slugs=missing_media_slugs)
  File "/src/lutris/lutris/api.py", line 97, in get_games
    page_match = re.search(r'page=(\d+)', response_data['next'])



Discussion:
To correct it you must add `import re` in api.py
> To correct it you must add import re in api.py
@Xenega that also introduce another error:

```
ERROR    2018-02-05 10:05:41,047 [jobs]:Error while completing task <bound method LutrisWindow.sync_icons of <lutriswindow.LutrisWindow object at 0x7f9899ae9c18 (LutrisWindow at 0x18fc280)>>: name 'api' is not defined
<class 'NameError'> name 'api' is not defined
  File "/src/lutris/lutris/util/jobs.py", line 29, in target
    result = self.function(*args, **kwargs)
  File "/src/lutris/lutris/gui/lutriswindow.py", line 392, in sync_icons
    callback=self.on_image_downloaded)
  File "/src/lutris/lutris/util/resources.py", line 40, in fetch_icons
    results = api.get_games(game_slugs=missing_media_slugs)
  File "/src/lutris/lutris/api.py", line 104, in get_games
    page_result = api.get_games(game_slugs=missing_media_slugs, page=page)
```
Remove api, just get_games()
Do my correction works ?

Resolving patch:
diff --git a/lutris/api.py b/lutris/api.py
--- a/lutris/api.py
+++ b/lutris/api.py
@@ -1,4 +1,5 @@
 import os
+import re
 import json
 import urllib.request
 import urllib.parse
@@ -100,7 +101,7 @@ def get_games(game_slugs=None, page=1):
         else:
             logger.error("No page found in %s", response_data['next'])
             break
-        page_result = api.get_games(game_slugs=missing_media_slugs, page=page)
+        page_result = get_games(game_slugs=game_slugs, page=page)
         if not page_result:
             logger.warning("Unable to get response for page %s", page)
             break
diff --git a/lutris/gui/lutriswindow.py b/lutris/gui/lutriswindow.py
--- a/lutris/gui/lutriswindow.py
+++ b/lutris/gui/lutriswindow.py
@@ -600,6 +600,8 @@ def on_game_installed(self, view, game_id):
                       [game.slug], self.on_image_downloaded)
 
     def on_image_downloaded(self, game_slugs):
+        logger.debug("Updated images for %d games" % len(game_slugs))
+
         for game_slug in game_slugs:
             games = pga.get_games_where(slug=game_slug)
             for game in games:


Test patch:
Repository: lutris/lutris

Issue:
»Last Played«-Column sorts by alphabet
The »Last Played«-Column in Game List View apparently sorts by Weekday (or alphabet), not really by Date.

![bildschirmfoto vom 2018-02-26 12-43-33](https://user-images.githubusercontent.com/28046249/36668809-c94f9960-1af2-11e8-8e3a-af363b39122b.png)



Discussion:

Resolving patch:
diff --git a/lutris/gui/gameviews.py b/lutris/gui/gameviews.py
--- a/lutris/gui/gameviews.py
+++ b/lutris/gui/gameviews.py
@@ -26,22 +26,9 @@
     COL_RUNNER_HUMAN_NAME,
     COL_PLATFORM,
     COL_LASTPLAYED,
+    COL_LASTPLAYED_TEXT,
     COL_INSTALLED,
-) = list(range(10))
-
-
-def sort_func(store, a_iter, b_iter, _user_data):
-    """Default sort function."""
-    a_name = store.get(a_iter, COL_NAME)
-    b_name = store.get(b_iter, COL_NAME)
-
-    if a_name > b_name:
-        return 1
-    elif a_name < b_name:
-        return -1
-    else:
-        return 0
-
+) = list(range(11))
 
 class GameStore(GObject.Object):
     __gsignals__ = {
@@ -58,7 +45,7 @@ def __init__(self, games, icon_type, filter_installed):
         self.filter_platform = None
         self.runner_names = {}
 
-        self.store = Gtk.ListStore(int, str, str, Pixbuf, str, str, str, str, str, bool)
+        self.store = Gtk.ListStore(int, str, str, Pixbuf, str, str, str, str, int, str, bool)
         self.store.set_sort_column_id(COL_NAME, Gtk.SortType.ASCENDING)
         self.modelfilter = self.store.filter_new()
         self.modelfilter.set_visible_func(self.filter_view)
@@ -160,6 +147,7 @@ def add_game(self, game):
             runner_name,
             runner_human_name,
             platform,
+            game['lastplayed'],
             lastplayed,
             game['installed']
         ))
@@ -340,7 +328,8 @@ def __init__(self, store):
         self.append_column(column)
         column.connect("notify::width", self.on_column_width_changed)
 
-        column = self.set_column(default_text_cell, "Last played", COL_LASTPLAYED)
+        column = self.set_column(default_text_cell, "Last played", COL_LASTPLAYED_TEXT)
+        self.set_sort_with_column(COL_LASTPLAYED_TEXT, COL_LASTPLAYED)
         width = settings.read_setting('lastplayed_column_width', 'list view')
         column.set_fixed_width(int(width) if width else 120)
         self.append_column(column)
@@ -366,6 +355,17 @@ def set_column(self, cell, header, column_id):
         column.set_reorderable(True)
         return column
 
+    def set_sort_with_column(self, col, sort_col):
+        """Set to sort a column by using another column.
+        """
+
+        def sort_func(model, row1, row2, user_data):
+            v1 = model.get_value(row1, sort_col)
+            v2 = model.get_value(row2, sort_col)
+            return -1 if v1 < v2 else 0 if v1 == v2 else 1
+
+        self.model.set_sort_func(col, sort_func)
+
     def get_selected_game(self):
         """Return the currently selected game's id."""
         selection = self.get_selection()


Test patch:
Repository: lutris/lutris

Issue:
System wine not being detected
This bug appears when using lutris from the next branch on github.

When configuring the Wine runner (or configuring the runner options for a wine game) the dropdown menu for selecting the desired wine version doesn't show system wine as an option.

After reverting back to 86383e097ad23b58cdccd06768fc88c249292523 everything is working normally again, so the issue is most likely in dc7fe76657acf756de94937f3ccc82354f2d27dd.

Happening on Manjaro with the unstable branch and on Solus Budgie


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
@@ -444,7 +444,7 @@ def get_default_version():
 @lru_cache(maxsize=10)
 def get_system_wine_version(wine_path="wine"):
     """Return the version of Wine installed on the system."""
-    if not system.path_exists(wine_path):
+    if not system.path_exists(wine_path) and not shutil.which(wine_path):
         return
     if os.path.isabs(wine_path):
         wine_stats = os.stat(wine_path)


Test patch:
Repository: lutris/lutris

Issue:
Crash on invalid steamless binary
![e0ugeaf](https://user-images.githubusercontent.com/280336/43658908-15905768-970f-11e8-975b-b6581995f873.png)



Discussion:

Resolving patch:
diff --git a/lutris/runners/winesteam.py b/lutris/runners/winesteam.py
--- a/lutris/runners/winesteam.py
+++ b/lutris/runners/winesteam.py
@@ -200,7 +200,7 @@ def working_dir(self):
         """Return the working directory to use when running the game."""
         if self.runner_config['run_without_steam']:
             steamless_binary = self.game_config.get('steamless_binary')
-            if (os.path.isfile(steamless_binary)):
+            if steamless_binary and os.path.isfile(steamless_binary):
                 return os.path.dirname(steamless_binary)
         return os.path.expanduser("~/")
 


Test patch:
Repository: lutris/lutris

Issue:
Prevent crash when saving wine game without appid
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/lutris/gui/config_dialogs.py", line 369, in on_save
    self.game.steamid = self.lutris_config.game_config['appid']
KeyError: 'appid'


Discussion:

Resolving patch:
diff --git a/lutris/gui/config_dialogs.py b/lutris/gui/config_dialogs.py
--- a/lutris/gui/config_dialogs.py
+++ b/lutris/gui/config_dialogs.py
@@ -335,6 +335,9 @@ def is_valid(self):
         if not name:
             ErrorDialog("Please fill in the name")
             return False
+        if self.runner_name in ('steam', 'winesteam') and self.lutris_config.game_config.get('appid') is None:
+            ErrorDialog("Steam AppId not provided")
+            return False
         return True
 
     def on_save(self, _button, callback=None):


Test patch:
Repository: lutris/lutris

Issue:
Menu bar visible during install
![image](https://user-images.githubusercontent.com/1145001/43690524-bac1f914-990b-11e8-9b06-402f737c6cda.png)

While installing a game, the menu bar at the dialog window shouldn't be visible.


Discussion:

Resolving patch:
diff --git a/lutris/gui/installerwindow.py b/lutris/gui/installerwindow.py
--- a/lutris/gui/installerwindow.py
+++ b/lutris/gui/installerwindow.py
@@ -44,6 +44,7 @@ def __init__(self, game_slug=None, installer_file=None, revision=None, parent=No
         self.set_size_request(420, 420)
         self.set_default_size(600, 480)
         self.set_position(Gtk.WindowPosition.CENTER)
+        self.set_show_menubar(False)
 
         self.vbox = Gtk.VBox()
         self.add(self.vbox)


Test patch:
Repository: lutris/lutris

Issue:
Add support for fba in retroarch runner.
Since MAME can take a toll on weaker machines therefore it is advisable to have fBA as an alternative. 


Discussion:

Resolving patch:
diff --git a/lutris/runners/libretro.py b/lutris/runners/libretro.py
--- a/lutris/runners/libretro.py
+++ b/lutris/runners/libretro.py
@@ -22,6 +22,7 @@
     ('DesmuME (Nintendo DS)', 'desmume', 'Nintendo DS'),
     ('Dolphin (Nintendo Wii/Gamecube)', 'dolphin', 'Nintendo Wii/Gamecube'),
     ('EightyOne (Sinclair ZX81)', '81', 'Sinclair ZX81'),
+    ('FB Alpha (Arcade)', 'fbalpha', 'Arcade'),
     ('FCEUmm (Nintendo Entertainment System)', 'fceumm', 'Nintendo NES'),
     ('fMSX (MSX/MSX2/MSX2+)', 'fmsx', 'MSX/MSX2/MSX2+'),
     ('FreeJ2ME (J2ME)', 'freej2me', 'J2ME'),


Test patch:
Repository: lutris/lutris

Issue:
No feedback given if 'main game folder' doesn't exist and lutris has no permissions.
Lutris seems to hang without any kind of error dialog. e.g. my game dir would be `/opt/wine`, and I want to install a game into `/opt/wine/$game`, there's no feedback that not only does `/opt/wine` not exist, but Lutris can't create the game's parent directory. This could be improved.


Discussion:

Resolving patch:
diff --git a/lutris/installer/interpreter.py b/lutris/installer/interpreter.py
--- a/lutris/installer/interpreter.py
+++ b/lutris/installer/interpreter.py
@@ -251,9 +251,13 @@ def iter_game_files(self):
                 os.mkdir(self.cache_path)
 
             if self.target_path and self.should_create_target:
-                os.makedirs(self.target_path)
+                try:
+                    os.makedirs(self.target_path)
+                except PermissionError:
+                    raise ScriptingError("Lutris does not have necessary permissions to install to choosen game dir:", self.target_path)
                 self.reversion_data['created_main_dir'] = True
 
+
         if len(self.game_files) < len(self.files):
             logger.info(
                 "Downloading file %d of %d",


Test patch:
Repository: lutris/lutris

Issue:
DXVK versions not updating when dxvk directory is missing
When `~/.local/share/lutris/runtime/dxvk/` is not present (because a user never used dxvk before), Lutris fails to create `dxvk_versions.json` because the parent directory does not exist, which leads to Lutris showing the (outdated) fallback DXVK versions. A workaround is to create the missing directory manually and to restart Lutris.

![Missing DXVK versions](https://user-images.githubusercontent.com/40150792/45500181-5c790f00-b77e-11e8-9f09-2cbf351ae5eb.png)


Discussion:
Your pull request does not fix the missing directory? Lutris should create this directory during installation. 
No, #1107 does not fix this. It just fixed a typo.
I personally think that creating dxvk_versions.json in the runtime directory rather than the dxvk directory would be easier.

Resolving patch:
diff --git a/lutris/util/dxvk.py b/lutris/util/dxvk.py
--- a/lutris/util/dxvk.py
+++ b/lutris/util/dxvk.py
@@ -17,7 +17,10 @@
 
 def get_dxvk_versions():
     """Get DXVK versions from GitHub"""
-    versions_path = os.path.join(RUNTIME_DIR, 'dxvk', 'dxvk_versions.json')
+    dxvk_path = os.path.join(RUNTIME_DIR, 'dxvk');
+    if not os.path.isdir(dxvk_path):
+        os.mkdir(dxvk_path)
+    versions_path = os.path.join(dxvk_path, 'dxvk_versions.json')
 
     # Download tags if the versions_path does not exist or is more than a day old
     if (


Test patch:
Repository: lutris/lutris

Issue:
Disallow to launch Lutris as root
Please?


Discussion:
Any reason why?
It results in Lutris's files and folders being owned by root and the users not being able to launch Lutris as a normal user. (example: https://forums.lutris.net/t/lutris-client-only-opens-when-opened-as-root-from-terminal/3020/8)
Plus it's just not safe.
Graphical applications are never designed to run as another user, the fact it ever works is luck.
A few Linux distros / setup run all software with `root` user.
Of course it's not safe, but you have to check that also.
Maybe adding a `--force-root` command to allow only these cases would help (+ warn message).
No, we are **not** adding a `--force-root` flag ever :rofl: 

We'll display a warning message and if the user ignores it, well, too bad for them.
Just as a comparable story. HexChat has had a warning before startup on root users for like a decade now. Only Puppy linux users complain and honestly that distro should just feel bad about itself for running as root.
Maybe something similar to what Kate does when trying to run as root?

https://github.com/KDE/kate/blob/f20eec26a535c45f5eb7c0948862d690cdbf44e1/kate/main.cpp#L62

```
sudo kate
[sudo] password for cxf:                     
Executing Kate as root is not possible. To edit files as root use:
SUDO_EDITOR=kate sudoedit <file>


Resolving patch:
diff --git a/lutris/gui/application.py b/lutris/gui/application.py
--- a/lutris/gui/application.py
+++ b/lutris/gui/application.py
@@ -59,6 +59,9 @@ def __init__(self):
         self.window = None
         self.css_provider = Gtk.CssProvider.new()
 
+        if os.geteuid() == 0:
+            ErrorDialog("Running Lutris as root is not recommended and may cause unexpected issues")
+
         try:
             self.css_provider.load_from_path(os.path.join(datapath.get(), 'ui', 'lutris.css'))
         except GLib.Error as e:


Test patch:
Repository: lutris/lutris

Issue:
"Manage Versions` window is too narrow
Recent improvements to Wine version managing are currently a bit pointless due to Manage Versions windows being too narrow and not being able to display the status of the downloading process:
![peek 2018-09-29 11-37](https://user-images.githubusercontent.com/10602045/46243364-21144c80-c3dc-11e8-86b0-5356d707c7d7.gif)




Discussion:

Resolving patch:
diff --git a/lutris/gui/runnerinstalldialog.py b/lutris/gui/runnerinstalldialog.py
--- a/lutris/gui/runnerinstalldialog.py
+++ b/lutris/gui/runnerinstalldialog.py
@@ -23,7 +23,7 @@ def __init__(self, title, parent, runner):
         super(RunnerInstallDialog, self).__init__(
             title, parent, 0, ('_OK', Gtk.ResponseType.OK)
         )
-        width, height = (340, 380)
+        width, height = (460, 380)
         self.dialog_size = (width, height)
         self.set_default_size(width, height)
 


Test patch:
Repository: lutris/lutris

Issue:
Changing executable results in a broken path
![peek 2018-10-10 22-19](https://user-images.githubusercontent.com/10602045/46760444-c8498b80-ccda-11e8-9cae-8c9e713529db.gif)

So after I select a new executable path for the game and save it, it becomes this: `/home/alex/Games/overwatch/~/Games/overwatch/drive_c/Program Files (x86)/Battle.net/Battle.net Launcher.exe` 
which I assume is "path-to-prefix"+"actual-path-to-executable" mashed together.
This is most definitely caused by https://github.com/lutris/lutris/commit/126453255d5a8fd6026507bd1f8ffb90d83f8e71.



Discussion:

Resolving patch:
diff --git a/lutris/gui/config_boxes.py b/lutris/gui/config_boxes.py
--- a/lutris/gui/config_boxes.py
+++ b/lutris/gui/config_boxes.py
@@ -350,12 +350,10 @@ def generate_file_chooser(self, option, path=None):
             if default_path and os.path.exists(default_path):
                 file_chooser.set_current_folder(default_path)
 
-        file_chooser.entry.connect('changed', self._on_chooser_file_set, option_name)
-
         if path:
             # If path is relative, complete with game dir
             if not os.path.isabs(path):
-                path = os.path.join(self.game.directory, path)
+                path =  os.path.expanduser(path)
             file_chooser.entry.set_text(path)
 
         file_chooser.set_valign(Gtk.Align.CENTER)
@@ -363,9 +361,13 @@ def generate_file_chooser(self, option, path=None):
         self.wrapper.pack_start(label, False, False, 0)
         self.wrapper.pack_start(file_chooser, True, True, 0)
         self.option_widget = file_chooser
+        file_chooser.entry.connect('changed', self._on_chooser_file_set,
+                                            option_name)
 
     def _on_chooser_file_set(self, entry, option):
         """Action triggered on file select dialog 'file-set' signal."""
+        if not os.path.isabs(entry.get_text()):
+            entry.set_text(os.path.expanduser(entry.get_text()))
         self.option_changed(entry.get_parent(), option, entry.get_text())
 
     # Directory chooser


Test patch:
Repository: lutris/lutris

Issue:
Have logger scroll automatically only when at the bottom
Currently the logger scrolls whenever it outputs which makes scrolling up useless unless the game is stopped. This behavior is annoying.


Discussion:
Which `logger`? If you mean the terminal, each terminal will have its options to stop this.
The builtin one. https://github.com/lutris/lutris/blob/master/lutris/gui/logwindow.py

Resolving patch:
diff --git a/lutris/gui/logwindow.py b/lutris/gui/logwindow.py
--- a/lutris/gui/logwindow.py
+++ b/lutris/gui/logwindow.py
@@ -10,13 +10,16 @@ def __init__(self, buffer):
         self.set_editable(False)
         self.set_monospace(True)
         self.set_left_margin(10)
+        self.scroll_max = 0
         self.set_wrap_mode(Gtk.WrapMode.CHAR)
         self.get_style_context().add_class('lutris-logview')
         self.connect("size-allocate", self.autoscroll)
 
     def autoscroll(self, *args):
         adj = self.get_vadjustment()
-        adj.set_value(adj.get_upper() - adj.get_page_size())
+        if adj.get_value() == self.scroll_max or self.scroll_max == 0:
+            adj.set_value(adj.get_upper() - adj.get_page_size())
+        self.scroll_max = adj.get_upper() - adj.get_page_size()
 
 
 class LogWindow(Dialog):


Test patch: