Skip to content

Commit

Permalink
Fixed crash in the proposal code (bsc#1209523)
Browse files Browse the repository at this point in the history
...when the requested candidate device does not exist

- 4.6.2
  • Loading branch information
lslezak committed Mar 20, 2023
1 parent 1908f01 commit e0ebf79
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions package/yast2-storage-ng.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Mar 20 16:42:45 UTC 2023 - Ladislav Slezák <lslezak@suse.com>

- Fixed crash in the proposal code when the requested candidate
device does not exist (bsc#1209523)
- 4.6.2

-------------------------------------------------------------------
Mon Mar 13 12:04:07 UTC 2023 - Ladislav Slezák <lslezak@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-storage-ng.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-storage-ng
Version: 4.6.1
Version: 4.6.2
Release: 0
Summary: YaST2 - Storage Configuration
License: GPL-2.0-only OR GPL-3.0-only
Expand Down
2 changes: 1 addition & 1 deletion src/lib/y2storage/guided_proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def remove_empty_partition_tables(devicegraph)
def candidate_devices_with_empty_partition_table(devicegraph)
device_names = settings.candidate_devices
devices = device_names.map { |n| devicegraph.find_by_name(n) }
devices.select { |d| d.partition_table && d.partitions.empty? }
devices.select { |d| d&.partition_table && d.partitions.empty? }
end

# Candidate devices to make a proposal
Expand Down
10 changes: 10 additions & 0 deletions test/y2storage/guided_proposal_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@
end
end

context "when the candidate devices are invalid" do
include_context "candidate devices"

let(:candidate_devices) { ["/dev/invalid_device"] }

it "raises Y2Storage::NoDiskSpaceError exception" do
expect { proposal.propose }.to raise_error(Y2Storage::NoDiskSpaceError)
end
end

context "when the candidate devices are not given" do
include_context "candidate devices"

Expand Down

0 comments on commit e0ebf79

Please sign in to comment.