Skip to content

Instantly share code, notes, and snippets.

@scarlion1
Created November 16, 2025 18:40
Show Gist options
  • Select an option

  • Save scarlion1/0f79d1fee9635f432ad8eb853dd3c256 to your computer and use it in GitHub Desktop.

Select an option

Save scarlion1/0f79d1fee9635f432ad8eb853dd3c256 to your computer and use it in GitHub Desktop.
Abacus.AI DeepAgent SpaceFM Analysis

SpaceFM Comparison Report: gameblabla/spacefm vs Debian spacefm-gtk3 1.0.6-10

Report Date: November 16, 2025
Analysis Purpose: Identify key differences to resolve Wayland segfaults and navigation issues


Executive Summary

The Debian spacefm-gtk3 1.0.6-10 package and the gameblabla/spacefm fork are both based on SpaceFM version 1.0.6 (released March 4, 2018). However, they have diverged significantly in their patch sets:

  • Debian focuses on: Build system compatibility (GCC 10/14, C23, glibc 2.28), bug fixes, and packaging requirements
  • gameblabla focuses on: Runtime functionality (Wayland support, drag-and-drop fixes, activation fixes), plus some build compatibility

Critical Finding: Wayland Support

The gameblabla fork includes comprehensive Wayland support that is completely absent from the Debian package. This is the most likely cause of your segfaults and navigation issues under Wayland.


Detailed Comparison

1. Wayland Support (⚠️ CRITICAL DIFFERENCE)

Status: ✅ Present in gameblabla | ❌ MISSING in Debian

Commit: 40ba5e3 (August 6, 2022) by Dima Krasner
Merged via: Pull Request #2 from dimkr/wayland

This is the most critical difference and directly addresses your Wayland segfault issues.

What It Does:

The patch adds comprehensive Wayland detection and avoids X11-specific calls when running under Wayland. It checks if the display is using X11 or Wayland and adjusts behavior accordingly.

Files Modified:

  1. src/desktop/desktop.c

    • Checks GDK_IS_X11_DISPLAY() before proceeding with desktop icon functionality
    • Returns early if not running under X11
    gdpy = gdk_display_get_default();
    #if GTK_CHECK_VERSION (3, 0, 0)
    if( ! GDK_IS_X11_DISPLAY( gdpy ) )
        return;
    #endif
  2. src/desktop/working-area.c

    • Checks if display is X11 before getting X display
    • Prevents X11-specific workspace detection under Wayland
    #if GTK_CHECK_VERSION(3, 0, 0)
    if(!g_display || !GDK_IS_X11_DISPLAY(g_display))
    #else
    if(!g_display)
    #endif
        return FALSE;
  3. src/main-window.c

    • Checks if display is X11 before calling gdk_x11_window_lookup_for_display()
    • Prevents segfaults when trying to access X11 window properties under Wayland
    #if GTK_CHECK_VERSION (3, 0, 0)
    if ( display && GDK_IS_X11_DISPLAY (display ) )
    #else
    if ( display )
    #endif
        window = gdk_x11_window_lookup_for_display( display,
                                    gdk_x11_get_default_root_xwindow() );
  4. src/main.c

    • Uses WAYLAND_DISPLAY environment variable when running under Wayland
    • Creates proper socket names for IPC under Wayland
    #if GTK_CHECK_VERSION(3, 0, 0)
    const char* tmp = g_getenv( "WAYLAND_DISPLAY" );
    if ( tmp )
        dpy = g_strdup( tmp );
    else
    #endif
  5. src/vfs/vfs-execute.c

    • Multiple checks for Wayland vs X11 when executing applications
    • Handles WAYLAND_DISPLAY vs DISPLAY environment variables
    • Disables startup notification under Wayland (X11-specific feature)
    #if GTK_CHECK_VERSION (3, 0, 0)
    if ( ! GDK_IS_X11_SCREEN ( screen ) )
        return ws_num;
    #endif

Impact Assessment:

HIGH - This is almost certainly the root cause of your Wayland segfaults. Without these checks, SpaceFM attempts to call X11-specific functions like:

  • gdk_x11_window_lookup_for_display()
  • gdk_x11_get_default_root_xwindow()
  • X11 workspace detection
  • X11 startup notification

These functions fail or return NULL under Wayland, leading to segmentation faults.


2. GTK3 Pointer Type Fixes

Status: ✅ Present in BOTH gameblabla and Debian

Commit (in upstream 1.0.6): 3089c4d (January 30, 2018) by IgnorantGuru/Teklad
Issue: #649, #670

