Skip to content

simple-dnscrypt: Fix extraction & persistence, refactor uninstaller logic#17073

Open
SorYoshino wants to merge 1 commit intoScoopInstaller:masterfrom
SorYoshino:simple-dnscrypt
Open

simple-dnscrypt: Fix extraction & persistence, refactor uninstaller logic#17073
SorYoshino wants to merge 1 commit intoScoopInstaller:masterfrom
SorYoshino:simple-dnscrypt

Conversation

@SorYoshino
Copy link
Contributor

@SorYoshino SorYoshino commented Jan 22, 2026

Summary

Refactors simple-dnscrypt to fix extraction issues, improve persistence reliability, and align the uninstaller with Scoop's lifecycle.

Related issues or pull requests

Changes

  • Metadata Cleanup: Update description, homepage, and structured the license field.
  • Fix Extraction: Add logic to move files out of the APPDIR subfolder to the root directory during installation.
  • Improve Persistence:
    • Simplify the persist field to the main configuration.
    • Add manual backup for log and text files in pre_uninstall to ensure they are preserved correctly in the persist_dir.
  • Relocate Termination Logic: Move Stop-Process and Stop-Service to the uninstaller block to prevent silent data loss and respect Scoop's process check.
  • Enhance Service Safety: Add path-based regex validation to ensure the uninstaller only targets the service instance associated with this Scoop installation.

Notes

  • Lifecycle Compliance: By moving termination logic from pre_uninstall to uninstaller, Scoop can now properly notify users if the app is running before attempting to kill it.
  • Service Security: The use of $service.BinaryPathName -notmatch $path_regex prevents the script from accidentally stopping or deleting non-Scoop versions of dnscrypt-proxy.
  • If empty files such as query.log are created in dnscrypt-proxy, the application will fail to start properly.
  • Running Uninstall.exe backs up dnscrypt-proxy.toml to $env:TEMP and stops the dnscrypt-proxy service. This behavior overlaps with the logic implemented in this PR, so Start-Process -Wait "$dir\Uninstall.exe" | Out-Null has been removed.

Testing

The test results are as follows:
# `use_lessmsi` is true, and services are not installed.
┏[ ~]
└─> scoop config | rg lessmsi
use_lessmsi                     : True

┏[ ~]
└─> scoop install 'D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras\bucket\simple-dnscrypt.json'
Installing 'simple-dnscrypt' (0.7.1) [64bit] from 'D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras\bucket\simple-dnscrypt.json'
Loading SimpleDNSCrypt64.msi from cache.
Checking hash of SimpleDNSCrypt64.msi... OK.
Extracting SimpleDNSCrypt64.msi... Done.
Running pre_install script... Done.
Linking D:\Software\Scoop\Local\apps\simple-dnscrypt\current => D:\Software\Scoop\Local\apps\simple-dnscrypt\0.7.1
Creating shortcut for Simple DnsCrypt (SimpleDnsCrypt.exe)
Persisting dnscrypt-proxy\dnscrypt-proxy.toml
'simple-dnscrypt' (0.7.1) was installed successfully!
'simple-dnscrypt' suggests installing 'extras/vcredist2022'.

┏[ ~]
└─> scoop update simple-dnscrypt -f
simple-dnscrypt: 0.7.1 -> 0.7.1
Updating one outdated app:
Updating 'simple-dnscrypt' (0.7.1 -> 0.7.1)
Downloading new version
Loading SimpleDNSCrypt64.msi from cache.
Checking hash of SimpleDNSCrypt64.msi... OK.
Running pre_uninstall script... Done.
Uninstalling 'simple-dnscrypt' (0.7.1)
Running uninstaller script... Done.
Unlinking D:\Software\Scoop\Local\apps\simple-dnscrypt\current
Installing 'simple-dnscrypt' (0.7.1) [64bit] from 'D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras\bucket\simple-dnscrypt.json'
Loading SimpleDNSCrypt64.msi from cache.
Extracting SimpleDNSCrypt64.msi... Done.
Running pre_install script... Done.
Linking D:\Software\Scoop\Local\apps\simple-dnscrypt\current => D:\Software\Scoop\Local\apps\simple-dnscrypt\0.7.1
Creating shortcut for Simple DnsCrypt (SimpleDnsCrypt.exe)
Persisting dnscrypt-proxy\dnscrypt-proxy.toml
'simple-dnscrypt' (0.7.1) was installed successfully!

┏[ ~]
└─> scoop uninstall simple-dnscrypt -p
Uninstalling 'simple-dnscrypt' (0.7.1).
Running pre_uninstall script... Done.
Running uninstaller script... Done.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\Simple DnsCrypt.lnk
Unlinking D:\Software\Scoop\Local\apps\simple-dnscrypt\current
Removing older version (_0.7.1.old).
Removing persisted data.
'simple-dnscrypt' was uninstalled.


# `use_lessmsi` is false, and services are installed.
┏[ ~]
└─> scoop config | rg lessmsi
use_lessmsi                     : False

┏[ ~]
└─> scoop install 'D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras\bucket\simple-dnscrypt.json'
Installing 'simple-dnscrypt' (0.7.1) [64bit] from 'D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras\bucket\simple-dnscrypt.json'
Loading SimpleDNSCrypt64.msi from cache.
Checking hash of SimpleDNSCrypt64.msi... OK.
Extracting SimpleDNSCrypt64.msi... Done.
Running pre_install script... Done.
Linking D:\Software\Scoop\Local\apps\simple-dnscrypt\current => D:\Software\Scoop\Local\apps\simple-dnscrypt\0.7.1
Creating shortcut for Simple DnsCrypt (SimpleDnsCrypt.exe)
Persisting dnscrypt-proxy\dnscrypt-proxy.toml
'simple-dnscrypt' (0.7.1) was installed successfully!
'simple-dnscrypt' suggests installing 'extras/vcredist2022'.

┏[ ~]
└─> scoop update simple-dnscrypt -f
simple-dnscrypt: 0.7.1 -> 0.7.1
Updating one outdated app:
Updating 'simple-dnscrypt' (0.7.1 -> 0.7.1)
Downloading new version
Loading SimpleDNSCrypt64.msi from cache.
Checking hash of SimpleDNSCrypt64.msi... OK.
Running pre_uninstall script... Done.
Uninstalling 'simple-dnscrypt' (0.7.1)
Running uninstaller script...
[ERROR]  simple-dnscrypt requires admin rights to update.

┏[ ~]
└─[ Error, check your command]> sudo scoop update simple-dnscrypt -f
simple-dnscrypt: 0.7.1 -> 0.7.1
Updating one outdated app:
Updating 'simple-dnscrypt' (0.7.1 -> 0.7.1)
WARN  The following instances of "simple-dnscrypt" are still running. Scoop is configured to ignore this condition.

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
     21    22.19      21.26       0.11   17532   0 dnscrypt-proxy

Downloading new version
Loading SimpleDNSCrypt64.msi from cache.
Checking hash of SimpleDNSCrypt64.msi... OK.
Running pre_uninstall script... Done.
Uninstalling 'simple-dnscrypt' (0.7.1)
Running uninstaller script... Done.
Unlinking D:\Software\Scoop\Local\apps\simple-dnscrypt\current
Installing 'simple-dnscrypt' (0.7.1) [64bit] from 'D:\Temporary\Software\Microsoft\Windows Sandbox\Repositories\Scoop\Buckets\Extras\bucket\simple-dnscrypt.json'
Loading SimpleDNSCrypt64.msi from cache.
Extracting SimpleDNSCrypt64.msi... Done.
Running pre_install script... Done.
Linking D:\Software\Scoop\Local\apps\simple-dnscrypt\current => D:\Software\Scoop\Local\apps\simple-dnscrypt\0.7.1
Creating shortcut for Simple DnsCrypt (SimpleDnsCrypt.exe)
Persisting dnscrypt-proxy\dnscrypt-proxy.toml
'simple-dnscrypt' (0.7.1) was installed successfully!

┏[ ~]
└─> sudo scoop uninstall simple-dnscrypt -p
Uninstalling 'simple-dnscrypt' (0.7.1).
Running pre_uninstall script... Done.
WARN  The following instances of "simple-dnscrypt" are still running. Scoop is configured to ignore this condition.

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
     20    22.48      21.05       0.16    2784   0 dnscrypt-proxy
     64   135.23     189.70       4.75   13852   1 SimpleDnsCrypt

Running uninstaller script... Done.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\Simple DnsCrypt.lnk
Unlinking D:\Software\Scoop\Local\apps\simple-dnscrypt\current
Removing older version (_0.7.1.old).
Removing persisted data.
'simple-dnscrypt' was uninstalled.
  • Use conventional PR title: <manifest-name[@version]|chore>: <general summary of the pull request>
  • I have read the Contributing Guide

