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

            Bug ID: 521756
           Summary: 03-build-digikam.sh script bug: cleanup logic
                    inadvertently deletes all VCPKG dependencies
    Classification: Applications
           Product: digikam
      Version First unspecified
       Reported In:
          Platform: Microsoft Windows
                OS: Microsoft Windows
            Status: REPORTED
          Severity: major
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

=== DESCRIPTION ===

There is a critical path-matching bug in the cleanup logic of the
03-build-digikam.sh script. The script currently attempts to clean up previous
digiKam and showfoto builds within the $VCPKG_INSTALL_PREFIX directory using
the following line:

----------------------------------------------------------------------
FILES=$(find "$VCPKG_INSTALL_PREFIX" -name \* | grep -E '(digikam|showfoto)')
|| true
----------------------------------------------------------------------

The grep command evaluates the ENTIRE ABSOLUTE PATH string returned by find
instead of just checking the file/folder basename. 

If a user configures their environment with a path that contains the substring
"digikam" anywhere in the parent directory structure — for example,
$VCPKG_INSTALL_PREFIX = F:/digikamBuilds/dk/x64-windows — then EVERY SINGLE
FILE PATH matches the grep condition.

As a result, the subsequent loop executes 'rm -fr' on the entire contents of
the directory, wiping out all 199 pre-built VCPKG support packages (such as
Qt6, Boost, FFmpeg, etc.) along with the intended digiKam files. Every
subsequent run of the script forces an unnecessary, time-consuming 6-10 hour
full VCPKG rebuild.


=== STEPS TO REPRODUCE ===

1. Run 01-build-vcpkg.sh to install all dependencies under a path containing
the word "digikam" (e.g., F:/digikamBuilds/...).
2. Run 03-build-digikam.sh.
3. Observe the console logs or check the install prefix folder after execution
— all core VCPKG libraries (.lib, .dll, headers) are missing.


=== ACTUAL RESULTS ===

The script erroneously matches the parent directory path and deletes the entire
contents of $VCPKG_INSTALL_PREFIX.


=== EXPECTED RESULTS ===

The script should only match and delete actual digiKam/showfoto binaries and
folders generated from the previous installation, leaving third-party VCPKG
packages untouched.


=== SUGGESTED FIX ===

Modify the find command in 03-build-digikam.sh to target only the basename
using native find expressions, and enforce a minimum depth check to protect the
root prefix directory.

Replace the old line:
----------------------------------------------------------------------
FILES=$(find "$VCPKG_INSTALL_PREFIX" -name \* | grep -E '(digikam|showfoto)')
|| true
----------------------------------------------------------------------

With a safe, native find structure:
----------------------------------------------------------------------
FILES=$(find "$VCPKG_INSTALL_PREFIX" -mindepth 1 \( -name "*digikam*" -o -name
"*showfoto*" \)) || true
----------------------------------------------------------------------

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

Reply via email to