Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge sp3 #640

Merged
merged 7 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions package/yast2-bootloader.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Apr 19 18:21:58 UTC 2021 - Josef Reidinger <jreidinger@suse.com>

- Fix crash when bootloader is not managed by yast and security
module wants to show cpu mitigation (bsc#1184968)
- 4.3.26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it is a good chance to set version to 4.4.0, isn't it?


-------------------------------------------------------------------
Wed Mar 10 12:47:05 UTC 2021 - Josef Reidinger <jreidinger@suse.com>

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


Name: yast2-bootloader
Version: 4.3.25
Version: 4.3.26
Release: 0
Summary: YaST2 - Bootloader Configuration
License: GPL-2.0-or-later
Expand Down
12 changes: 9 additions & 3 deletions src/lib/bootloader/grub2_widgets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def label

def items
::Bootloader::CpuMitigations::ALL.map do |m|
[m.value, m.to_human_string]
[m.value.to_s, m.to_human_string]
end
end

Expand Down Expand Up @@ -159,11 +159,17 @@ def help
end

def init
self.value = grub2.cpu_mitigations.value
if grub2.respond_to?(:cpu_mitigations)
self.value = grub2.cpu_mitigations.value.to_s
else
# do not crash when use no bootloader. This widget is also used in security dialog.
# (bsc#1184968)
disable
end
end

def store
grub2.cpu_mitigations = ::Bootloader::CpuMitigations.new(value)
grub2.cpu_mitigations = ::Bootloader::CpuMitigations.new(value.to_sym) if enabled?
end
end

Expand Down
32 changes: 32 additions & 0 deletions test/grub2_widgets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,38 @@ def stub_widget_value(id, value)
end
end

describe Bootloader::CpuMitigationsWidget do
before do
assign_bootloader
end

it_behaves_like "labeled widget"
it_behaves_like "CWM::ComboBox"

context "when none bootloader is selected" do
before do
assign_bootloader("none")
end

describe "#init" do
it "disables widget" do
expect(subject).to receive(:disable)

subject.init
end
end

describe "#store" do
it "does nothing on disabled widget" do
expect(subject).to receive(:enabled?).and_return(false)
expect(subject).to_not receive(:value)

subject.store
end
end
end
end

describe Bootloader::ActivateWidget do
before do
assign_bootloader
Expand Down