Automattic / Automattic/kandelo

Browser shell grep -q returns success for non-matching input

Open
#708 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31
Forks
15
Avg merge
11h 7m
Merged PRs (30d)
80

Description

In the browser shell demo, GNU grep currently returns status 0 for matching and non-matching input when run from the PTY shell. This made the merge-gate NetHack check report `KANDELO_NETHACK_BAD` even though `/tmp/kandelo-nethack.out` did not contain `Cannot open record file`.

Focused browser repro from the shell demo:

```sh
printf 'abc\\n' >/tmp/g\ngrep -q zzz /tmp/g; echo "GREP_FILE_NO:$?"\ngrep -q abc /tmp/g; echo "GREP_FILE_YES:$?"\nprintf 'abc\\n' | grep -q zzz; echo "GREP_STDIN_NO:$?"\nprintf 'abc\\n' | grep -q abc; echo "GREP_STDIN_YES:$?"\n```\n\nObserved in Chromium against `apps/browser-demos` on this branch after rebuilding `shell.vfs.zst`:\n\n```text\nGREP_FILE_NO:0\nGREP_FILE_YES:0\nGREP_STDIN_NO:0\nGREP_STDIN_YES:0\n```\n\nExpected: no-match cases should exit 1. The existing package tests cover grep stdin through `runCentralizedProgram`, but the browser PTY path needs coverage for grep exit status and file operands.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in apps/browser-demos and reproduce the four grep commands through the browser PTY shell after rebuilding shell.vfs.zst. Compare that path with the existing grep stdin coverage in runCentralizedProgram, then add browser PTY coverage for matching and non-matching stdin and file operands. Done means non-matches exit 1 and matches exit 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, wasm
Domain
cli, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.