Skip to content

Replace logname with id - #128

Merged
gvatsal60 merged 1 commit into
masterfrom
fix/update_script
Sep 28, 2026
Merged

gvatsal60 merged 1 commit into
masterfrom
fix/update_script

Conversation

@gvatsal60

Copy link
Copy Markdown
Owner

This pull request makes minor improvements to the .update.sh script to enhance user detection and streamline privilege dropping when running Homebrew commands.

User detection improvement:

  • The method for determining the non-root user was changed from using logname to id -un, which is more reliable in some environments.

Privilege dropping simplification:

  • The su command 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.

@gvatsal60 gvatsal60 self-assigned this Sep 28, 2026
Copilot AI lite review requested due to automatic review settings September 28, 2026 04:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sonarqubecloud

Copy link
Copy Markdown

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread .update.sh
# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@kilocode-bot raise a GitHub issue regarding this, but don't fix it here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The GitHub issue has been created successfully: #129 — #129

This captures the warning about removing -s /bin/sh potentially breaking for users with non-POSIX login shells (like fish or nushell), as noted in the code review. The issue is now tracked separately from this PR.

@kilo-code-bot

kilo-code-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
.update.sh 239 Removing explicit -s /bin/sh may break for users with non-POSIX login shells
Files Reviewed (1 file)
  • .update.sh - 1 issue

Fix these issues in Kilo Cloud


Reviewed by free · Input: 0 · Output: 0 · Cached: 0

@gvatsal60
gvatsal60 merged commit 6f619c1 into master Sep 28, 2026
12 checks passed
@gvatsal60
gvatsal60 deleted the fix/update_script branch September 28, 2026 05:26
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.

2 participants