Thanks to visit codestin.com
Credit goes to github.com

Skip to content

tools: fix comparison to see if sudo test is needed in install-*.sh#6771

Merged
TravisEz13 merged 4 commits intoPowerShell:masterfrom
bjh7242:master
May 1, 2018
Merged

tools: fix comparison to see if sudo test is needed in install-*.sh#6771
TravisEz13 merged 4 commits intoPowerShell:masterfrom
bjh7242:master

Conversation

@bjh7242
Copy link
Contributor

@bjh7242 bjh7242 commented Apr 28, 2018

PR Summary

The comparison to test if we were using sudo was failing when running as root. We would then run -v, and get a bad error message. fixing the comparison.

PR Checklist


#Check that sudo is available
if [[ "$SUDO" -eq "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
if [[ $EUID != 0 && "$SUDO" -eq "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we use the same pattern as in installpsh-redhat.sh?

Copy link
Member

Choose a reason for hiding this comment

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

The sudo check should be equivalent because we only set $SUDO to sudo if $EUID != 0

Copy link
Member

Choose a reason for hiding this comment

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

verified... there is an error in the conditional... change "$SUDO" -eq "sudo" to "$SUDO" == "sudo" and remove your change

Copy link
Member

@TravisEz13 TravisEz13 left a comment

Choose a reason for hiding this comment

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

please respond to


#Check that sudo is available
if [[ "$SUDO" -eq "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
if [[ $EUID != 0 && "$SUDO" -eq "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

The sudo check should be equivalent because we only set $SUDO to sudo if $EUID != 0


#Check that sudo is available
if [[ "$SUDO" -eq "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
if [[ $EUID != 0 && "$SUDO" -eq "sudo" && ! ("'$*'" =~ skip-sudo-check) ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

verified... there is an error in the conditional... change "$SUDO" -eq "sudo" to "$SUDO" == "sudo" and remove your change

@bjh7242
Copy link
Contributor Author

bjh7242 commented Apr 30, 2018

Just pushed the requested update

@msftclas
Copy link

msftclas commented Apr 30, 2018

CLA assistant check
All CLA requirements met.

@TravisEz13
Copy link
Member

@bjh7242 I made the other scripts consistent per @iSazonov 's request.

@TravisEz13
Copy link
Member

@bjh7242 My changes triggered the code complexity rules (code across multiple files) that mean you need to sign the CLA? Would you mind signing?

@TravisEz13 TravisEz13 changed the title updating error when running powershell installer as root tools: fix comparison to see if sudo test is needed in install-*.sh Apr 30, 2018
@TravisEz13
Copy link
Member

I updated your PR title and summary based on the current change

@bjh7242
Copy link
Contributor Author

bjh7242 commented Apr 30, 2018

So I'm getting this error right now. I'm about to be AFK for the next 12ish hours, but I'll check again tomorrow morning to see if there are still issues with the site

microsoftcla

@TravisEz13
Copy link
Member

TravisEz13 commented Apr 30, 2018

FYI, this answer explains what was going on.

@TravisEz13
Copy link
Member

@bjh7242 I have asked for help with CLA. I'll get back to you when I get an answer.

@MichaelTsengLZ
Copy link

@bjh7242 Thank you so much for reporting this. I just fixed the CLA system. Could you give it a try again?

@bjh7242
Copy link
Contributor Author

bjh7242 commented May 1, 2018

Just signed it, let me know if you need anything else from me. Thanks!

@TravisEz13 TravisEz13 merged commit 03b1f2b into PowerShell:master May 1, 2018
@TravisEz13
Copy link
Member

@bjh7242 Thanks for your contribution.

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.

5 participants