Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

Fix #544 #545

Merged
merged 3 commits into from
Sep 27, 2015
Merged

Fix #544 #545

merged 3 commits into from
Sep 27, 2015

Conversation

ccrusius
Copy link
Contributor

'whoami' is not POSIX-compliant, but 'id -un' is. This is true
at least since the 1003.1-2001 standard, I don't have a copy of the
previous 1003.2-1992 to verify it is true there too.

This causes problems in recent operating systems where 'whoami' is
not even shipped anymore.

'whoami' is not POSIX-compliant, but 'id -un' is. This is true
at least since the 1003.1-2001 standard, I don't have a copy of the
previous 1003.2-1992 to verify it is true there too.

This causes problems in recent operating systems where 'whoami' is
not even shipped anymore.
@ghost
Copy link

ghost commented Sep 18, 2015

Thanks, commented in #544.

A bunch of fixes:

  * Only try to find out the user that is running the script if
    that's necessary. That allows us to error out if we can't find
    the user name.

  * Fallback to 'whoami' in the unlikely case that 'id -un' does
    not work.

  * Use 'su' if 'sudo' is not installed, and if the user is 'root'.
    (The 'sudo' binary is not installed by default in many OSs.)
@ghost
Copy link

ghost commented Sep 18, 2015

You forgot to restore the SunOS ucb PATH extension. Other than that, I agree with the patch. Thanks again.

@ccrusius
Copy link
Contributor Author

The ucb path should not be necessary now that id -un is used. There's no harm in adding it again, though.

Bring back Solaris' ucb PATH just in case.
@ghost
Copy link

ghost commented Sep 18, 2015

Doesn't the whoami fallback require the ucb path?

@ghost
Copy link

ghost commented Sep 18, 2015

Don't forget to append your name in THANKS.

@ccrusius
Copy link
Contributor Author

The whoami fallback only requires the ucb path on SunOS systems that do not have id -un, and I don't know of any. Does not hurt having it there, so I put it back.

@ghost
Copy link

ghost commented Sep 19, 2015

+1

@ghost
Copy link

ghost commented Sep 27, 2015

@ferd?

ferd added a commit that referenced this pull request Sep 27, 2015
@ferd ferd merged commit ea6e5e3 into rebar:master Sep 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants