https://bugs.kde.org/show_bug.cgi?id=525267

            Bug ID: 525267
           Summary: KConfig 6.29 regression: system config directory
                    misclassified when path begins with XDG_CONFIG_HOME
    Classification: Frameworks and Libraries
           Product: frameworks-kconfig
      Version First 6.29.0
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

I can reproduce a configuration-precedence regression in KConfig 6.29.0 where
the result depends on whether an XDG system configuration directory's pathname
happens to begin with the XDG_CONFIG_HOME string.

Environment:

Arch Linux
kconfig 6.29.0-1
qt6-base 6.11.2-3
x86_64

The test uses only temporary directories under /tmp and does not modify my
normal KDE configuration.

Test setup:

BASE=/tmp/arch-reglab-kconfig

rm -rf "$BASE"

mkdir -p \
    "$BASE/cfg" \
    "$BASE/cfg-system" \
    "$BASE/globalcfg" \
    "$BASE/syscfg"

cat > "$BASE/cfg-system/kdeglobals" <<'EOF'
[General]
Probe=GLOBAL_SYSTEM
EOF

cp "$BASE/cfg-system/kdeglobals" \
   "$BASE/globalcfg/kdeglobals"

cat > "$BASE/syscfg/reglabrc" <<'EOF'
[General]
Probe=APP_SYSTEM
EOF

The directories are distinct:

/tmp/arch-reglab-kconfig/cfg
/tmp/arch-reglab-kconfig/cfg-system
/tmp/arch-reglab-kconfig/globalcfg
/tmp/arch-reglab-kconfig/syscfg


Affected case on KConfig 6.29.0:

env \
    XDG_CONFIG_HOME="$BASE/cfg" \
    XDG_CONFIG_DIRS="$BASE/cfg-system:$BASE/syscfg" \
    kreadconfig6 \
        --file reglabrc \
        --include-globals \
        --group General \
        --key Probe

Result:

GLOBAL_SYSTEM


Control:

The configuration is identical, except the first XDG_CONFIG_DIRS
directory is named "globalcfg" instead of "cfg-system":

env \
    XDG_CONFIG_HOME="$BASE/cfg" \
    XDG_CONFIG_DIRS="$BASE/globalcfg:$BASE/syscfg" \
    kreadconfig6 \
        --file reglabrc \
        --include-globals \
        --group General \
        --key Probe

Result:

APP_SYSTEM


I repeated both cases five times on KConfig 6.29.0-1:

run 1 prefix:  GLOBAL_SYSTEM
run 1 control: APP_SYSTEM
run 2 prefix:  GLOBAL_SYSTEM
run 2 control: APP_SYSTEM
run 3 prefix:  GLOBAL_SYSTEM
run 3 control: APP_SYSTEM
run 4 prefix:  GLOBAL_SYSTEM
run 4 control: APP_SYSTEM
run 5 prefix:  GLOBAL_SYSTEM
run 5 control: APP_SYSTEM


Regression control:

I also tested the same files and environment with the Arch
kconfig 6.28.0-1 package extracted under /tmp, without installing it.

I verified that its kreadconfig6 was using the extracted 6.28
libKF6ConfigCore.so.6 via LD_LIBRARY_PATH.

KConfig 6.28.0-1 produced:

run 1 prefix:  APP_SYSTEM
run 1 control: APP_SYSTEM
run 2 prefix:  APP_SYSTEM
run 2 control: APP_SYSTEM
run 3 prefix:  APP_SYSTEM
run 3 control: APP_SYSTEM
run 4 prefix:  APP_SYSTEM
run 4 control: APP_SYSTEM
run 5 prefix:  APP_SYSTEM
run 5 control: APP_SYSTEM


Expected behavior:

Both system-directory names should have the same configuration
precedence. Renaming an XDG_CONFIG_DIRS entry from "globalcfg" to
"cfg-system" should not change whether it is treated as system or
user-writable configuration.

Actual behavior:

On KConfig 6.29.0, when XDG_CONFIG_HOME ends in:

    /cfg

the distinct system directory:

    /cfg-system

causes GLOBAL_SYSTEM to override APP_SYSTEM.

Renaming only that directory to:

    /globalcfg

causes APP_SYSTEM to win instead.

This behavior is not present with KConfig 6.28.0 in the same test.


Suspected regression:

This may be related to commit:

93208937f07b2612aa012253aaab4241dd120afd

"Read config files in system locations before user-writable config files"

I noticed that the new path classification code uses a
startsWith(writableLocation) check. I am not claiming that this is
definitively the root cause, but the observed behavior and the 6.28 ->
6.29 regression are consistent with a textual path-prefix
misclassification.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to