`swupd bundle-remove --orphans` causes `Segmentation fault` after removing `os-clr-on-clr-dev`
System Information
- Clear Linux OS Version: 43630
- swupd Version: 43630
Bug Description
Running sudo swupd bundle-remove --orphans results in a reproducible segmentation fault.
The crash is triggered by a corrupted state left behind after the os-clr-on-clr-dev bundle is removed. The bundle-remove process for this specific bundle appears to corrupt swupd's internal dependency database. The bundle-remove --orphans command later fails when it parses this corrupted state, leading to the crash.
The issue is not related to the presence of the os-clr-on-clr bundle, as the crash persists even after os-clr-on-clr has been removed. The trigger is the removal of os-clr-on-clr-dev itself.
Critically, this corruption is so subtle that swupd's integrity check, sudo swupd diagnose, fails to detect the issue before the crash occurs. This gives a false sense of system integrity. The bundle-remove operation appears to leave an invalid entry or relationship in the swupd database, which the subsequent --orphans command cannot parse, leading to an uncontrolled crash. This issue represents a critical logic flaw in swupd's state management, as a standard command silently damages the system's integrity in a way that evades diagnostic tools.
Steps to Reproduce
-
Ensure a stable starting state by having the bundle installed:
sudo swupd bundle-add os-clr-on-clr-dev -
Confirm
swupd --orphansworks correctly:sudo swupd bundle-remove --orphans # Expected: Succeeds with "No orphaned bundles found..." -
Trigger the bug by removing the key bundle:
sudo swupd bundle-remove os-clr-on-clr-dev # Expected: Reports success, but has corrupted the database. -
Observe the crash when attempting to run the orphan cleanup:
sudo swupd bundle-remove --orphansExpected Behaviour: The command should execute successfully. Actual Behaviour: The command terminates immediately with the shell message:
Segmentation fault -
Confirm the cause by repairing the state:
sudo swupd bundle-add os-clr-on-clr-dev # The --orphans command now works again, proving the state was repaired. sudo swupd bundle-remove --orphans
Full Reproduction Log
The complete terminal session log demonstrating the full reproduction cycle, diagnostic commands, and GDB session is attached for review: