Fragments with more than one "updates" profile may fail to load with a duplicate GUID warning #15674

Open
opened 2026-01-31 04:45:12 +00:00 by claunia · 0 comments
Owner

Originally created by @lhecker on GitHub (Oct 24, 2021).

Windows Terminal version (or Windows build number)

1.12.2931.0

Steps to reproduce

As reported at https://github.com/microsoft/terminal/pull/11325#issuecomment-950321418

  • Create this file at %LOCALAPPDATA%\Microsoft\Windows Terminal\Fragments\jan-config\wsl.json:
    {
        "$schema": "https://aka.ms/terminal-profiles-schema",
        "profiles": [
            {
                "updates": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}",
                //"name": "Debian",
                "colorScheme": "Nord",
                "hidden": false,
                "cursorShape": "underscore",
                "fontFace": "FantasqueSansMono Nerd Font",
                "fontSize": 16,
                "backgroundImage": "C:/Users/jantari/Openlogo-debianV2.svg - Kopie.png",
                "backgroundImageStretchMode": "none",
                "backgroundImageOpacity": 0.3,
                "backgroundImageAlignment": "bottomRight",
                "useAcrylic": false,
                "acrylicOpacity": 0.86,
                "source": "Windows.Terminal.Wsl"
            },
            {
                "updates": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                //"name": "Ubuntu 20.04",
                "colorScheme": "Nord",
                "hidden": false,
                "cursorShape": "underscore",
                "fontFace": "FantasqueSansMono Nerd Font",
                "fontSize": 16,
                "backgroundImage": "%LOCALAPPDATA%/WSL_ICONS/wt-wsl-ubuntu-logo.png",
                "backgroundImageStretchMode": "none",
                "backgroundImageOpacity": 0.3,
                "backgroundImageAlignment": "bottomRight",
                "useAcrylic": true,
                "acrylicOpacity": 0.86,
                "source": "Windows.Terminal.Wsl"
            }
        ]
    }
    

Expected Behavior

Settings load successfully.

Actual Behavior

image


Cause & Solution

The "updates" key is an alternative "guid" key for fragment profiles.
But SettingsLoader::_appendProfile stores and deduplicates profiles according to their "guid" only. We need to modify the function to optionally store profiles by their "updates" key instead, otherwise multiple fragment profile without "guid" might collide as they produce the same default GUID.

Originally created by @lhecker on GitHub (Oct 24, 2021). ### Windows Terminal version (or Windows build number) 1.12.2931.0 ### Steps to reproduce As reported at https://github.com/microsoft/terminal/pull/11325#issuecomment-950321418 * Create this file at `%LOCALAPPDATA%\Microsoft\Windows Terminal\Fragments\jan-config\wsl.json`: ```json { "$schema": "https://aka.ms/terminal-profiles-schema", "profiles": [ { "updates": "{58ad8b0c-3ef8-5f4d-bc6f-13e4c00f2530}", //"name": "Debian", "colorScheme": "Nord", "hidden": false, "cursorShape": "underscore", "fontFace": "FantasqueSansMono Nerd Font", "fontSize": 16, "backgroundImage": "C:/Users/jantari/Openlogo-debianV2.svg - Kopie.png", "backgroundImageStretchMode": "none", "backgroundImageOpacity": 0.3, "backgroundImageAlignment": "bottomRight", "useAcrylic": false, "acrylicOpacity": 0.86, "source": "Windows.Terminal.Wsl" }, { "updates": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", //"name": "Ubuntu 20.04", "colorScheme": "Nord", "hidden": false, "cursorShape": "underscore", "fontFace": "FantasqueSansMono Nerd Font", "fontSize": 16, "backgroundImage": "%LOCALAPPDATA%/WSL_ICONS/wt-wsl-ubuntu-logo.png", "backgroundImageStretchMode": "none", "backgroundImageOpacity": 0.3, "backgroundImageAlignment": "bottomRight", "useAcrylic": true, "acrylicOpacity": 0.86, "source": "Windows.Terminal.Wsl" } ] } ``` ### Expected Behavior Settings load successfully. ### Actual Behavior ![image](https://user-images.githubusercontent.com/2256941/138606235-698a0f09-1853-4216-9dc7-e909a004956d.png) --- # Cause & Solution The "updates" key is an alternative "guid" key for fragment profiles. But `SettingsLoader::_appendProfile` stores and deduplicates profiles according to their "guid" only. We need to modify the function to optionally store profiles by their "updates" key instead, otherwise multiple fragment profile without "guid" might collide as they produce the same default GUID.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15674