Replace logname with id - #128
Conversation
|
Up to standards ✅🟢 Issues
|
| # Safely drop privileges back to the normal user to run brew commands | ||
| if [ "${NON_ROOT_USER}" != "nobody" ] && [ "${NON_ROOT_USER}" != "root" ]; then | ||
| if ! su - "${NON_ROOT_USER}" -s /bin/sh -c "${_brew_cmds}"; then | ||
| if ! su - "${NON_ROOT_USER}" -c "${_brew_cmds}"; then |
There was a problem hiding this comment.
WARNING: Removing explicit -s /bin/sh may break for users with non-POSIX login shells
The su - "${NON_ROOT_USER}" -c "${_brew_cmds}" command now uses the user's login shell instead of explicitly invoking /bin/sh. The _brew_cmds variable contains POSIX shell syntax (eval, $(), &&, printf) which will fail in non-POSIX shells like fish or nushell.
The original su - "${NON_ROOT_USER}" -s /bin/sh -c "${_brew_cmds}" guaranteed POSIX compliance.
Consider restoring -s /bin/sh or using sh -c explicitly for compatibility.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
There was a problem hiding this comment.
@kilocode-bot raise a GitHub issue regarding this, but don't fix it here.
There was a problem hiding this comment.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (1 file)
Fix these issues in Kilo Cloud Reviewed by free · Input: 0 · Output: 0 · Cached: 0 |



This pull request makes minor improvements to the
.update.shscript to enhance user detection and streamline privilege dropping when running Homebrew commands.User detection improvement:
lognametoid -un, which is more reliable in some environments.Privilege dropping simplification:
sucommand used to drop privileges for running Homebrew commands was simplified by removing the explicit shell specification (-s /bin/sh), relying on the default shell for the user.