charmcraft revisions Broken pipe on head / tail commands
Metadata
Current evaluation
Resolved in Charmcraft 2.0.0 through enhanced Craft CLI output handling in merged PR #635 (commit d36b21d8); piping revisions output to head no longer raises BrokenPipeError.
Resolution: closed resolved
Reason: The maintainer confirmed the behavior worked in Charmcraft 2.0.0 after adoption of enhanced Craft CLI. The relevant change landed through merged PR #635, represented by commit d36b21d8.
Evaluated by: mr-cal-bot
No scores available.
Issue body
When running ``charmcraft revisions charm-name | head -n 2``, the expectation would be to get the top 2 lines from the ``charmcraft revisions`` command. The command results in a ``BrokenPipeError`` error.
OS: Ubuntu 20.04.3
Charmcraft version: 1.5.0
Sample:
```
charmcraft revisions finos-legend-sdlc-k8s | head -n 2
Revision Version Created at Status
41 41 2022-03-17 released
Traceback (most recent call last):
File "/snap/charmcraft/834/lib/charmcraft/main.py", line 167, in main
retcode = dispatcher.run()
File "/snap/charmcraft/834/lib/craft_cli/dispatcher.py", line 400, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/charmcraft/834/lib/charmcraft/commands/store/__init__.py", line 597, in run
emit.message(line)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 610, in func
return wrapped_func(self, *args, **kwargs)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 712, in message
self._printer.show(sys.stdout, text, use_timestamp=use_timestamp) # type: ignore
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 373, in show
self._show(msg)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 333, in _show
self._write_line(msg)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 281, in _write_line
print(line, end="", flush=True, file=message.stream)
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/charmcraft/834/bin/charmcraft", line 8, in <module>
sys.exit(main())
File "/snap/charmcraft/834/lib/charmcraft/main.py", line 192, in main
emit.error(error)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 610, in func
return wrapped_func(self, *args, **kwargs)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 827, in error
self._report_error(error)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 801, in _report_error
self._printer.show(sys.stderr, str(error), use_timestamp=use_timestamp, end_line=True) # type: ignore
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 373, in show
self._show(msg)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 333, in _show
self._write_line(msg)
File "/snap/charmcraft/834/lib/craft_cli/messages.py", line 262, in _write_line
print(flush=True, file=self.prv_msg.stream)
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Resolved in Charmcraft 2.0.0 through enhanced Craft CLI output handling in merged PR #635 (commit d36b21d8); piping revisions output to head no longer raises BrokenPipeError. | |
| stealth/space-bunny-alpha | — | closed resolved | Closed as already fixed by the enhanced Craft CLI adoption (charmcraft#635, merge commit d36b21d8), shipped in Charmcraft 2.0.0; piping `charmcraft revisions` to `head` now works per facundobatista's 2022-09-05 confirmation. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in Charmcraft 2.0.0 through enhanced Craft CLI handling; piping `revisions` to `head` now completes without a broken-pipe traceback. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved in Charmcraft 2.0.0 by adopting the enhanced Craft CLI, which now gracefully handles broken pipe errors when piping to head or tail. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in Charmcraft v2.0.0. Upgrading to the enhanced Craft CLI properly handles pipe closures, eliminating the BrokenPipeError when piping revisions output to head or tail. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in Charmcraft v2.0.0 by adopting the enhanced Craft CLI, which properly handles SIGPIPE. Piping revisions to head or tail now works without raising BrokenPipeError. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
charmcraft#635
(confidence 95%)
Merged full-craft-cli-use introduced the enhanced Craft CLI behavior that resolves piping failures.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #378 Broken pipe when trimming lines (head) | craft-cli | closed | BrokenPipeError when piping craft-cli output into `head` was fixed by merged PR canonical/craft-cli#443 (commit 15f312f), which makes the printer ignore broken pipes on write and stream cleanup; issue #378 closed as resolved. |