Skip to content

fix(memtrack): prompt sudo on interactive stdin#459

Draft
not-matthias wants to merge 2 commits into
mainfrom
cod-3153-memtrack-sudo-password-prompt-skipped-when-stdout-is
Draft

fix(memtrack): prompt sudo on interactive stdin#459
not-matthias wants to merge 2 commits into
mainfrom
cod-3153-memtrack-sudo-password-prompt-skipped-when-stdout-is

Conversation

@not-matthias

@not-matthias not-matthias commented Jul 17, 2026

Copy link
Copy Markdown
Member

validate_sudo_access previously checked stdin/stdout directly, so both redirected output and piped input could skip the password prompt even when the process still had a controlling terminal. The subsequent non-interactive sudo command then failed when credentials were not cached.

Use /dev/tty to detect whether sudo can prompt through the controlling terminal. Add a Linux integration test that launches a real Bash command with piped stdin and redirected stdout, then verifies a fake sudo receives --validate before the non-interactive command.

Fixes COD-3153

Use the controlling input terminal to decide whether sudo can prompt for a password. Keep the non-interactive wrapper safe after credentials are validated.\n\nFixes COD-3153
@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown

Greptile Summary

This PR updates sudo prompting for memtrack runs. The main changes are:

  • Uses the controlling terminal to decide when to run sudo --validate.
  • Keeps inherited stdio for the validation prompt.
  • Adds unit and Linux integration tests for piped input with redirected output.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
src/executor/helpers/run_with_sudo.rs Updates sudo validation to check for a controlling terminal before prompting.
tests/sudo_prompt.rs Adds coverage for sudo validation with piped stdin and redirected output.

Reviews (2): Last reviewed commit: "fix(memtrack): detect sudo prompts via c..." | Re-trigger Greptile

Comment thread src/executor/helpers/run_with_sudo.rs Outdated
@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 17 untouched benchmarks


Comparing cod-3153-memtrack-sudo-password-prompt-skipped-when-stdout-is (50c3e26) with main (5c27231)

Open in CodSpeed

Use /dev/tty so piped stdin still prompts when a controlling terminal is available. Add a Bash regression covering piped stdin and redirected stdout.\n\nRefs COD-3153
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.

1 participant