New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check on CI conda hasn't "infected" the system #8
Comments
@xobs / @gojimmypi -- Any idea how I can check this behaviour? |
on an ongoing basis, or just during development of the build process? to see what's going on at a given time during development, process monitor is pretty helpful. (filters are your friend here) however during a build process - a "before and after" would probably be quite difficult. In fact, I'm sure the registry could be changing all the time by other windows apps/processes running; how to determine if if was caused by your process? |
@gojimmypi - As part of the CI system. |
We can check just before and after we install conda right? |
Conda appears to create start menu items by unconditionally calling https://github.com/conda/constructor/blob/master/constructor/nsis/main.nsi.tmpl#L817-L820 They're using NSIS for installation, however they shell out to Python to do the actual start menu creation. One possibility for determining whether they have updated anything is to use the Volume Shadow Copy service to take a snapshot of the directory both before and after the installation and look for differences. Similar methods could be used to determine which parts of the registry have been modified. Give me a little bit, I'm putting together a PoC.
|
While it's possible to snapshot a user's home directory and compare it both before and after, there are a number of problems:
The installer doesn't enable logging, but that wouldn't matter because it uses python to create the start menu entries. |
FYI -- We should send a patch upstream to fix the shortcut issue. This issue is making sure that problems like the shortcut issue don't come back! |
Here's a script that does what you want: $start_path_global = "$ENV:ProgramData\Microsoft\Windows\Start Menu\Programs"
$start_path_user = "$ENV:AppData\Microsoft\Windows\Start Menu\Programs"
$installer_path = "test/env/downloads/Miniconda3-latest-Windows-x86_64.exe"
$installer_filename = "Miniconda3-latest-Windows-x86_64.exe"
$installer_uri = "https://repo.anaconda.com/miniconda/$installer_filename"
$installer_dest = (Get-Item -Path ".\").FullName + "\tmp"
# Download if necessary
if ( -Not ( Test-Path -Path $installer_path ) ) {
Write-Output "Installer file not found -- downloading $installer_uri"
# Create the download directory if it doesn't exist
$target_dir = [System.IO.Path]::GetDirectoryName($installer_path)
if ( -Not ( Test-Path -Path $target_dir ) ) {
New-Item -Path $target_dir -ItemType Directory | Out-Null
}
# Perform the download
Invoke-WebRequest -Uri $installer_uri -OutFile $installer_path
}
# Capture the state of various parts of the system pre-install
Write-Output "Capturing system state prior to installation"
$start_before_global = Get-ChildItem -Recurse -Path $start_path_global
$start_before_user = Get-ChildItem -Recurse -Path $start_path_user
$reg_before_user = Get-ChildItem -Recurse -Path HKCU:\ -ErrorAction SilentlyContinue
# Perform the install
Write-Output "Installing $installer_path to $installer_dest"
Start-Process -Wait -FilePath $installer_path -ArgumentList "/InstallationType=JustMe /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /NoScripts=1 /S /D=$installer_dest"
# Capture the state afterwards
Write-Output "Capturing system state after installation"
$start_after_global = Get-ChildItem -Recurse -Path $start_path_global
$start_after_user = Get-ChildItem -Recurse -Path $start_path_user
$reg_after_user = Get-ChildItem -Recurse -Path HKCU:\ -ErrorAction SilentlyContinue
# Compare the two
Write-Output "Differences before and after:"
Compare-Object -ReferenceObject $start_before_global -DifferenceObject $start_after_global
Compare-Object -ReferenceObject $start_before_user -DifferenceObject $start_after_user
Compare-Object -ReferenceObject $reg_before_user -DifferenceObject $reg_after_user (Edited to fix installer download) Example output:
Note how creating Start Menu entries actually modifies the registry slightly by adding the new entries to the This script is rather heavy-handed in that it actually captures the entire registry in a pair of variables, and as such that adds about thirty seconds to the installation time. We could make it fancier and have it check more paths, and/or just loop through an array of paths, but I think this gets the point across. |
30 seconds is entirely fine! |
The CI system should check that the conda install hasn't done any of the following;
The text was updated successfully, but these errors were encountered: