Repository navigation
fix(attach): treat backslash-newline as a line continuation in splitShellWords - #392
Conversation
…hellWords
POSIX removes both characters of a backslash-newline, outside quotes and
inside double quotes. splitShellWords kept a literal newline instead
(splitShellWords('x\\\ny') => ['x\ny']); it now yields ['xy'].
Closes hivecommons#391
Hive-Run: hivecommons#391
Hive-Plan: review-backlog/correctness
Hive-Spec: pluk-attach#split-shell-words-line-continuation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HRH6kjqKvEtEADvCEWcAm8
Signed-off-by: Karibhou <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome to the Hive Commons community! Thanks for opening your first PR here! We're excited to have you contributing. Before merge, please ensure:
A maintainer will review your PR soon. Hope you have a great time here! |
There was a problem hiding this comment.
Read splitShellWords in full at e9be6c3 (src/attach.ts:67-111) and its eight callers (attach.ts:46,120,133,229,360,383,448, cli.ts:249). This looks correct to me.
- Moving
escaping = falseahead of the\ncheck (src/attach.ts:75-78) is what makes'\\\n'alone yield[]:startedis never set, so the end-of-inputif (started) words.push(current)at:110does nothing. Traceda \\\n b→['a','b']andx \\\n→['x'], both matching POSIX. - Dropping
\nfrom the double-quote kept-backslash set (:79) is consistent: the newline case is now consumed one line earlier, so the set only needs the four POSIX-special characters. - The trailing-lone-backslash path (
:106-109) is unchanged and still only fires when the input ends in\. - Single-quote behaviour is unchanged because
:84already skips escape handling whenquote === "'".
npm test at this head: 618/618 pass, coverage thresholds met. Resolves #391 as the issue states it.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
6c9da75
into
hivecommons:main
|
Merged by hive contributor-lane auto-merge: CI green for ≥30m, reviewer verdict approve, @Karibhou holds the trusted tier in this hive's contributor registry. |
Summary
splitShellWordskept a literal newline for\followed by a newline, both outside quotes and inside double quotes (splitShellWords('x\\\ny')returned['x\ny']). POSIX treats this as a line continuation and removes both characters, so it now returns['xy'].src/attach.ts: in the escape branch, a newline after a backslash is dropped together with the backslash and does not start a word ('\\\n'alone yields[]). Single quotes are unchanged (both characters stay literal).test/attach-orchestration.test.js: new test covering unquoted, double-quoted, between-words, standalone and single-quoted cases.changelog.d/fixed-split-shell-words-line-continuation.md: changelog fragment.Testing
npm test: 618/618 pass, coverage thresholds met.Closes #391
🤖 Generated with Claude Code
https://claude.ai/code/session_01HRH6kjqKvEtEADvCEWcAm8
— hive: backend=claude model=claude-opus-5-5
🐝 Hive Agent:
contributor| SHA:e9be6c3