Skip to content

fix(builtins): xargs and empty pipes give stdin at EOF; printf %q keeps UTF-8 text - #2628

Merged
chaliy merged 1 commit into
mainfrom
claude/project-thread-eafupr-bb-xargs-printf
Oct 8, 2026
Merged

chaliy merged 1 commit into
mainfrom
claude/project-thread-eafupr-bb-xargs-printf

Conversation

@chaliy

@chaliy chaliy commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Requested by Михайло · project thread

What changed

  • xargs runs each command with stdin at EOF, as GNU xargs does with /dev/null, so printf '' | xargs wc -l prints 0.
  • An empty pipe now reaches compound commands and functions as stdin at EOF instead of no stdin: printf '' | { wc -l; } prints 0.
  • printf %q leaves printable non-ASCII text unescaped (bashkit runs as UTF-8): com\ espaço, not com\ espa\ço. Non-ASCII control characters use $'\ooo'.

Why

Two Debian-oracle cases found by the roadmap thread (pipeline-common-agent, printf-q-roundtrip). The xargs one turned out to be a general bug: an empty pipeline stdin was dropped before reaching the command.

Before / After

$ printf '' | xargs wc -l; printf '' | { wc -l; }; printf '%q\n' 'com espaço'
before:  (nothing) / (nothing) / com\ espa\ço
after:   0 / 0 / com\ espaço        # = bash 5.2, LANG=C.UTF-8

Risk

  • Low. Commands reading an empty pipe now see an empty stdin rather than none; read, cat and friends already treat both as EOF. Full test suite passes.

Checklist

  • Tests added or updated
  • Backward compatibility considered

Generated by Claude Code

@chaliy chaliy self-assigned this Oct 8, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 27c3148 Commit Preview URL

Branch Preview URL
Oct 08 2026, 02:16 AM

@chaliy
chaliy merged commit 0299c05 into main Oct 8, 2026
46 checks passed
@chaliy
chaliy deleted the claude/project-thread-eafupr-bb-xargs-printf branch October 8, 2026 02:34
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