Both versions include this fix since it was part of the 1.0.6 release.

What It Does:

Fixes segfaults when dragging files to directory tree under GTK 3.22+. The _GdkDragContext structure changed between GTK3 versions (fields were added/removed), causing crashes.

File Modified: src/ptk/ptk-dir-tree-view.c

The fix adds version-specific fields to the _GdkDragContext structure:

#if GTK_CHECK_VERSION (3, 22, 0)
  GdkDisplay *display;
#endif
// ... other fields ...
#if GTK_CHECK_VERSION (3, 22, 0)
  guint drop_done : 1;
#endif

This is likely the "pointer type patching" you mentioned doing to make gameblabla work.


3. Drag-and-Drop Segfault Fixes

Status: ✅ Present in BOTH (part of 1.0.6 release)

These fixes were included in the SpaceFM 1.0.6 release that both versions are based on:

  1. Icon view to tree drag fix (7967bd4)

    • File: src/exo/exo-icon-view.c
    • Checks GTK_IS_TREE_DRAG_SOURCE() before calling drag functions
    • Prevents segfaults when dragging from icon view to tree sidebar
  2. Bookmark reorder fix (3852950)

    • File: src/ptk/ptk-location-view.c
    • Moves list update from row-deleted to drag-end event
    • Prevents crashes during bookmark reordering
  3. Desktop drag fix (e74c971)

    • File: src/desktop/desktop-window.c
    • Adds null pointer check: l->next ? l->next->data : NULL
    • Prevents segfaults when dragging files/folders on desktop
  4. Dir tree iterator fix (c0fd7fc)

    • File: src/ptk/ptk-dir-tree.c
    • Adds null pointer check: !( node && node->next )
    • Prevents segfaults when navigating directory tree

4. Build System Compatibility

GCC 10 Compatibility (fno-common)

Status: ✅ Present in BOTH

Both versions fix the GCC 10 -fno-common default change:

gameblabla: Commits 581d540 + 1693380 (June 2020)

  • Adds variable definitions in src/settings.c
  • Adds extern declarations in src/settings.h

Debian: Patch fix-gcc10-fno-common.patch

  • Same approach, slightly different implementation
  • Based on Fedora patch by Mamoru TASAKA

Both properly handle the multiple definition errors introduced by GCC 10's stricter compilation defaults.

GCC 14 Compatibility

Status: ❌ Missing in gameblabla | ✅ Present in Debian

Debian patch: fix-ftbfs-gcc14.patch

Debian includes additional fixes for GCC 14 compatibility that gameblabla doesn't have.

C23 Compatibility

Status: ❌ Missing in gameblabla | ✅ Present in Debian

Debian patches:

  • fix-c23-function-proto.patch - Fixes function declarations without parameter information
  • fix-c23-bool-keyword.patch - Handles C23 bool keyword changes

These are forward-compatibility patches that gameblabla doesn't include.

glibc 2.28 Compatibility

Status: ❌ Missing in gameblabla | ✅ Present in Debian

Debian patch: 0001-glibc-2.28-compatibility.patch


5. Functional Improvements in gameblabla

5.1 Activation Fix

Status: ❌ Missing in Debian | ✅ Present in gameblabla

Commit: f74ee52 (April 26, 2019) by Joseph Lansdowne
Merged via: Pull Request #5 from ikn/master

File: src/exo/exo-icon-view.c

What It Does: Fixes an issue where pressing Enter in compact/icon view modes doesn't open selected files unless there's a focused file.

Impact: QoL improvement for keyboard navigation

5.2 Btrfs Clone Support

Status: ❌ Missing in Debian | ✅ Present in gameblabla

Commits: Multiple commits in PR #4 from szekelyszilv/btrfs-clone (July 2023)

What It Does: Adds support for Btrfs clone ioctl, enabling efficient copy-on-write file copying on Btrfs filesystems.

Impact: Performance improvement for users with Btrfs filesystems

5.3 Dash Shell Compatibility

Status: ❌ Missing in Debian | ✅ Present in gameblabla

Commit: 3698cc7 (May 7, 2023) by orbea
Merged via: Pull Request #1 from orbea/dash

File: configure.ac

What It Does: Fixes bad substitutions in configure script when using dash as /bin/sh instead of bash.

Impact: Build system compatibility improvement

5.4 Enhanced MTP Support

Status: ❌ Missing in Debian | ✅ Present in gameblabla

Commits: a5cfdac, ac481b8 (November 2019) by Vladimir-csp
Merged via: Pull Request #3 from Vladimir-csp/patch-2

What It Does: Adds support for aft-mtp-mount (Android File Transfer) and improves FUSE handling.

Impact: Better Android device connectivity


6. Debian-Specific Features

6.1 Optional Close Last Tab

Status: ❌ Missing in gameblabla | ✅ Present in Debian

Debian patch: add_optional_close_last_tab.patch

Adds an option to prevent closing the last tab, improving usability.

6.2 Thumbnail Fix

Status: ❌ Missing in gameblabla | ✅ Present in Debian

Debian patch: fix_thumbnails.patch

Fixes thumbnail generation issues.

6.3 Desktop Files Update

Status: ❌ Missing in gameblabla | ✅ Present in Debian

Debian patch: update_desktop_files.patch

Updates .desktop files for better desktop environment integration.

6.4 Spelling Corrections

Status: ❌ Missing in gameblabla | ✅ Present in Debian

Debian patch: fix-spelling-error.patch

Fixes spelling errors throughout the codebase.


Architecture & Build System Comparison

gameblabla Fork

  • Based on: SpaceFM 1.0.6 (March 2018)
  • Focus: Runtime fixes and Wayland support
  • Build compatibility: GCC 10
  • Maintained: Yes (last update July 2023)
  • Community: Active via pull requests

Debian Package

  • Based on: SpaceFM 1.0.6 (March 2018)
  • Focus: Build system compatibility and Debian integration
  • Build compatibility: GCC 10, GCC 14, C23, glibc 2.28
  • Maintained: Yes (last update October 2024)
  • Integration: Debian-specific enhancements

What's Causing Your Wayland Issues?

Based on this analysis, your Wayland segfaults are almost certainly caused by the missing Wayland support patches in the Debian package.

The Problem:

Without the Wayland detection patches, SpaceFM unconditionally calls X11-specific functions like:

  • gdk_x11_window_lookup_for_display() - crashes when display is not X11
  • gdk_x11_get_default_root_xwindow() - returns invalid data under Wayland
  • X11 workspace detection functions - fail under Wayland
  • X11-specific IPC socket creation - causes communication issues

Why gameblabla Works:

The gameblabla fork includes commit 40ba5e3 which adds comprehensive checks:

if ( display && GDK_IS_X11_DISPLAY (display ) )
    // Only call X11 functions if we're actually using X11

These checks prevent X11 function calls under Wayland, avoiding the segfaults.

The "Pointer Type Patching" You Mentioned:

You mentioned doing "some pointer type patching" to make gameblabla work. This was likely one or more of:

  1. The _GdkDragContext structure fix (already in both versions)
  2. Null pointer checks in drag-and-drop code (already in both versions)
  3. Additional runtime fixes you discovered

Recommendations

Option 1: Minimal Patch (Recommended for Quick Fix)

Apply only the Wayland support patch to Debian package

Pros:

  • Directly addresses the root cause of segfaults
  • Minimal change scope reduces risk
  • Well-tested patch (in use since August 2022)
  • Clean, focused fix

Cons:

  • Misses other functional improvements from gameblabla
  • May need additional patches later

Implementation: Extract commit 40ba5e3 from gameblabla fork as a patch and add it to Debian's patch series.

Files to patch:

  1. src/desktop/desktop.c
  2. src/desktop/working-area.c
  3. src/main-window.c
  4. src/main.c
  5. src/vfs/vfs-execute.c

Debian patch file: add-wayland-support.patch

Option 2: Comprehensive Update (Recommended for Long-term)

Cherry-pick multiple functional improvements from gameblabla

Pros:

  • Fixes Wayland issues
  • Adds useful features (Btrfs clone, better MTP support, activation fix)
  • More future-proof
  • Better overall user experience

Cons:

  • Larger change scope
  • More testing required
  • Potential for unexpected interactions

