Hello community,

here is the log from the commit of package yast2-bootloader for 
openSUSE:Factory checked in at 2019-02-11 21:18:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-bootloader (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-bootloader.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-bootloader"

Mon Feb 11 21:18:39 2019 rev:271 rq:672737 version:4.1.16

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-bootloader/yast2-bootloader.changes        
2019-02-04 16:08:10.098057122 +0100
+++ 
/work/SRC/openSUSE:Factory/.yast2-bootloader.new.28833/yast2-bootloader.changes 
    2019-02-11 21:18:40.799295987 +0100
@@ -1,0 +2,12 @@
+Fri Feb  8 08:47:35 UTC 2019 - [email protected]
+
+- Improve the layout of "Boot Code Options" tab (bsc#1120793)
+- 4.1.16
+
+-------------------------------------------------------------------
+Wed Feb  6 14:02:48 UTC 2019 - Stefan Hundhammer <[email protected]>
+
+- Improved error message for broken by-path device names (bsc#1122008)
+- 4.1.15
+
+-------------------------------------------------------------------

Old:
----
  yast2-bootloader-4.1.14.tar.bz2

New:
----
  yast2-bootloader-4.1.16.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-bootloader.spec ++++++
--- /var/tmp/diff_new_pack.IhAKLi/_old  2019-02-11 21:18:41.487295620 +0100
+++ /var/tmp/diff_new_pack.IhAKLi/_new  2019-02-11 21:18:41.491295619 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.1.14
+Version:        4.1.16
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-bootloader-4.1.14.tar.bz2 -> yast2-bootloader-4.1.16.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.14/package/yast2-bootloader.changes 
new/yast2-bootloader-4.1.16/package/yast2-bootloader.changes
--- old/yast2-bootloader-4.1.14/package/yast2-bootloader.changes        
2019-01-28 15:08:51.000000000 +0100
+++ new/yast2-bootloader-4.1.16/package/yast2-bootloader.changes        
2019-02-08 11:18:31.000000000 +0100
@@ -1,4 +1,16 @@
 -------------------------------------------------------------------
+Fri Feb  8 08:47:35 UTC 2019 - [email protected]
+
+- Improve the layout of "Boot Code Options" tab (bsc#1120793)
+- 4.1.16
+
+-------------------------------------------------------------------
+Wed Feb  6 14:02:48 UTC 2019 - Stefan Hundhammer <[email protected]>
+
+- Improved error message for broken by-path device names (bsc#1122008)
+- 4.1.15
+
+-------------------------------------------------------------------
 Fri Jan 25 10:13:29 UTC 2019 - [email protected]
 
 - Fit the "Boot Code Options" tab to full width even when there only
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.14/package/yast2-bootloader.spec 
new/yast2-bootloader-4.1.16/package/yast2-bootloader.spec
--- old/yast2-bootloader-4.1.14/package/yast2-bootloader.spec   2019-01-28 
15:08:51.000000000 +0100
+++ new/yast2-bootloader-4.1.16/package/yast2-bootloader.spec   2019-02-08 
11:18:31.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-bootloader
-Version:        4.1.14
+Version:        4.1.16
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.14/src/lib/bootloader/exceptions.rb 
new/yast2-bootloader-4.1.16/src/lib/bootloader/exceptions.rb
--- old/yast2-bootloader-4.1.14/src/lib/bootloader/exceptions.rb        
2019-01-28 15:08:51.000000000 +0100
+++ new/yast2-bootloader-4.1.16/src/lib/bootloader/exceptions.rb        
2019-02-08 11:18:31.000000000 +0100
@@ -26,6 +26,27 @@
     end
   end
 
+  # Specialized exception for invalid by-path device names
+  # (bsc#1122008, bsc#1116305)
+  class BrokenByPathDeviceName < RuntimeError
+    include Yast::I18n
+    attr_reader :dev_name
+
+    def initialize(dev_name)
+      @dev_name = dev_name
+      textdomain "bootloader"
+
+      # TRANSLATORS: %s is the device name
+      super _("Error reading the bootloader configuration files:\n" \
+        "Invalid device name %s\n" \
+        "\n" \
+        "This by-path device name may have changed after a reboot\n" \
+        "if the hardware or kernel parameters changed.\n" \
+        "\n" \
+        "Please use YaST2 bootloader to fix this.\n") % dev_name
+    end
+  end
+
   # Represent unsupported value in given option. Used mainly when value 
contain something that
   # bootloader does not understand yet.
   class UnsupportedOption < RuntimeError
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-bootloader-4.1.14/src/lib/bootloader/grub2_widgets.rb 
new/yast2-bootloader-4.1.16/src/lib/bootloader/grub2_widgets.rb
--- old/yast2-bootloader-4.1.14/src/lib/bootloader/grub2_widgets.rb     
2019-01-28 15:08:51.000000000 +0100
+++ new/yast2-bootloader-4.1.16/src/lib/bootloader/grub2_widgets.rb     
2019-02-08 11:18:31.000000000 +0100
@@ -703,7 +703,6 @@
       textdomain "bootloader"
 
       VBox(
-        VSpacing(1),
         Frame(
           _("Boot Loader Location"),
           HBox(
@@ -870,8 +869,16 @@
 
     def contents
       VBox(
-        Left(LoaderTypeWidget.new),
+        VSpacing(1),
+        HBox(
+          HSpacing(1),
+          Left(LoaderTypeWidget.new)
+        ),
+        VSpacing(1),
         *widgets,
+        VSpacing(1),
+        pmbr_widget,
+        device_map_button,
         VStretch()
       )
     end
@@ -889,14 +896,28 @@
 
       w << SecureBootWidget.new if secure_boot_widget?
       w << TrustedBootWidget.new if trusted_boot_widget?
-      w << PMBRWidget.new if pmbr_widget?
-      w << DeviceMapWidget.new if device_map_button?
 
       w.map do |widget|
-        MarginBox(1, 0.5, Left(widget))
+        MarginBox(horizontal_margin, 0, Left(widget))
       end
     end
 
+    def pmbr_widget
+      return Empty() unless pmbr_widget?
+
+      MarginBox(1, 0, Left(PMBRWidget.new))
+    end
+
+    def device_map_button
+      return Empty() unless device_map_button?
+
+      MarginBox(1, 0, Left(DeviceMapWidget.new))
+    end
+
+    def horizontal_margin
+      @horizontal_margin ||= Yast::UI.TextMode ? 1 : 1.5
+    end
+
     def loader_location_widget?
       (Yast::Arch.x86_64 || Yast::Arch.i386 || Yast::Arch.ppc) && grub2.name 
== "grub2"
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.1.14/src/modules/BootStorage.rb 
new/yast2-bootloader-4.1.16/src/modules/BootStorage.rb
--- old/yast2-bootloader-4.1.14/src/modules/BootStorage.rb      2019-01-28 
15:08:51.000000000 +0100
+++ new/yast2-bootloader-4.1.16/src/modules/BootStorage.rb      2019-02-08 
11:18:31.000000000 +0100
@@ -72,8 +72,7 @@
     # @return [Array<String>] gpt disks only
     def gpt_disks(devices)
       targets = devices.map do |dev_name|
-        staging.find_by_any_name(dev_name) or
-          raise ::Bootloader::BrokenConfiguration, "Unknown device #{dev_name}"
+        staging.find_by_any_name(dev_name) or handle_unknown_device(dev_name)
       end
       boot_disks = targets.each_with_object([]) { |t, r| 
r.concat(stage1_disks_for(t)) }
 
@@ -140,7 +139,7 @@
     # @return [Array<Y2Storage::Device>] list of suitable devices
     def stage1_devices_for_name(dev_name)
       device = staging.find_by_any_name(dev_name)
-      raise ::Bootloader::BrokenConfiguration, "unknown device #{dev_name}" 
unless device
+      handle_unknown_device(dev_name) unless device
 
       if device.is?(:partition) || device.is?(:filesystem)
         stage1_partitions_for(device)
@@ -275,6 +274,25 @@
       end
       results
     end
+
+    # Handle an "unknown device" error: Raise an appropriate exception.
+    # @param dev_name [String]
+    def handle_unknown_device(dev_name)
+      # rubocop:disable Style/GuardClause
+      #
+      # I flatly refuse to make my code LESS readable because of a third-rate
+      # check tool. This is the CLASSIC use case for if...else, even if this
+      # mindless rubocop thinks otherwise.
+      #
+      # 2019-02-06 shundhammer
+
+      if dev_name =~ %r{/by-path/} # bsc#1122008, bsc#1116305
+        raise ::Bootloader::BrokenByPathDeviceName, dev_name
+      else
+        raise ::Bootloader::BrokenConfiguration, "Unknown device #{dev_name}"
+      end
+      # rubocop:enable Style/GuardClause
+    end
   end
 
   BootStorage = BootStorageClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-bootloader-4.1.14/test/boot_storage_test.rb 
new/yast2-bootloader-4.1.16/test/boot_storage_test.rb
--- old/yast2-bootloader-4.1.14/test/boot_storage_test.rb       2019-01-28 
15:08:51.000000000 +0100
+++ new/yast2-bootloader-4.1.16/test/boot_storage_test.rb       2019-02-08 
11:18:31.000000000 +0100
@@ -54,14 +54,25 @@
   end
 
   describe ".stage1_devices_for_name" do
-    it "raises BrokenConfiguration exception if gets unknown name" do
-      # mock staging graph as graph does not return proper value when run as 
non-root
+    before do
       allow(subject.staging).to receive(:find_by_any_name).and_return(nil)
+    end
+
+    it "raises a BrokenConfiguration exception if gets an unknown name" do
+      # mock staging graph as graph does not return proper value when run as 
non-root
 
       expect { subject.stage1_devices_for_name("/dev/non-existing") }.to(
         raise_error(::Bootloader::BrokenConfiguration)
       )
     end
+
+    it "raises a BrokenByPathDeviceName exception if gets an unknown by-path 
device name" do
+      # mock staging graph as graph does not return proper value when run as 
non-root
+
+      expect { 
subject.stage1_devices_for_name("/dev/disk/by-path/non-existing") }.to(
+        raise_error(::Bootloader::BrokenByPathDeviceName)
+      )
+    end
   end
 
   describe ".boot_disks" do


Reply via email to