Repository navigation
Conversation
e84990f to
3cd7568
Compare
…bles The 'env_set' block no longer overwrites a variable that is already defined in the scope the install writes to; upgrades no longer remove the variables of the old version before installing the new one; and 'scoop reset' no longer removes them before re-adding. 'scoop uninstall' gains '-k'/'--keep-env' to skip their removal there too. BREAKING CHANGE: 'env_set' values changed by a manifest between versions are no longer applied on upgrade or reset. A plain uninstall (without '--keep-env') followed by an install still applies the new values.
Address review: 'env_set' now distinguishes genuine user settings from values Scoop itself wrote. Test-EnvVarUserDefined replays the installed manifests' expanded 'env_set' values and only protects those no installed app accounts for; Scoop-owned values (including versioned ones under NO_JUNCTION and values owned by another app sharing the variable) are re-pointed to the installing/resetting app. Upgrades remove variables the new manifest no longer declares, unless user-defined. 'scoop uninstall scoop --keep-env' is now rejected up front.
Address review: when the new manifest stops declaring an 'env_set' variable, remove it only if its current value matches what this app's old manifest wrote. Values claimed by another installed app (via the new 'exclude_app' parameter of Test-EnvVarUserDefined) or edited by the user are left untouched.
…set values Address review: expand_env_set_value relied on PowerShell dynamic scoping, so a dropped manifest value using the version variable expanded with the replacement version (or nothing). The helper now takes an explicit variable set mirroring the installer's scope (dir, original_dir, persist_dir, app, version, url, bucket) and both the ownership replay and the update cleanup pass the installed/old values.
3cd7568 to
336c13f
Compare
e03eb59 to
401cb34
Compare
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
401cb34 to
7ecc6a5
Compare
7ecc6a5 to
c173e59
Compare
…aken
Address review: 'env_paths' expanded '%VAR%' entries from the manifest's
env_set default even though 'env_set' preserves user-defined variables,
so PATH got the wrong directory, and re-expanding only one value either
way left stale entries on PATH. 'env_paths' now takes the consumer:
adding resolves the value in effect (the stored one, the default as
fallback), the update-time keep-list expands the new manifest as written
('$mode' = 'manifest' in 'remove_obsolete_wiring'), and removal expands
both, so directories Scoop added before the variable was edited or the
entry was dropped are cleaned up too. Containment against the app and
persist directories is unchanged.
|
Rebased on develop twice as it moved (#6808 env-path expansion, then #6810 update-failure restore). The Heads-up for reviewers of the #6810 interaction: Failed-update env handling (correcting an earlier version of this comment that overstated a gap): the failure paths are covered by the same replay as reset — |
|
I'm refactoring the env handle now, with new shiming system which could handle envs in shim file. And the best place to put the envs that scoop added is the app's install.json. Please wait for the entire jobs' done then continue again. |
Description
env_set(lib/install.ps1) now distinguishes genuine user settings from values Scoop itself wrote. A newTest-EnvVarUserDefinedhelper replays the expandedenv_setvalue every installed app in the target scope would have written — explicitly bound install-scope variables (dir,original_dir,persist_dir,app,version,url,bucket), junction- andno_junction-aware. Only values that no installed manifest accounts for are preserved as user settings; Scoop-owned values are re-pointed to the app being installed/reset, so a manifest'senv_setstill takes effect after reinstalls, version-dir values (APP_HOME: $dir) do not go stale underNO_JUNCTION, and a shared variable follows the app you just installed or reset.update_app) no longer remove manifest environment variables; the new manifest overwrites Scoop-owned values. Variables the new manifest stops declaring are removed only when their value still matches what the updated app's old manifest wrote; values belonging to the user or to another installed app are left untouched. PATH cleanup (env_rm_path) is kept: those entries point at the old version directory and must be replaced.scoop uninstallgains-k/--keep-env, which skips removing the manifest's environment variables.scoop uninstall scoop -k/--keep-envis rejected up front, since it would be silently ignored by the self-removal path.scoop resetno longer force-resets values: it re-applies the manifest value unless the user has edited it (per-app shared variables are re-pointed again, as before).Motivation and Context
Closes ScoopInstaller/Main#8116
Static
env_setblocks clobber variables the user has deliberately configured (e.g. a cache directory on another volume), and the upgrade path additionally unsets them during the internal uninstall step. Because the layout is cross-volume, forcing it back topersistalso breaks hard-linking and degrades performance. Fixing it in core (instead of per-manifest workarounds, cf. ScoopInstaller/Main#8709) protects every bucket. A plain uninstall without--keep-envstill cleans the variables up, so fresh installs keep working.How Has This Been Tested?
bin/test.ps1on Pester 6.2, PSScriptAnalyzer 1.25: all tests passed (unit + lint + static-analysis + file-style; decompress matrix excluded locally per the harness's own changed-files gate, runs on CI).test/Scoop-Install.Tests.ps1.env_set, an undefined one was set to the manifest value,Test-EnvVarUserDefinedclassified both correctly, and uninstall-time removal still deletes it.bin/scoop.ps1):uninstall -k,--keep-env, and combined-kpaccepted;-z/--bogusrejected as before.Checklist:
developbranch.--keep-envand theenv_setbehavior change can follow)

Confidence Score: 5/5
No new blocking issue was identified.Summary
Preserves user-defined environment values while allowing Scoop-owned values to follow the selected app.
No new actionable findings were identified.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Apply manifest environment variables] --> B{Installed manifest accounts for value?} B -- Yes --> C[Write selected app value] B -- No, value exists --> D[Keep user value] C --> E[Add effective app paths] D --> E F[Remove app paths] --> G[Consider stored value and manifest default] G --> H[Remove paths inside app directories]Reviews (11) · Last reviewed commit: "fix(install): resolve %VAR% env_add_path..." · Reviewed by Greptile