Skip to content

Fix the bug brew - #122

Merged
gvatsal60 merged 8 commits into
masterfrom
kilo/polished-juniper-751
Sep 27, 2026
Merged

gvatsal60 merged 8 commits into
masterfrom
kilo/polished-juniper-751

Conversation

@gvatsal60

Copy link
Copy Markdown
Owner

This pull request improves the way the script handles Homebrew (brew) commands, especially in environments where the script is run with elevated privileges (such as sudo) and the PATH may be restricted. The changes ensure that brew is correctly detected and executed as the appropriate non-root user, which helps avoid permission issues and makes the update process more robust.

Homebrew command detection and execution improvements:

  • Added explicit detection for brew in /home/linuxbrew/.linuxbrew/bin/brew to handle cases where the command may not be in the PATH due to running under sudo with a stripped environment.
  • Modified the update_brew function to:
    • Build all brew commands into a single string for execution.
    • Drop privileges and run brew commands as the resolved non-root user using su -, improving safety and avoiding permission errors.
    • Fallback to running the commands in the current shell if no valid non-root user is found.

gvatsal60 and others added 2 commits September 27, 2026 06:59
Ensure Homebrew commands are executed correctly by explicitly handling
the brew path and dropping privileges to the non-root user. This
prevents issues when running under a stripped sudo PATH and ensures
brew commands are run in the correct user context with the necessary
environment variables loaded.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Consolidate brew commands into a single variable to ensure consistent
execution between the non-root user context and the fallback path.
This reduces duplication and improves maintainability of the update
logic.

Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
@gvatsal60 gvatsal60 self-assigned this Sep 27, 2026
Copilot AI lite review requested due to automatic review settings September 27, 2026 07:09

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.

@gvatsal60 gvatsal60 changed the title Fix the bug #121 Fix the bug brew Sep 27, 2026
@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.

@gvatsal60 gvatsal60 linked an issue Sep 27, 2026 that may be closed by this pull request
Comment thread .update.sh Outdated
Comment thread .update.sh Outdated
Comment thread .update.sh Outdated
Comment thread .update.sh Outdated
Comment thread .update.sh
@kilo-code-bot

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

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

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

CRITICAL

File Line Issue
.update.sh 380 Calls removed function check_cmd
Issue Description

CRITICAL: .update.sh:380 - Calls removed function check_cmd

The incremental commit (e730f94) removed the check_cmd function (previously at lines 40-58), but line 380 still calls check_cmd tput for color capability detection. This will cause a runtime "command not found" error when the script executes.

The check_command function remains but prints an error message, which is undesirable for a silent capability check.

Suggested fix: Replace check_cmd tput with command -v tput >/dev/null 2>&1 for a silent POSIX-compatible check.

Note: This issue is on a line outside the incremental diff hunks, so an inline comment could not be placed. The root cause (function removal) is within the changed lines.

Files Reviewed (1 file)
  • .update.sh - 1 issue

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 152f4e0)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 152f4e0)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • .update.sh

Previous review (commit 7d8d7c4)

Status: 5 Issues Found | Recommendation: Address before merge

Overview

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

WARNING

File Line Issue
.update.sh 230 Hardcoded brew path mismatch between check and execution
.update.sh 238 Missing error handling for brew command execution

SUGGESTION

File Line Issue
.update.sh 229 Leading newline in _brew_cmds variable
.update.sh 232 Use printf for portable newline handling
.update.sh 237 Multi-line command string may not work with non-POSIX login shells
Files Reviewed (1 file)
  • .update.sh - 5 issues

Fix these issues in Kilo Cloud


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

gvatsal60 and others added 5 commits September 27, 2026 07:16
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 27, 2026 07:19

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.

Copilot AI review requested due to automatic review settings September 27, 2026 08:57

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

@gvatsal60
gvatsal60 merged commit 1b24da6 into master Sep 27, 2026
13 checks passed
@gvatsal60
gvatsal60 deleted the kilo/polished-juniper-751 branch September 27, 2026 09:23
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.

bug: brew not found / fails when script is run via sudo

2 participants