Skip to content

Fix purge_nonexistent_images.bat to correctly handle images which have cyrillic (or other alphabets) in the path#20916

Open
mishavoloshchuk wants to merge 1 commit intodarktable-org:masterfrom
mishavoloshchuk:fix/purge_nonexistent_images_removing_images
Open

Fix purge_nonexistent_images.bat to correctly handle images which have cyrillic (or other alphabets) in the path#20916
mishavoloshchuk wants to merge 1 commit intodarktable-org:masterfrom
mishavoloshchuk:fix/purge_nonexistent_images_removing_images

Conversation

@mishavoloshchuk
Copy link
Copy Markdown

I've made a fix for the purge_nonexistent_images.bat removes existing files / #20915 issue I recently added. I used Claude, because I'm not very proficient in .bat scripts. I've checked it and works completely fine and now it only removes the images that are really missing.

Screenshot 2026-05-02 172152 Screenshot 2026-05-02 172311 Screenshot 2026-05-02 172352

Here is some description from Claude itself:

The script uses for /f ... in ('sqlite3.exe ...') to iterate over query results. On Windows, this form of command substitution captures the child process output through the legacy OEM code page (e.g. CP866 for Russian locales), regardless of the active console code page set by chcp. SQLite3 outputs UTF-8 text, but for /f re-encodes it through the OEM code page, mangling any characters outside the ASCII range. The resulting garbled path string never matches a real filesystem entry, so if not exist always evaluates to true — and the image is treated as missing and scheduled for deletion, even though the underlying file is perfectly intact.

Copy link
Copy Markdown
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok by me but I'd like the review of a Windows expert;

@wpferguson : Can you review please? TIA

@TurboGit TurboGit added this to the 5.6 milestone May 3, 2026
@TurboGit TurboGit added the scope: windows support windows related issues and PR label May 3, 2026
@wpferguson
Copy link
Copy Markdown
Member

@victoryforce are you able to test this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: windows support windows related issues and PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants