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

Add Pulsar to PATH #978

Closed
5 tasks done
zhaolinlau opened this issue Apr 16, 2024 · 5 comments · Fixed by #1071
Closed
5 tasks done

Add Pulsar to PATH #978

zhaolinlau opened this issue Apr 16, 2024 · 5 comments · Fixed by #1071
Labels
bug Something isn't working

Comments

@zhaolinlau
Copy link

Thanks in advance for your bug report!

  • Have you reproduced issue in safe mode?
  • Have you used the debugging guide to try to resolve the issue?
  • Have you checked our FAQs to make sure your question isn't answered there?
  • Have you checked to make sure your issue does not already exist?
  • Have you checked you are on the latest release of Pulsar?

What happened?

When I check the Add Pulsar to PATH, it pops up errors as below:

Error Running Script: Error: Command failed: powershell.exe -File 'C:\Users\Win10\AppData\Local\Programs\Pulsar\resources\modifyWindowsPath.ps1' -installdir 'C:\Users\Win10\AppData\Local\Programs\Pulsar' -remove FALSE File C:\Users\Win10\AppData\Local\Programs\Pulsar\resources\modifyWindowsPath.ps1 cannot be loaded. The file C:\Users\Win10\AppData\Local\Programs\Pulsar\resources\modifyWindowsPath.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. + CategoryInfo : SecurityError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnauthorizedAccess

Pulsar version

1.116.0

Which OS does this happen on?

🪟 Windows

OS details

11

Which CPU architecture are you running this on?

x86_64/AMD64

What steps are needed to reproduce this?

  1. add powershell.exe to path
  2. download and install pulsar
  3. run pulsar as admin
  4. check the Add Pulsar to PATH
  5. the errors come up

Additional Information:

No response

@zhaolinlau zhaolinlau added the bug Something isn't working label Apr 16, 2024
@confused-Techie
Copy link
Member

Thanks a ton for reporting this!

There's a few things I want to go ahead and clarify on whats going on here:

  1. Did you need to run Pulsar as Admin? This should no longer be required to add Pulsar to the PATH no matter if you have a per-user or system install. But if that was giving you any errors that'd be awesome to know.
  2. Would you mind checking the current ExecutionPolicy of your system? Just running Get-ExecutionPolicy in any PowerShell terminal should return this information to you.

Also you mentioned having to add PowerShell to the PATH on Windows, I was under the assumption it should always be in the PATH just like cmd or other internal Windows essentials. Is this something you had removed? Or is this a work device that is significantly locked down?


To clarify on expected behavior with the reworked PATH adding of Pulsar v1.116.0 it should look like:

  1. Launch Pulsar v1.116.0
  2. Check Add Pulsar to PATH
  3. It just works, no manual need to modify PATH, or run anything as admin.

(Just adding the above to make sure everyone's on the same page)

@DeeDeeG
Copy link
Member

DeeDeeG commented Apr 18, 2024

FWIW, if I do Set-ExecutionPolicy -Scope CurrentUser Default (which sets the policy to Restricted, see https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4)...

Then it gives me an error that the script cannot be run.

If I do Set-ExecutionPolicy -Scope CurrentUser RemoteSigned, then it works as intended (with the usual requirement of restarting before it takes effect for cmd.exes or other terminals one might open).

(I must have had it on RemoteSigned during testing for the updated/simplified "Add Pulsar to PATH" checkbox. I believe it is quite popular (for people who actually intend to run powershell .ps1 scripts on their non-server Windows machines) to set RemoteSigned Execution Policy.)

@confused-Techie
Copy link
Member

@DeeDeeG Well I'll be. Seems mine is also on RemoteSigned likely due to previous work I've done, without realizing I had it changed during development of this feature.

Seems strange that it would suddenly break now, when we were able to run a PowerShell script just fine before.

But regardless with this now being an issue, I wonder what our best way of resolving it is. Since we don't sign Pulsar on Windows at all due to cost

@DeeDeeG
Copy link
Member

DeeDeeG commented Apr 18, 2024

If it's possible to re-write in cmd.exe or "do it in JS", that might be the best thing? Since I don't think batch/cmd scripts are locked down in quite the same way? (And we're definitely allowed to run JS if we've gotten this far, heh.)

@confused-Techie
Copy link
Member

@DeeDeeG While technically we could do it in cmd we would then be relegated to the setx command only, which I know we've previously discussed the downsides.

I wonder if we could maybe do:

  1. Sign only this file in some none uber expensive way
  2. Load the script into a child process as PowerShell and just run it as if it was running on the terminal. Not sure if that'd actually get around the issue, but might be worth a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants