Skip to content

Fix: GUI finds 0 broken symlinks when CLI finds them correctly#1851

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-gui-broken-symlinks
Draft

Fix: GUI finds 0 broken symlinks when CLI finds them correctly#1851
Copilot wants to merge 3 commits intomasterfrom
copilot/fix-gui-broken-symlinks

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 24, 2026

The GUI (krokiet) fails to find broken symlinks that the CLI detects correctly, returning 0 results when scanning directories like /home/user/.config/.

Root Causes & Fixes

1. DEFAULT_EXCLUDED_ITEMS contained an overly broad pattern

/home/*/.* was intended to exclude top-level hidden items in home directories, but the regex_check implementation allows * to match path separators. This caused it to match any file inside any hidden directory — e.g., /home/juan/.config/alacritty matched because /. appears in /.config. New users with default GUI settings scanning inside any ~/.config/ or similar hidden directory got 0 results.

Fix: Removed /home/*/.* from DEFAULT_EXCLUDED_ITEMS. The more targeted /home/*/.cache/* and /home/*/.var/app/ entries remain.

2. Relative symlink targets resolved against process CWD instead of symlink's parent

In check_invalid_symlinks, when following a symlink chain to detect infinite recursion, relative targets returned by read_link() were passed directly to the next read_link() call. The OS resolves these relative to the process CWD, not the symlink's parent directory — wrong for any symlink not in the CWD.

Fix: Capture parent_dir before each read_link() and join relative results with it:

let parent_dir = current_path.parent().map(|p| p.to_path_buf());
current_path = match current_path.read_link() {
    Ok(t) => {
        if t.is_relative() {
            if let Some(parent) = parent_dir { parent.join(t) } else { t }
        } else {
            t
        }
    }
    Err(_) => return None,
};

3. Added regression test

Added test_find_invalid_symlinks_relative_path to verify broken symlinks with relative targets (e.g., ../nonexistent/path) are correctly detected.

Original prompt

This section details on the original issue you should resolve

<issue_title>GUI fails to find broken symlinks that CLI detects correctly</issue_title>
<issue_description>## Bug Description

The GUI (krokiet) fails to find broken symbolic links that the CLI (czkawka_cli) correctly detects.

Steps to Reproduce

  1. Run CLI search for broken symlinks:
   czkawka_cli symlinks -d /home/juan/.config

Result: Found 9 invalid symlinks ✓

  1. Open krokiet GUI
  2. Select "Symlinks" tab
  3. Add /home/juan/.config as search directory
  4. Click "Search"
    Result: Found 0 invalid symlinks ✗

Expected Behavior

GUI should find the same 9 broken symlinks that CLI detects.

Actual Behavior

GUI finds 0 broken symlinks.

CLI Output (Working)

Found 9 invalid symlinks.
"/home/juan/.config/alacritty"          "../.mydotfiles/com.ml4w.hyprlandstarter/.config/alacritty"             Non Existent File
"/home/juan/.config/dunst"              "../.mydotfiles/com.ml4w.hyprlandstarter/.config/dunst"         Non Existent File
"/home/juan/.config/hypr"               "../.mydotfiles/com.ml4w.hyprlandstarter/.config/hypr"          Non Existent File
"/home/juan/.config/kitty"              "../.mydotfiles/com.ml4w.hyprlandstarter/.config/kitty"         Non Existent File
"/home/juan/.config/ml4w"               "../.mydotfiles/com.ml4w.hyprlandstarter/.config/ml4w"          Non Existent File
"/home/juan/.config/rofi"               "../.mydotfiles/com.ml4w.hyprlandstarter/.config/rofi"          Non Existent File
"/home/juan/.config/waybar"             "../.mydotfiles/com.ml4w.hyprlandstarter/.config/waybar"                Non Existent File
"/home/juan/.config/wlogout"            "../.mydotfiles/com.ml4w.hyprlandstarter/.config/wlogout"               Non Existent File
"/home/juan/.config/mozilla/firefox/ezioo5ep.default-release/lock"              "127.0.1.1:+10416"              Non Existent File

Environment

  • OS: Arch Linux
  • Desktop: KDE Plasma (Wayland)
  • krokiet version: 11.0.1 (9e40abe U 2026-02-20)
  • czkawka_cli version: 11.0.1

GUI Configuration

The GUI was using the default preset (Preset 0) with the same search path as CLI.

config_general.json:

{
  "default_preset": 0,
  "preset_names": [
    "Preset 1",
    "Preset 2",
    "Preset 3",
    "Preset 4",
    "Preset 5",
    "Preset 6",
    "Preset 7",
    "Preset 8",
    "Preset 9",
    "Preset 10",
    "CLI Folders"
  ],
  "window_width": 2552,
  "window_height": 925,
  "language": "es-ES",
  "dark_theme": true,
  "show_only_icons": false,
  "settings_load_windows_size_at_startup": true,
  "settings_load_tabs_sizes_at_startup": true,
  "settings_limit_lines_of_messages": true,
  "manual_application_scale": 1.0,
  "use_manual_application_scale": false,
  "play_audio_on_scan_completion": true
}

config_preset_0.json (relevant settings)

{
  "included_paths": [
    "/home/juan/.config"
  ],
  "excluded_paths": [
    "/dev",
    "/proc",
    "/snap",
    "/sys"
  ],
  "excluded_items": "*/.git/*,*/node_modules/*,*/lost+found/*,*/Trash/*,*/.Trash-*/*",
  "recursive_search": true,
  "use_cache": true,
  "ignore_other_file_systems": false
}

Additional Notes

  • Both CLI and GUI are using the exact same search path: /home/juan/.config
  • Recursive search is enabled in the preset
  • The invalid_symlink column configuration exists in the preset, suggesting the feature should work
  • GUI language is set to Spanish (es-ES), but this shouldn't affect symlink detection
  • All symlinks point to relative paths (../...). Could this be related to path resolution differences between CLI and GUI?</issue_description>

Comments on the Issue (you are @copilot in this section)


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI and others added 2 commits March 24, 2026 09:53
… relative symlink resolution

Co-authored-by: qarmin <41945903+qarmin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/qarmin/czkawka/sessions/27405ff3-5207-413d-8b67-5df659114e9a
Copilot AI changed the title [WIP] Fix GUI not detecting broken symlinks found by CLI Fix: GUI finds 0 broken symlinks when CLI finds them correctly Mar 24, 2026
Copilot AI requested a review from qarmin March 24, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GUI fails to find broken symlinks that CLI detects correctly

2 participants