Summary by CodeRabbit

  • Documentation

    • License field now includes identifier and URL for reference
  • Bug Fixes

    • Improved uninstall flow to stop and remove service reliably and preserve logs before removal
  • Chores

    • Updated product description and homepage formatting
    • Simplified persisted configuration to a single primary file
    • Clarified Visual C++ Redistributable dependency naming
    • Removed public binary declaration to streamline packaging

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

Revises the Simple DNSCrypt Scoop manifest: metadata updates, license object, renamed suggest key, removal of bin, simplified persist, added pre_install/pre_uninstall copy logic, and a scripted uninstaller that stops/removes the dnscrypt-proxy service.

Changes

Cohort / File(s) Summary
Manifest
bucket/simple-dnscrypt.json
Updated description and homepage; converted license from string to object with identifier+URL; renamed suggest.vcredist key to Microsoft Visual C++ 2015-2022 Redistributable.
Persistence & Hooks
bucket/simple-dnscrypt.json
Replaced multi-file persist array with single string dnscrypt-proxy\\dnscrypt-proxy.toml; moved log/config persistence into pre_install/pre_uninstall copy logic.
Install/Uninstall Logic
bucket/simple-dnscrypt.json
Removed bin (no shim); added uninstaller with PowerShell script to stop/remove dnscrypt-proxy service (PS version branching, admin checks); pre_uninstall saves logs/text to persist dir; pre_install restores persisted files and handles APPDIR extraction.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Scoop as Scoop (installer)
    participant APPDIR as APPDIR (extracted files)
    participant Persist as PersistDir
    participant PowerShell as PowerShell
    participant Service as dnscrypt-proxy Service
    Scoop->>APPDIR: extract package
    Scoop->>Persist: check for persisted logs/config
    Persist-->>Scoop: provide persisted files
    Scoop->>APPDIR: copy restored files into dnscrypt-proxy dir
    Scoop->>PowerShell: run installer actions (register service etc.)
    note over PowerShell,Service: Installed and started

    %% Uninstall flow
    Scoop->>PowerShell: run uninstaller script
    PowerShell->>Service: query running service
    alt service running
      PowerShell->>Service: stop service
    end
    PowerShell->>Service: remove service registration
    PowerShell->>Persist: copy *.log,*.txt from dnscrypt-proxy to PersistDir
    Scoop->>Persist: complete cleanup
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • mobaxterm: Fix persistence #17011 — Similar changes replacing automatic persist handling with manual pre_install/pre_uninstall copy logic and adding custom uninstall scripting.

Suggested reviewers

  • z-Fng

Poem

🐰 I hopped through manifests, found a stray bin,
I nudged configs safe, packed logs within.
A service I hush, then gently unbind,
One TOML to keep — neat, tidy, and kind.
Hop, manifest fixed — release time to grin! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing extraction issues, improving persistence, and refactoring uninstaller logic in simple-dnscrypt.
Description check ✅ Passed The description is comprehensive and follows the template with clear sections covering summary, related issues, detailed changes, and testing results.
Linked Issues check ✅ Passed The changes address the core objective of issue #10138 by fixing extraction logic in pre_install to relocate files from APPDIR subfolder, enabling proper shim creation.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing extraction, persistence, and uninstaller logic as outlined in the linked issues and PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

All changes look good.

Wait for review from human collaborators.

simple-dnscrypt

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate

Check the full log for details.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@bucket/simple-dnscrypt.json`:
- Around line 27-30: The copy loop that iterates "'*.log', '*.txt' |
ForEach-Object {" currently copies files regardless of size and can reintroduce
empty files that break dnscrypt-proxy; update the block(s) that use Test-Path
and Copy-Item to first check the file size (e.g., via Get-Item or Get-ChildItem
and checking the Length property) and only run Copy-Item when Length -gt 0;
apply the same change to the second identical block (lines ~41-44) so empty
log/text files are skipped before copying to \"$dir\\dnscrypt-proxy\".

@SorYoshino
Copy link
Contributor Author

/verify

@github-actions
Copy link
Contributor

All changes look good.

Wait for review from human collaborators.

simple-dnscrypt

  • Lint
  • Description
  • License
  • Hashes
  • Checkver
  • Autoupdate

Check the full log for details.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

simple-dnscrypt@0.7.1: Shim creation fail

1 participant