Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2016-11-25 12:04:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2016-11-03 12:55:15.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2016-11-25 12:04:43.000000000 +0100 @@ -1,0 +2,14 @@ +Tue Nov 22 12:30:06 UTC 2016 - igonzalezs...@suse.com + +- Do not crash when removing an entry from the /etc/hosts file + (bsc#1010994) +- 3.2.11 + +------------------------------------------------------------------- +Tue Nov 22 11:34:08 UTC 2016 - jreidin...@suse.com + +- do not crash when on command line is passed non-number id + (bsc#1003908) +- 3.2.10 + +------------------------------------------------------------------- Old: ---- yast2-network-3.2.9.tar.bz2 New: ---- yast2-network-3.2.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.vSuwdp/_old 2016-11-25 12:04:45.000000000 +0100 +++ /var/tmp/diff_new_pack.vSuwdp/_new 2016-11-25 12:04:45.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.2.9 +Version: 3.2.11 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-network-3.2.9.tar.bz2 -> yast2-network-3.2.11.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.9/package/yast2-network.changes new/yast2-network-3.2.11/package/yast2-network.changes --- old/yast2-network-3.2.9/package/yast2-network.changes 2016-11-01 13:07:50.000000000 +0100 +++ new/yast2-network-3.2.11/package/yast2-network.changes 2016-11-22 14:08:16.000000000 +0100 @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Tue Nov 22 12:30:06 UTC 2016 - igonzalezs...@suse.com + +- Do not crash when removing an entry from the /etc/hosts file + (bsc#1010994) +- 3.2.11 + +------------------------------------------------------------------- +Tue Nov 22 11:34:08 UTC 2016 - jreidin...@suse.com + +- do not crash when on command line is passed non-number id + (bsc#1003908) +- 3.2.10 + +------------------------------------------------------------------- Thu Oct 27 11:55:10 UTC 2016 - jreidin...@suse.com - Make network summary consistent with other summaries diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.9/package/yast2-network.spec new/yast2-network-3.2.11/package/yast2-network.spec --- old/yast2-network-3.2.9/package/yast2-network.spec 2016-11-01 13:07:50.000000000 +0100 +++ new/yast2-network-3.2.11/package/yast2-network.spec 2016-11-22 14:08:16.000000000 +0100 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.2.9 +Version: 3.2.11 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.9/src/include/network/lan/cmdline.rb new/yast2-network-3.2.11/src/include/network/lan/cmdline.rb --- old/yast2-network-3.2.9/src/include/network/lan/cmdline.rb 2016-11-01 13:07:50.000000000 +0100 +++ new/yast2-network-3.2.11/src/include/network/lan/cmdline.rb 2016-11-22 14:08:16.000000000 +0100 @@ -83,21 +83,21 @@ end def validateId(options, config) - options = deep_copy(options) - config = deep_copy(config) - if Ops.get(options, "id").nil? + if !options["id"] Report.Error(_("Use \"id\" option to determine device.")) return false end - if Ops.greater_than( - Builtins.tointeger(Ops.get(options, "id", "0")), - Ops.subtract(Builtins.size(config), 1) - ) + begin + id = Integer(options["id"]) + rescue ArgumentError + Report.Error(_("Invalid value '%s' for \"id\" option.") % options["id"]) + return false + end + + if id >= config.size Report.Error( - _( - "Value of \"id\" is out of range. Use \"list\" option to check max. value of \"id\"." - ) + _("Value of \"id\" is out of range. Use \"list\" option to check max. value of \"id\".") ) return false end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.9/src/lib/cfa/hosts.rb new/yast2-network-3.2.11/src/lib/cfa/hosts.rb --- old/yast2-network-3.2.9/src/lib/cfa/hosts.rb 2016-11-01 13:07:50.000000000 +0100 +++ new/yast2-network-3.2.11/src/lib/cfa/hosts.rb 2016-11-22 14:08:16.000000000 +0100 @@ -138,7 +138,7 @@ if entry["canonical"] == hostname aliases = aliases_for(entry) if aliases.empty? - delete_host(entry["ipaddr"]) + delete_by_ip(entry["ipaddr"]) else entry["canonical"] = aliases.first entry.delete("alias") @@ -154,7 +154,7 @@ entry.delete("alias") entry.delete("alias[]") aliases_col = entry.collection("alias") - aliases[1..-1].each do |a| + reduced_aliases.each do |a| aliases_col.add(a) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.9/test/cfa/hosts_test.rb new/yast2-network-3.2.11/test/cfa/hosts_test.rb --- old/yast2-network-3.2.9/test/cfa/hosts_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.2.11/test/cfa/hosts_test.rb 2016-11-22 14:08:16.000000000 +0100 @@ -0,0 +1,125 @@ +#!/usr/bin/env rspec + +require_relative "../test_helper" +require "cfa/hosts" +require "cfa/memory_file" + +describe CFA::Hosts do + subject(:hosts) { CFA::Hosts.new(file_handler: File) } + let(:file_path) { File.join(SCRStub::DATA_PATH, "hosts") } + + before { stub_const("CFA::Hosts::PATH", file_path) } + + describe "#hosts" do + it "returns an empty hash when data isn't loaded" do + expect(hosts.hosts).to eq({}) + end + + it "returns hosts in the /etc/hosts" do + hosts.load + all_hosts = hosts.hosts + expect(all_hosts.size).to eq(11) + expect(all_hosts["10.100.128.72"]).to eq(["pepa.labs.suse.cz pepa pepa2"]) + expect(all_hosts["10.100.128.1"]).to eq(["gw.labs.suse.cz", "gw1.labs.suse.cz gw1"]) + end + end + + describe "#host" do + before { hosts.load } + let(:ip) { "10.100.128.72" } + + it "returns the hostnames for a given IP" do + expect(hosts.host(ip)).to eq(["pepa.labs.suse.cz pepa pepa2"]) + end + + context "if a given IP is not defined" do + let(:ip) { "10.10.10.10" } + + it "returns an empty array" do + expect(hosts.host(ip)).to eq([]) + end + end + end + + describe "#delete_by_ip" do + before { hosts.load } + let(:ip) { "127.0.0.2" } + + it "returns the host names for a given IP" do + expect { hosts.delete_by_ip(ip) }.to change { hosts.host(ip) } + .from(["localhost"]).to([]) + end + + context "if a given IP is not defined" do + let(:ip) { "10.10.10.10" } + + it "returns an empty array" do + expect { hosts.delete_by_ip(ip) }.to_not change { hosts.hosts } + end + end + end + + describe "#set_entry" do + before { hosts.load } + + it "updates the entry" do + hosts.set_entry("127.0.0.1", "localhost.localdomain", ["mylocalhost"]) + expect(hosts.host("127.0.0.1")).to eq(["localhost.localdomain mylocalhost"]) + end + + context "if the entry does not exist" do + it "adds the entry" do + expect(hosts).to receive(:add_entry).with("10.10.10.10", "new-host", ["new-host.localdomain"]) + hosts.set_entry("10.10.10.10", "new-host", ["new-host.localdomain"]) + end + end + end + + describe "#add_entry" do + it "adds the entry" do + hosts.set_entry("10.10.10.10", "new-host.localdomain", ["new-host newhost"]) + expect(hosts.host("10.10.10.10")).to eq(["new-host.localdomain new-host newhost"]) + end + end + + describe "#delete_hostname" do + before { hosts.load } + + context "if the entry only has a canonical name" do + it "removes the entry" do + hosts.delete_hostname("gw.labs.suse.cz") + expect(hosts.host("10.100.128.1")).to eq([]) + end + end + + context "if the entry has some alias" do + it "sets the first alias as the hostname" do + hosts.delete_hostname("pepa.labs.suse.cz") + expect(hosts.host("10.100.128.72")).to eq(["pepa pepa2"]) + end + end + + context "given an alias" do + it "removes the alias" do + hosts.delete_hostname("pepa") + expect(hosts.host("10.100.128.72")).to eq(["pepa.labs.suse.cz pepa2"]) + end + end + end + + describe "#include_ip?" do + before { hosts.load } + + context "when the IP is defined" do + it "returns true" do + expect(hosts.include_ip?("127.0.0.1")).to eq(true) + end + end + + context "when the IP is defined" do + it "returns false" do + expect(hosts.include_ip?("10.10.10.10")).to eq(false) + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.9/test/data/hosts new/yast2-network-3.2.11/test/data/hosts --- old/yast2-network-3.2.9/test/data/hosts 2016-11-01 13:07:50.000000000 +0100 +++ new/yast2-network-3.2.11/test/data/hosts 2016-11-22 14:08:16.000000000 +0100 @@ -23,3 +23,5 @@ ff02::3 ipv6-allhosts 10.100.128.72 pepa.labs.suse.cz pepa pepa2 10.254.128.1 pepa1.labs.suse.cz pepa1 +10.100.128.1 gw.labs.suse.cz +10.100.128.1 gw1.labs.suse.cz gw1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.2.9/test/lan_cmdline_test.rb new/yast2-network-3.2.11/test/lan_cmdline_test.rb --- old/yast2-network-3.2.9/test/lan_cmdline_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.2.11/test/lan_cmdline_test.rb 2016-11-22 14:08:16.000000000 +0100 @@ -0,0 +1,42 @@ +#!/usr/bin/env rspec + +require_relative "test_helper" + +Yast.import "Report" + +class NetworkLanCmdlineIncludeClass < Yast::Module + def initialize + Yast.include self, "network/lan/cmdline.rb" + end +end + +describe "Yast::NetworkLanCmdlineInclude" do + subject { NetworkLanCmdlineIncludeClass.new } + + describe "#validateId" do + it "reports error and returns false if options missing \"id\"" do + expect(Yast::Report).to receive(:Error) + + expect(subject.validateId({}, [])).to eq false + end + + it "reports error and returns false if options \"id\" is not number" do + expect(Yast::Report).to receive(:Error) + + expect(subject.validateId({ "id" => "zzz" }, [])).to eq false + end + + it "reports error and returns false if options \"id\" do not fit config size" do + expect(Yast::Report).to receive(:Error) + + expect(subject.validateId({ "id" => "5" }, [])).to eq false + end + + it "returns true otherwise" do + expect(Yast::Report).to_not receive(:Error) + + expect(subject.validateId({ "id" => "0" }, ["0" => { "id" => "0" }])).to eq true + end + + end +end