simple-dnscrypt: Fix extraction & persistence, refactor uninstaller logic#17073
simple-dnscrypt: Fix extraction & persistence, refactor uninstaller logic#17073SorYoshino wants to merge 2 commits intoScoopInstaller:masterfrom
Conversation
WalkthroughUpdates the Simple DNSCrypt Scoop manifest: metadata and license format changes; removed Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
All changes look good. Wait for review from human collaborators. simple-dnscrypt
|
0b5c44d to
059b835
Compare
There was a problem hiding this comment.
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\".
|
/verify |
|
All changes look good. Wait for review from human collaborators. simple-dnscrypt
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
bucket/simple-dnscrypt.json (1)
27-30:⚠️ Potential issue | 🟠 MajorStill copies zero-byte
*.log/*.txtfiles.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
📒 Files selected for processing (1)
bucket/simple-dnscrypt.json
|
/verify |
|
All changes look good. Wait for review from human collaborators. simple-dnscrypt
|
Summary
Refactors
simple-dnscryptto fix extraction issues, improve persistence reliability, and align the uninstaller with Scoop's lifecycle.Related issues or pull requests
Changes
description,homepage, and structured thelicensefield.APPDIRsubfolder to the root directory during installation.persistfield to the main configuration.pre_uninstallto ensure they are preserved correctly in thepersist_dir.Stop-ProcessandStop-Serviceto theuninstallerblock to prevent silent data loss and respect Scoop's process check.Notes
pre_uninstalltouninstaller, Scoop can now properly notify users if the app is running before attempting to kill it.$service.BinaryPathName -notmatch $path_regexprevents the script from accidentally stopping or deleting non-Scoop versions ofdnscrypt-proxy.query.logare created indnscrypt-proxy, the application will fail to start properly.Uninstall.exebacks updnscrypt-proxy.tomlto$env:TEMPand stops thednscrypt-proxyservice. This behavior overlaps with the logic implemented in this PR, soStart-Process -Wait "$dir\Uninstall.exe" | Out-Nullhas been removed.Testing
The test results are as follows:
<manifest-name[@version]|chore>: <general summary of the pull request>Summary by CodeRabbit
Documentation
Bug Fixes
Chores