Implementation: Add the following patches to Debian in order:

  1. add-wayland-support.patch (commit 40ba5e3) - CRITICAL
  2. fix-activation-no-focus.patch (commit f74ee52) - Nice to have
  3. add-btrfs-clone-support.patch (commits in PR #4) - Optional
  4. fix-dash-configure.patch (commit 3698cc7) - Optional
  5. add-enhanced-mtp-support.patch (commits a5cfdac, ac481b8) - Optional

Option 3: Switch to gameblabla Fork

Replace Debian's base with gameblabla fork

Pros:

  • Gets all functional improvements
  • Well-maintained fork
  • Proven to work under Wayland

Cons:

  • Loses Debian-specific patches (GCC 14, C23, thumbnails, etc.)
  • Requires re-applying Debian patches on top
  • More disruptive change

Implementation:

  1. Use gameblabla fork as base
  2. Re-apply Debian-specific patches:
    • fix-ftbfs-gcc14.patch
    • fix-c23-function-proto.patch
    • fix-c23-bool-keyword.patch
    • fix_thumbnails.patch
    • add_optional_close_last_tab.patch
    • update_desktop_files.patch

Testing Recommendations

Regardless of which option you choose, test the following scenarios under Wayland:

Critical Tests (Must Pass):

  1. Launch SpaceFM - Should not segfault on startup
  2. Navigate directories - Should work without crashes
  3. Drag and drop files - Between panes, to bookmarks, to desktop
  4. File operations - Copy, move, delete, rename
  5. Bookmark management - Add, remove, reorder bookmarks

Additional Tests (Should Work):

  1. Icon/Compact view - Switch between views, activate files with Enter
  2. Desktop integration - If using desktop mode
  3. IPC - Multiple instances communication
  4. External programs - Launching applications from SpaceFM
  5. MTP devices - If you use Android devices

Regression Tests (Must Still Work):

  1. X11 session - Verify nothing broke for X11 users
  2. Build system - Compile with GCC 10, GCC 14
  3. Standard operations - Everything that worked before should still work

Technical Implementation Notes

For Debian Package Maintainers:

  1. Patch extraction from gameblabla:

    cd gameblabla_spacefm
    git format-patch -1 40ba5e3 --stdout > add-wayland-support.patch
  2. Add to Debian patch series:

    cd debian/patches
    # Edit series file to add:
    add-wayland-support.patch
  3. Test build:

    dpkg-buildpackage -us -uc
  4. Update changelog:

    spacefm (1.0.6-11) unstable; urgency=medium
    
      * Add Wayland support patch from gameblabla fork
      * Fixes segfaults when running under Wayland (Closes: #XXXXXX)
    
     -- Maintainer <email>  Date
    

For Users Wanting Immediate Fix:

  1. Clone gameblabla fork:

    git clone https://github.com/gameblabla/spacefm.git
    cd spacefm
  2. Build and install:

    ./autogen.sh
    ./configure --prefix=/usr/local
    make
    sudo make install
  3. Or use Debian build system:

    # Download Debian packaging
    apt source spacefm-gtk3
    
    # Replace source with gameblabla
    rm -rf spacefm-1.0.6/src
    cp -r /path/to/gameblabla_spacefm/* spacefm-1.0.6/
    
    # Build package
    cd spacefm-1.0.6
    dpkg-buildpackage -us -uc

Patch Priority Matrix

Patch Priority Impact Risk Recommendation
Wayland Support 🔴 CRITICAL Fixes segfaults Low MUST APPLY
Activation Fix 🟡 Medium QoL improvement Low Apply if easy
Btrfs Clone 🟢 Low Performance Medium Optional
Dash Configure 🟢 Low Build compatibility Low Optional
Enhanced MTP 🟡 Medium Android support Medium Optional
GCC 14 compat (Debian) 🟡 Medium Build system Low Keep Debian's
C23 compat (Debian) 🟢 Low Future-proofing Low Keep Debian's
Thumbnails (Debian) 🟡 Medium Functionality Low Keep Debian's

Conclusion

The gameblabla fork includes critical Wayland support that is completely missing from the Debian package. This is the root cause of your segfaults under Wayland.

Recommended Action:

  1. Immediate term: Apply the Wayland support patch (40ba5e3) to your Debian package
  2. Short term: Test thoroughly and report findings
  3. Medium term: Consider cherry-picking additional useful features from gameblabla
  4. Long term: Maintain a hybrid approach - Debian's base with gameblabla's functional improvements

The Wayland patch is well-isolated, well-tested, and directly addresses your issue. It should be safe to apply with minimal risk of breaking existing functionality.


Additional Resources

Repository Links:

Key Commits:

Related Issues:


Appendix: Patch File Locations

Analysis performed on:

  • gameblabla fork location: ~/spacefm_analysis/gameblabla_spacefm/
  • Debian source location: ~/spacefm_analysis/spacefm-1.0.6/
  • This report: ~/spacefm_comparison_report.md

To extract the Wayland patch:

cd ~/spacefm_analysis/gameb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment