Skip to content
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

Update install script to refresh Path #3462

Merged

Conversation

mikeagun
Copy link
Collaborator

Description

Updates Path after install so EbpfApi.dll can be found (instead of copying the dll to current directory). Fixes #3425

Testing

Covered by existing tests.

Documentation

N/A

Installation

N/A

scripts/install_ebpf.psm1 Show resolved Hide resolved
Write-Log("Copying ebpfapi.dll from '$ebpfApiDllPath' to '$pwd'...")
Copy-Item -Path $ebpfApiDllPath -Destination $pwd -Force
# Refresh Path so EbpfApi.dll can be found.
$machinepath = [system.environment]::getenvironmentvariable("path", [system.environmentvariabletarget]::machine)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ebpfapi.dll different for debug and release?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the binaries are different for debug and release.

I don't think that affects this PR though -- you'd be getting the same dll after this change vs. before. Previously we copied the dll from Program Files to the current working directory; with this change we refresh the path so that the dll in Program Files is seen in the current shell without copying it.

Copy-Item -Path $ebpfApiDllPath -Destination $pwd -Force
# Refresh Path so EbpfApi.dll can be found.
$machinepath = [system.environment]::getenvironmentvariable("path", [system.environmentvariabletarget]::machine)
$userpath = [system.environment]::getenvironmentvariable("path", [system.environmentvariabletarget]::user)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check non-null constraints for those variables ($userpath, $machinepath)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. If the environment variables aren't set, then this code would behave the same as if they are set to an empty string, so it shouldn't cause any problems.

Copy link
Collaborator

@shpalani shpalani Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, it was copied from Program Files., which ensured that ebpfapi.dll was present. With the new changes, how do you ensure the DLL is present and mandatory, if the userpath is not set?

Also, there are 2 test cases failing in pipeline. Not sure whether it is due to these envn.vars set....

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the 2 failing test cases: regression_driver_ws2022 also fails in main, so I don't think that is related.

If the installer succeeded, then the DLL should be present and ebpf-for-windows should have been added to the system path, and if it failed then we will have errored and exited before this line.

If a future bug dropped ebpfapi.dll from the installer testing would still fail at the first test which needs the DLL.

Do we need an explicit check for the DLL, or is the implicit testing of trying to use it enough?

@saxena-anurag saxena-anurag added this pull request to the merge queue Apr 18, 2024
Merged via the queue into microsoft:main with commit bbaa366 Apr 18, 2024
85 of 87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ebpfapi.dll is not in path
5 participants