Closed amorphobia closed 3 months ago
I'll use a sample manifest to illustrate the issue. I have modified sudo.json in main bucket as following:
sudo.json
{ "version": "0.1", # modified "description": "An approximation of the Unix sudo command. Shows a UAC popup window unfortunately.", "homepage": "https://github.com/lukesampson/psutils", "license": "MIT", "url": "https://raw.githubusercontent.com/lukesampson/psutils/c7116ac143ca81f223e6091d0974f45ac241eb1d/sudo.ps1", "hash": "0d3cf564dc584ea98b213b4763228dee523c32388b1293e77eff70344d294aa8", "bin": "sudo.ps1", "env_set": { "SUDO_VERSION": "0.1" # added }, "checkver": { "url": "https://github.com/lukesampson/psutils/commits/master/sudo.ps1.atom", "regex": "(?s)>(\\d+)-(\\d+)-(\\d+)T.*?/(?<sha>[0-9a-f]{40})", "replace": "0.${1}.${2}.${3}" }, "autoupdate": { "url": "https://raw.githubusercontent.com/lukesampson/psutils/$matchSha/sudo.ps1", "env_set": { "SUDO_VERSION": "$version" # added } } }
I have add env_set and autoupdate.env_set, as well as change the current version to 0.1. Then run
env_set
autoupdate.env_set
0.1
& "$env:SCOOP_HOME/bin/checkver.ps1" -Dir <bucket_dir> -Update sudo
As a result, SUDO_VERSION in both env_set and autoupdate.env_set were changed to 0.2020.01.26.
SUDO_VERSION
0.2020.01.26
Only SUDO_VERSION under env_set will be updated, and the value under autoupdate.env_set should keep the substitution pattern.
The assignment operation for PSCustomObject only passes by reference, a copy operation can fix it.
Windows version: 10
OS architecture: 64bit
PowerShell version: 5.1.20348.2400
I will commit a change trying to fix it.
Bug Report
Current Behavior
I'll use a sample manifest to illustrate the issue. I have modified
sudo.json
in main bucket as following:I have add
env_set
andautoupdate.env_set
, as well as change the current version to0.1
. Then runAs a result,
SUDO_VERSION
in bothenv_set
andautoupdate.env_set
were changed to0.2020.01.26
.Expected Behavior
Only
SUDO_VERSION
underenv_set
will be updated, and the value underautoupdate.env_set
should keep the substitution pattern.Possible Solution
The assignment operation for PSCustomObject only passes by reference, a copy operation can fix it.
System details
Windows version: 10
OS architecture: 64bit
PowerShell version: 5.1.20348.2400