← Back to issue list

craft-cli doesn't put the cursor back in certain error cases.

View original Github issue

Metadata

Project
craft-cli
Number
#334
Type
issue
State
closed
Author
lengau
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Fixed by PR #339 (commit b94a6b7): printer cleanup now stops the printer during destruction, restoring the cursor after error exits.

Resolution: closed resolved

Reason: PR #339 was merged and committed as b94a6b7, adding printer cleanup on destruction so the terminal cursor is restored during exceptional exits.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description We're hiding the cursor, but in certain error cases the application exits without making the cursor visible again. ### To Reproduce unclear how to reproduce repeatably, but I used `snapcraft pack`. Logs below. ### part yaml ```shell ``` ### Relevant log output ```shell $ snapcraft_8 pack Launching instance... :: Creating new base instance from remote - (68.6s)Traceback (most recent call last): File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/application.py", line 500, in main return app.run() ^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_application/application.py", line 691, in run return_code = self._run_inner() ^^^^^^^^^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/application.py", line 203, in _run_inner return_code = super()._run_inner() ^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_application/application.py", line 637, in _run_inner dispatcher = self._get_dispatcher() ^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/application.py", line 439, in _get_dispatcher self._check_for_classic_fallback() File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/application.py", line 351, in _check_for_classic_fallback raise errors.ClassicFallback() snapcraft.errors.ClassicFallback During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/snap/snapcraft/14167/bin/snapcraft", line 8, in <module> sys.exit(main()) ^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/application.py", line 503, in main return cli.run() ^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/cli.py", line 255, in run _run_dispatcher(dispatcher, global_args) File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/cli.py", line 228, in _run_dispatcher dispatcher.run() File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 528, in run return self._loaded_command.run(self._parsed_command_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/commands/core22/lifecycle.py", line 266, in run super().run(parsed_args) File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/commands/core22/lifecycle.py", line 139, in run parts_lifecycle.run(self.name, parsed_args) File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/parts/lifecycle.py", line 105, in run _run_command( File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/parts/lifecycle.py", line 147, in _run_command _run_in_provider(project, command_name, parsed_args) File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/snapcraft/parts/lifecycle.py", line 524, in _run_in_provider with provider.launched_environment( File "/snap/snapcraft/current/usr/lib/python3.12/contextlib.py", line 137, in __enter__ return next(self.gen) ^^^^^^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/lxd/lxd_provider.py", line 147, in launched_environment instance = launch( ^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 783, in launch _create_instance( File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/lxd/launcher.py", line 150, in _create_instance base_configuration.setup(executor=base_instance, mount_cache=False) File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/base.py", line 1030, in setup self._setup_network(executor=executor) File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/bases/ubuntu.py", line 197, in _setup_network self._setup_networkd(executor=executor) File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/base.py", line 409, in _setup_networkd self._execute_run( File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/base.py", line 1151, in _execute_run proc = executor.execute_run( ^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/lxd/lxd_instance.py", line 254, in execute_run return self.lxc.exec( ^^^^^^^^^^^^^^ File "/snap/snapcraft_8/14167/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 390, in exec return runner(final_cmd, timeout=timeout, check=check, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/current/usr/lib/python3.12/subprocess.py", line 550, in run stdout, stderr = process.communicate(input, timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/current/usr/lib/python3.12/subprocess.py", line 1209, in communicate stdout, stderr = self._communicate(input, endtime, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/snap/snapcraft/current/usr/lib/python3.12/subprocess.py", line 2116, in _communicate self._check_timeout(endtime, orig_timeout, stdout, stderr) File "/snap/snapcraft/current/usr/lib/python3.12/subprocess.py", line 1253, in _check_timeout raise TimeoutExpired( subprocess.TimeoutExpired: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:base-instance-snapcraft-buildd-base-v71--d799df4d4588b4abe861', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'CRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'systemctl', 'restart', 'systemd-networkd']' timed out after 60 seconds ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by PR #339 (commit b94a6b7): printer cleanup now stops the printer during destruction, restoring the cursor after error exits.
stealth/space-bunny-alpha — closed resolved Fixed cursor restoration on error exits by stopping the printer during destruction in merged PR canonical/craft-cli#339 (commit b94a6b7).
stealth/space-bunny-alpha — closed resolved Fixed in canonical/craft-cli#339 (commit b94a6b7): printer cleanup now restores the terminal cursor during error exits.
stealth/space-bunny-alpha — closed resolved Cursor restoration on error paths was implemented by commit b94a6b7, merged in craft-cli PR #339.
qwen/qwen3.6-35b-a3b — — Resolved by implementing cursor restoration on error paths, ensuring the terminal cursor remains visible after crashes or timeouts.
qwen/qwen3.6-35b-a3b — — Closed after a maintainer provided a minimal reproducer. The bug was addressed by ensuring craft-cli restores cursor visibility on error exits.
qwen/qwen3.6-35b-a3b — — Fixed and closed. A maintainer provided a minimal reproducer showing the terminal cursor fails to restore on exceptions, leading to a fix in craft-cli.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-cli#339 (confidence 100%)

    The merged PR fixed printer cleanup on destruction and restored the hidden cursor.

Related issues

No related issues found above the similarity threshold.