diff --git a/library/network/src/modules/NetworkInterfaces.rb b/library/network/src/modules/NetworkInterfaces.rb index 158735314..96d5ae688 100644 --- a/library/network/src/modules/NetworkInterfaces.rb +++ b/library/network/src/modules/NetworkInterfaces.rb @@ -686,6 +686,7 @@ def get_devices(devregex = "[~]") devices = SCR.Dir(path(".network.section")) || [] devices.select! { |file| file !~ /#{devregex}/ } unless devregex.nil? && devregex.empty? + devices.delete_if(&:empty?) log.debug "devices=#{devices}" devices diff --git a/library/network/test/data/etc/sysconfig/network/ifcfg- b/library/network/test/data/etc/sysconfig/network/ifcfg- new file mode 100644 index 000000000..78e77911c --- /dev/null +++ b/library/network/test/data/etc/sysconfig/network/ifcfg- @@ -0,0 +1,2 @@ +STARTMODE="auto" +BOOTPROTO="dhcp" diff --git a/library/network/test/network_interfaces_helpers_test.rb b/library/network/test/network_interfaces_helpers_test.rb index baf3bdc61..b2adc6eaa 100755 --- a/library/network/test/network_interfaces_helpers_test.rb +++ b/library/network/test/network_interfaces_helpers_test.rb @@ -115,6 +115,14 @@ module Yast expect(subject.get_devices("")).to eql devices end + it "does not crash with exception" do + expect { subject.get_devices }.not_to raise_error + end + + it "doesn't carry empty strings" do + expect(subject.get_devices).not_to include "" + end + end describe "#canonicalize_config" do diff --git a/package/yast2.changes b/package/yast2.changes index f88919712..f2b041440 100644 --- a/package/yast2.changes +++ b/package/yast2.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Thu Jan 5 11:35:23 UTC 2017 - mfilka@suse.com + +- bnc#1017716 + - do not cache ifcfg files with empty device name part (ifcfg-). + Such file cannot be mapped to any existing device and providing + empty device name could lead to unexpected crashes in other + parts of yast. +- 3.2.11 + ------------------------------------------------------------------- Thu Jan 5 08:06:25 UTC 2017 - lslezak@suse.cz diff --git a/package/yast2.spec b/package/yast2.spec index 6cea4476a..cdd56503a 100644 --- a/package/yast2.spec +++ b/package/yast2.spec @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.10 +Version: 3.2.11 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0