Skip to content

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

Open
SorYoshino wants to merge 2 commits intoScoopInstaller:masterfrom
SorYoshino:simple-dnscrypt
Open

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

Conversation

@SorYoshino
Copy link
Copy Markdown
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; updated product description and homepage formatting
  • Bug Fixes

    • Improved install/uninstall behavior to reliably stop/remove the service and preserve logs during uninstall
  • Chores

    • Simplified persisted configuration to a single primary file
    • Removed public binary declaration to streamline packaging
    • Clarified Visual C++ Redistributable dependency naming

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 22, 2026

Walkthrough

Updates the Simple DNSCrypt Scoop manifest: metadata and license format changes; removed bin; replaced manifest-level persist with scripted pre_install/pre_uninstall copy logic; added an uninstaller PowerShell script that stops and removes the dnscrypt-proxy service and moves logs/text to/from the persist directory.

Changes

Cohort / File(s) Summary
Manifest / Metadata
bucket/simple-dnscrypt.json
Adjusted description and homepage; converted license from string to object (identifier + url); removed top-level bin.
Persistence & Hooks
bucket/simple-dnscrypt.json
Removed persist array and replaced with explicit pre_install/pre_uninstall logic; persist now handled by copying *.log/*.txt and a single dnscrypt-proxy\\dnscrypt-proxy.toml.
Installer / Uninstaller Scripts
bucket/simple-dnscrypt.json
Added pre_install logic to move contents from APPDIR into $dir and restore persisted files; pre_uninstall now copies logs/text into $persist_dir. Introduced uninstaller.script to stop/remove service with PS 6+ vs older branching and admin checks.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Scoop as "Scoop (installer)"
    participant APPDIR as "APPDIR (extracted)"
    participant Persist as "PersistDir"
    participant PowerShell as "PowerShell (scripts)"
    participant Service as "dnscrypt-proxy Service"

    Scoop->>APPDIR: extract package contents
    Scoop->>PowerShell: run pre_install
    PowerShell->>APPDIR: move contents into $dir
    PowerShell->>Persist: check for `*.log`/`*.txt` or TOML
    Persist-->>PowerShell: provide persisted files
    PowerShell->>APPDIR: copy persisted files into dnscrypt-proxy dir
    PowerShell->>Service: (optionally) start/register service

    note over PowerShell,Service: Installed and running

    %% Uninstall flow
    Scoop->>PowerShell: run uninstaller.script
    PowerShell->>Service: locate service (Get-Service / Get-CimInstance)
    alt service found
      PowerShell->>Service: stop service (requires admin)
      PowerShell->>Service: remove service (Remove-Service or sc.exe delete)
    end
    PowerShell->>APPDIR: copy `*.log`/`*.txt` from dnscrypt-proxy to PersistDir
    PowerShell->>Persist: persist files saved
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • z-Fng

Poem

🐰 I nudged a stray bin from the lair,
Pulled TOML home and folded logs with care.
I whispered to services, "Hush, then go,"
Saved crumbs to persist, neat in a row.
Hop! Manifest mended — carrots for show.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main changes: fixing extraction issues, improving persistence, and refactoring uninstaller logic.
Description check ✅ Passed The PR description fully addresses the template requirements with linked issues, comprehensive change summary, testing details, and acknowledgment of the contributing guide.
Linked Issues check ✅ Passed The PR successfully addresses issue #10138 by implementing extraction logic to move files from APPDIR to the root directory, ensuring SimpleDnsCrypt.exe exists at the expected path for shim creation.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the simple-dnscrypt manifest: extraction logic, persistence improvements, and uninstaller refactoring align with stated objectives and linked issues.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
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
Copy Markdown

@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\".

Comment thread bucket/simple-dnscrypt.json
@SorYoshino
Copy link
Copy Markdown
Contributor Author

/verify

@github-actions
Copy link
Copy Markdown
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
Copy Markdown

@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

♻️ Duplicate comments (1)
bucket/simple-dnscrypt.json (1)

27-30: ⚠️ Potential issue | 🟠 Major

Still copies zero-byte *.log/*.txt files.

These blocks still rehydrate/persist empty files, which can bring back the dnscrypt-proxy startup failure condition.

Also applies to: 41-44

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bucket/simple-dnscrypt.json` around lines 27 - 30, The persisting logic
copies '*.log' and '*.txt' from $persist_dir into $dir\dnscrypt-proxy even when
they are zero bytes; update the block that iterates over "'*.log', '*.txt' |
ForEach-Object" (and the similar block at the other occurrence) to skip files
with size 0 by checking the file's Length (e.g., via Get-Item or Get-ChildItem)
before calling Copy-Item so only files with Length > 0 are rehydrated into the
dnscrypt-proxy directory.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@bucket/simple-dnscrypt.json`:
- Around line 52-70: The removal logic is using the hardcoded string
'dnscrypt-proxy' instead of the discovered service name, so update Stop-Process,
Remove-Service and the sc.exe delete argument to use $service.Name; specifically
replace the literal in Stop-Process -Name 'dnscrypt-proxy', Remove-Service -Name
'dnscrypt-proxy' and the Start-Process -ArgumentList
@('delete','dnscrypt-proxy') with the dynamic $service.Name (ensuring proper
expansion in the ArgumentList for Start-Process) so the script removes whatever
service was found by the earlier $services / $service matching logic.

---

Duplicate comments:
In `@bucket/simple-dnscrypt.json`:
- Around line 27-30: The persisting logic copies '*.log' and '*.txt' from
$persist_dir into $dir\dnscrypt-proxy even when they are zero bytes; update the
block that iterates over "'*.log', '*.txt' | ForEach-Object" (and the similar
block at the other occurrence) to skip files with size 0 by checking the file's
Length (e.g., via Get-Item or Get-ChildItem) before calling Copy-Item so only
files with Length > 0 are rehydrated into the dnscrypt-proxy directory.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 74619415-faba-4d05-b559-43aa605eee66

📥 Commits

Reviewing files that changed from the base of the PR and between 059b835 and 5b60000.

📒 Files selected for processing (1)
  • bucket/simple-dnscrypt.json

Comment thread bucket/simple-dnscrypt.json
@SorYoshino
Copy link
Copy Markdown
Contributor Author

/verify

@github-actions
Copy link
Copy Markdown
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