Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2019-05-10 09:12:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Fri May 10 09:12:27 2019 rev:454 rq:701330 version:4.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2019-05-05 21:17:05.784570590 +0200 +++ /work/SRC/openSUSE:Factory/.yast2.new.5148/yast2.changes 2019-05-10 09:12:31.375501738 +0200 @@ -1,0 +2,6 @@ +Tue May 7 13:10:46 UTC 2019 - Steffen Winterfeldt <[email protected]> + +- give more verbose feedback in 'view_anymsg' client (bsc#1132658) +- 4.2.2 + +------------------------------------------------------------------- Old: ---- yast2-4.2.1.tar.bz2 New: ---- yast2-4.2.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.kdnjDG/_old 2019-05-10 09:12:32.115503851 +0200 +++ /var/tmp/diff_new_pack.kdnjDG/_new 2019-05-10 09:12:32.119503863 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.2.1 +Version: 4.2.2 Release: 0 Summary: YaST2 Main Package License: GPL-2.0-only ++++++ yast2-4.2.1.tar.bz2 -> yast2-4.2.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.1/library/system/src/lib/yast2/clients/view_anymsg.rb new/yast2-4.2.2/library/system/src/lib/yast2/clients/view_anymsg.rb --- old/yast2-4.2.1/library/system/src/lib/yast2/clients/view_anymsg.rb 2019-04-30 15:12:11.000000000 +0200 +++ new/yast2-4.2.2/library/system/src/lib/yast2/clients/view_anymsg.rb 2019-05-07 15:45:11.000000000 +0200 @@ -111,22 +111,63 @@ private - def start_journal? - return false unless [nil, 0, -1].include?(FileUtils.GetSize(selected_filename)) - - res = Yast2::Popup.show( - _( - "Selected log file does not exist or is empty.\n" \ - "Many system components now log into systemd journal.\n" \ - "Do you want to start YaST module for systemd journal?" - ), - buttons: :yes_no, - focus: :no - ) == :yes + # Helper method to assess file status. + # + # Return one of :ok, :empty, :missing, :no_file, :no_access. + # + def file_state(file) + begin + File.stat(file) + rescue Errno::EACCES + return :no_access + rescue Errno::ENOENT + return :missing + rescue + nil + end + return :no_access if !File.readable?(file) + return :no_file if !File.file?(file) + return :empty if !File.size?(file) + :ok + end - return false unless res + # Decide whether to read the log file or to start the 'journal' module instead. + # + # If the log can't be read, show some popups indicating the cause. + # + # Return true if the 'journal' module should be started. + # + def start_journal? + case file_state(selected_filename) + when :ok then + false + when :empty then + Yast2::Popup.show(_("The selected log file is empty.")) + false + when :no_file then + Yast2::Popup.show(_("The selected item is not a file.")) + false + when :no_access then + Yast2::Popup.show( + _( + "You do not have permission to read the selected log file.\n\n" \ + "Run this YaST module as user 'root'." + ) + ) + false + when :missing then + res = Yast2::Popup.show( + _( + "The selected log file does not exist.\n\n" \ + "Many system components log into the systemd journal.\n" \ + "Do you want to start the YaST module for reading the systemd journal?" + ), + buttons: :yes_no, + focus: :no + ) == :yes - Package.Install("yast2-journal") + res && Package.Install("yast2-journal") + end end def dialog_content diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.1/library/system/test/clients/view_anymsg_test.rb new/yast2-4.2.2/library/system/test/clients/view_anymsg_test.rb --- old/yast2-4.2.1/library/system/test/clients/view_anymsg_test.rb 2019-04-30 15:12:11.000000000 +0200 +++ new/yast2-4.2.2/library/system/test/clients/view_anymsg_test.rb 2019-05-07 15:45:11.000000000 +0200 @@ -24,8 +24,6 @@ # WFM mock allow(Yast::WFM).to receive(:Args).and_return([]) allow(Yast::WFM).to receive(:CallFunction) - - allow(Yast::FileUtils).to receive(:GetSize).and_return(1) end it "returns true" do @@ -178,15 +176,15 @@ end end - context "log file does not exist or is empty" do + context "log file does not exist" do before do - allow(Yast::FileUtils).to receive(:GetSize).and_return(-1) allow(Yast::Package).to receive(:Install).and_return(true) allow(Yast2::Popup).to receive(:show).and_return(:yes) + allow_any_instance_of(Yast::ViewAnymsgClient).to receive(:file_state).and_return(:missing) end - it "ask if open journal instead" do - expect(Yast2::Popup).to receive(:show).and_return(:no) + it "ask to open journal instead" do + expect(Yast2::Popup).to receive(:show).with(/does not exist/, any_args) subject.main end @@ -197,11 +195,50 @@ subject.main end - it "switches to yast2-journal module if user want and all goes well" do + it "switches to yast2-journal module if user wants it and all goes well" do expect(Yast::WFM).to receive(:CallFunction).with("journal") subject.main end + end + + context "log file is empty" do + before do + allow(Yast2::Popup).to receive(:show).and_return(:yes) + allow_any_instance_of(Yast::ViewAnymsgClient).to receive(:file_state).and_return(:empty) + end + + it "inform that log is empty" do + expect(Yast2::Popup).to receive(:show).with(/empty/) + + subject.main + end + end + + context "log file is not a regular file" do + before do + allow(Yast2::Popup).to receive(:show).and_return(:yes) + allow_any_instance_of(Yast::ViewAnymsgClient).to receive(:file_state).and_return(:no_file) + end + + it "inform that log is not a file" do + expect(Yast2::Popup).to receive(:show).with(/not a file/) + + subject.main + end + end + + context "no permissions for log file" do + before do + allow(Yast2::Popup).to receive(:show).and_return(:yes) + allow_any_instance_of(Yast::ViewAnymsgClient).to receive(:file_state).and_return(:no_access) + end + + it "inform that log is not readable" do + expect(Yast2::Popup).to receive(:show).with(/not have permission/) + + subject.main + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.1/package/yast2.changes new/yast2-4.2.2/package/yast2.changes --- old/yast2-4.2.1/package/yast2.changes 2019-04-30 15:12:11.000000000 +0200 +++ new/yast2-4.2.2/package/yast2.changes 2019-05-07 15:45:11.000000000 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue May 7 13:10:46 UTC 2019 - Steffen Winterfeldt <[email protected]> + +- give more verbose feedback in 'view_anymsg' client (bsc#1132658) +- 4.2.2 + +------------------------------------------------------------------- Fri Apr 26 08:38:39 UTC 2019 - Ladislav Slezák <[email protected]> - Uninstall the "SUSE-Manager-Proxy" product when upgrading from diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-4.2.1/package/yast2.spec new/yast2-4.2.2/package/yast2.spec --- old/yast2-4.2.1/package/yast2.spec 2019-04-30 15:12:11.000000000 +0200 +++ new/yast2-4.2.2/package/yast2.spec 2019-05-07 15:45:11.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2 -Version: 4.2.1 +Version: 4.2.2 Release: 0 Summary: YaST2 Main Package License: GPL-2.0-only
