Hello community,

here is the log from the commit of package yast2 for openSUSE:Factory checked 
in at 2018-03-14 19:34:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2 (Old)
 and      /work/SRC/openSUSE:Factory/.yast2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2"

Wed Mar 14 19:34:02 2018 rev:422 rq:586019 version:4.0.59

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2/yast2.changes      2018-03-11 
18:02:02.917851759 +0100
+++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2018-03-14 
19:34:03.871800709 +0100
@@ -1,0 +2,8 @@
+Fri Mar  9 11:51:07 UTC 2018 - [email protected]
+
+- Fix extracting kernel parameters from installation when there is
+  parameter with '=' in value like
+  pci=hpiosize=0,hpmemsize=0,nobar (bsc#1081353)
+- 4.0.59
+
+-------------------------------------------------------------------

Old:
----
  yast2-4.0.58.tar.bz2

New:
----
  yast2-4.0.59.tar.bz2

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

Other differences:
------------------
++++++ yast2.spec ++++++
--- /var/tmp/diff_new_pack.iRNmMD/_old  2018-03-14 19:34:04.735770025 +0100
+++ /var/tmp/diff_new_pack.iRNmMD/_new  2018-03-14 19:34:04.747769599 +0100
@@ -17,10 +17,10 @@
 
 
 Name:           yast2
-Version:        4.0.58
+Version:        4.0.59
 Release:        0
 Summary:        YaST2 - Main Package
-License:        GPL-2.0-only
+License:        GPL-2.0
 Group:          System/YaST
 Url:            https://github.com/yast/yast-yast2
 Source0:        %{name}-%{version}.tar.bz2

++++++ yast2-4.0.58.tar.bz2 -> yast2-4.0.59.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.0.58/library/system/src/modules/Kernel.rb 
new/yast2-4.0.59/library/system/src/modules/Kernel.rb
--- old/yast2-4.0.58/library/system/src/modules/Kernel.rb       2018-03-07 
11:17:47.000000000 +0100
+++ new/yast2-4.0.59/library/system/src/modules/Kernel.rb       2018-03-12 
11:12:43.000000000 +0100
@@ -161,92 +161,11 @@
       nil
     end
 
-    # @param   cmdline string
-    #
-    # @return  [void]
-    # Filters out yast2 specific boot parameters and sets
-    # Parameters to the important cmdline parts.
-    def ExtractCmdlineParameters(line)
-      # discard \n
-      line = Builtins.deletechars(line, "\n")
-
-      # list of parameters to be discarded (yast internals)
-
-      discardlist = []
-
-      cmdlist = []
-
-      parse_index = 0
-      in_quotes = false
-      after_backslash = false
-      current_param = ""
-      while Ops.less_than(parse_index, Builtins.size(line))
-        current_char = Builtins.substring(line, parse_index, 1)
-        in_quotes = !in_quotes if current_char == "\"" && !after_backslash
-        if current_char == " " && !in_quotes
-          cmdlist = Builtins.add(cmdlist, current_param)
-          current_param = ""
-        else
-          current_param = Ops.add(current_param, current_char)
-        end
-        after_backslash = current_char == "\\"
-        parse_index = Ops.add(parse_index, 1)
-      end
-      cmdlist = Builtins.add(cmdlist, current_param)
-
-      #        this is wrong because of eg. >>o="p a r a m"<<, see bugzilla 
26147
-      #        list cmdlist = splitstring (line, " ");
-
-      # some systems (pseries) can autodetect the serial console
-      if Builtins.contains(cmdlist, "AUTOCONSOLE")
-        discardlist = Builtins.add(discardlist, "console")
-        discardlist = Builtins.add(discardlist, "AUTOCONSOLE")
-      end
-
-      # add special key filtering for s390
-      # bnc#462276 Extraneous parameters in /etc/zipl.conf from the installer
-      if Arch.s390
-        discardlist = Builtins.add(discardlist, "User")
-        discardlist = Builtins.add(discardlist, "init")
-        discardlist = Builtins.add(discardlist, "ramdisk_size")
-      end
-
-      # get rid of live-installer-specific parameters
-      if Mode.live_installation
-        discardlist.push("initrd", "ramdisk_size", "ramdisk_blocksize", 
"liveinstall", "splash", "quiet", "lang")
-      end
-
-      # backdoor to re-enable update on UL/SLES
-      if Builtins.contains(cmdlist, "suse_update")
-        discardlist = Builtins.add(discardlist, "suse_update")
-        @suse_update = true
-      end
-
-      Builtins.foreach(cmdlist) do |parameter|
-        # split "key=value" to ["key", "value"]
-        param_value_list = Builtins.splitstring(parameter, "=")
-        key = Ops.get(param_value_list, 0, "")
-        value = Ops.get(param_value_list, 1, "")
-        # now only collect keys not in discardlist
-        if Ops.greater_than(Builtins.size(param_value_list), 0)
-          if !Builtins.contains(discardlist, key)
-            if Ops.get(param_value_list, 0, "") == "vga"
-              if Builtins.regexpmatch(value, "^(0x)?[0-9a-fA-F]+$") ||
-                  Builtins.contains(["normal", "ext", "ask"], value)
-                @vgaType = value
-              else
-                Builtins.y2warning("Incorrect VGA kernel parameter: %1", value)
-              end
-            else
-              AddCmdLine(key, value)
-            end
-          end
-        end
-      end
-
-      nil
-    end
-
+    # Parse the installation-time kernel command line
+    # - the `vga` parameter is separated, see {#GetVgaType}
+    # - some specific parameters are ignored
+    # - the rest is passed on to @cmdLine for which {#GetCmdLine} is a reader
+    # @return [void]
     def ParseInstallationKernelCmdline
       @cmdline_parsed = true
       return if !(Stage.initial || Stage.cont)
@@ -278,22 +197,6 @@
       @vgaType
     end
 
-    # Set the vga= kernel argument
-    # FIXME: is heer because of bootloader module, should be removed
-    def SetVgaType(new_vga)
-      ParseInstallationKernelCmdline() if !@cmdline_parsed
-      @vgaType = new_vga
-
-      nil
-    end
-
-    # Check if suse_update kernel command line argument was passed
-    # @return [Boolean] true if it was
-    def GetSuSEUpdate
-      ParseInstallationKernelCmdline() if !@cmdline_parsed
-      @suse_update
-    end
-
     # Get the kernel command line
     # @return [String] the command line
     def GetCmdLine
@@ -301,15 +204,6 @@
       @cmdLine
     end
 
-    # Set the kernel command line
-    # FIXME: is heer because of bootloader module, should be removed
-    def SetCmdLine(new_cmd_line)
-      ParseInstallationKernelCmdline() if !@cmdline_parsed
-      @cmdLine = new_cmd_line
-
-      nil
-    end
-
     # Simple check any graphical desktop was selected
     def IsGraphicalDesktop
       # Get patterns set for installation during desktop selection
@@ -661,6 +555,28 @@
       @inform_about_kernel_change
     end
 
+    publish function: :AddCmdLine, type: "void (string, string)"
+    publish function: :GetVgaType, type: "string ()"
+    publish function: :GetCmdLine, type: "string ()"
+    publish function: :ProbeKernel, type: "void ()"
+    publish function: :SetPackages, type: "void (list <string>)"
+    publish function: :GetBinary, type: "string ()"
+    publish function: :GetPackages, type: "list <string> ()"
+    publish function: :ComputePackage, type: "string ()"
+    publish function: :GetFinalKernel, type: "string ()"
+    publish function: :ComputePackagesForBase, type: "list <string> (string, 
boolean)"
+    publish function: :ComputePackages, type: "list <string> ()"
+    publish function: :SetInformAboutKernelChange, type: "void (boolean)"
+    publish function: :GetInformAboutKernelChange, type: "boolean ()"
+    publish function: :InformAboutKernelChange, type: "boolean ()"
+
+    # Handling for Kernel modules loaded on boot
+    publish function: :AddModuleToLoad, type: "void (string)"
+    publish function: :RemoveModuleToLoad, type: "void (string)"
+    publish function: :SaveModulesToLoad, type: "boolean ()"
+    publish function: :reset_modules_to_load, type: "void ()"
+    publish function: :modules_to_load, type: "map <string, list> ()"
+
   private
 
     # Registers new SCR agent for a file given as parameter
@@ -731,30 +647,97 @@
       @modules_to_load
     end
 
-    publish function: :AddCmdLine, type: "void (string, string)"
-    publish function: :GetVgaType, type: "string ()"
-    publish function: :SetVgaType, type: "void (string)"
-    publish function: :GetSuSEUpdate, type: "boolean ()"
-    publish function: :GetCmdLine, type: "string ()"
-    publish function: :SetCmdLine, type: "void (string)"
-    publish function: :ProbeKernel, type: "void ()"
-    publish function: :SetPackages, type: "void (list <string>)"
-    publish function: :GetBinary, type: "string ()"
-    publish function: :GetPackages, type: "list <string> ()"
-    publish function: :ComputePackage, type: "string ()"
-    publish function: :GetFinalKernel, type: "string ()"
-    publish function: :ComputePackagesForBase, type: "list <string> (string, 
boolean)"
-    publish function: :ComputePackages, type: "list <string> ()"
-    publish function: :SetInformAboutKernelChange, type: "void (boolean)"
-    publish function: :GetInformAboutKernelChange, type: "boolean ()"
-    publish function: :InformAboutKernelChange, type: "boolean ()"
+    # @param [String] line to parse
+    # @return [Array<String>] line splitted to individual params, respecting 
quotes there
+    def list_of_params(line)
+      line = line.delete("\n")
+      cmdlist = []
+      parse_index = 0
+      in_quotes = false
+      after_backslash = false
+      current_param = ""
+      while parse_index < line.size
+        current_char = line[parse_index]
+        in_quotes = !in_quotes if current_char == "\"" && !after_backslash
+        if current_char == " " && !in_quotes
+          cmdlist << current_param
+          current_param = ""
+        else
+          current_param << current_char
+        end
+        # For the in-kernel parser, a backslash is a regular character.
+        # For this parser, it is a "stupid escape": the first backslash
+        # does not escape the second one.
+        after_backslash = current_char == "\\"
+        parse_index += 1
+      end
+      cmdlist << current_param
+    end
 
-    # Handling for Kernel modules loaded on boot
-    publish function: :AddModuleToLoad, type: "void (string)"
-    publish function: :RemoveModuleToLoad, type: "void (string)"
-    publish function: :SaveModulesToLoad, type: "boolean ()"
-    publish function: :reset_modules_to_load, type: "void ()"
-    publish function: :modules_to_load, type: "map <string, list> ()"
+    S390_ZIPL_ARGS = ["User", "init", "ramdisk_size"].freeze
+    # constructs list of keys to discard from command line
+    # @param [Array<String>] list of command line entries
+    # @return [Array<String>] list of keys to discard
+    def params_to_discard(cmdlist)
+      discardlist = []
+      # some systems (pseries) can autodetect the serial console
+      if cmdlist.include?("AUTOCONSOLE")
+        # Note:  `console` is the only value that depends on the input 
argument.
+        discardlist << "console"
+        discardlist << "AUTOCONSOLE"
+      end
+
+      # add special key filtering for s390
+      # bnc#462276 Extraneous parameters in /etc/zipl.conf from the installer
+      discardlist.concat(S390_ZIPL_ARGS) if Arch.s390
+
+      # get rid of live-installer-specific parameters
+      if Mode.live_installation
+        discardlist.push("initrd", "ramdisk_size", "ramdisk_blocksize", 
"liveinstall", "splash", "quiet", "lang")
+      end
+
+      # TODO: is it still needed?
+      # backdoor to re-enable update on UL/SLES
+      if cmdlist.include?("suse_update")
+        discardlist << "suse_update"
+        @suse_update = true
+      end
+
+      discardlist
+    end
+
+    # @param   [String] cmdline to parse
+    #
+    # @return  [void]
+    # Filters out yast2 specific boot parameters and sets
+    # Parameters to the important cmdline parts.
+    def ExtractCmdlineParameters(line)
+      return unless line
+      # list of parameters to be discarded (yast internals)
+      cmdlist = list_of_params(line)
+
+      discardlist = params_to_discard(cmdlist)
+
+      cmdlist.each do |parameter|
+        next unless parameter
+        next if parameter.empty?
+        key, value = parameter.split("=", 2)
+        next unless key
+        value ||= ""
+        next if discardlist.include?(key)
+        if key == "vga"
+          if value.match?(/^(((0x)?\h+)|(ask)|(ext)|(normal))$/)
+            @vgaType = value
+          else
+            Builtins.y2warning("Incorrect VGA kernel parameter: %1", value)
+          end
+        else
+          AddCmdLine(key, value)
+        end
+      end
+
+      nil
+    end
   end
 
   Kernel = KernelClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.0.58/library/system/test/kernel_test.rb 
new/yast2-4.0.59/library/system/test/kernel_test.rb
--- old/yast2-4.0.58/library/system/test/kernel_test.rb 2018-03-07 
11:17:47.000000000 +0100
+++ new/yast2-4.0.59/library/system/test/kernel_test.rb 2018-03-12 
11:12:43.000000000 +0100
@@ -8,11 +8,13 @@
 Yast.import "Kernel"
 Yast.import "FileUtils"
 
-describe "Kernel" do
+describe Yast::Kernel do
   let(:stubbed_modules_dir) { File.join(File.dirname(__FILE__), "data", 
"modules.d") }
 
   before do
     log.info "--- test ---"
+    # reset variables
+    subject.main
     stub_const("Yast::KernelClass::MODULES_DIR", stubbed_modules_dir)
     @default_modules = {
       Yast::KernelClass::MODULES_CONF_FILE => [],
@@ -147,4 +149,86 @@
       end
     end
   end
+
+  describe ".ParseInstallationKernelCmdline" do
+    before do
+      allow(Yast::SCR).to 
receive(:Read).with(path(".etc.install_inf.Cmdline")).and_return(cmdline)
+      allow(Yast::Stage).to receive(:initial).and_return(true)
+      allow(Yast::Arch).to receive(:architecture).and_return("x86_64")
+    end
+
+    context "for common options" do
+      let(:cmdline) { "splash=verbose silent" }
+
+      it "adds options to CmdLine" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetCmdLine).to eq " splash=verbose silent"
+      end
+    end
+
+    context "when command line contain newline" do
+      let(:cmdline) { "splash=verbose silent\n" }
+
+      it "deletes this newline from CmdLine" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetCmdLine).to eq " splash=verbose silent"
+      end
+    end
+
+    context "when command line contain vga= key" do
+      let(:cmdline) { "vga=ask splash=verbose silent\n" }
+
+      it "deletes vga parameter from CmdLine" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetCmdLine).to eq " splash=verbose silent"
+      end
+
+      it "sets vgaType" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetVgaType).to eq "ask"
+      end
+    end
+
+    context "when command line value including quotes" do
+      let(:cmdline) { " splash=\"verbose, silent\" text=abc\n" }
+
+      it "it adds it to CmdLine correctly" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetCmdLine).to eq " splash=\"verbose, silent\" text=abc"
+      end
+    end
+
+    # FIXME: we do backslash escapes but in fact
+    # the kernel does not care about any backslashes, only about double quotes
+    context "when command line value including escaped quotes" do
+      let(:cmdline) { " splash=\"verbose\\\", silent\" text=\\\"abc\n" }
+
+      it "it adds it to CmdLine correctly" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetCmdLine).to eq " splash=\"verbose\\\", silent\" 
text=\\\"abc"
+      end
+    end
+
+    context "when value of parameter contain '='" do
+      let(:cmdline) { " splash=verbose silent 
pci=hpiosize=0,hpmemsize=0,nobar\n" }
+
+      it "it adds it to CmdLine correctly" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetCmdLine).to eq " splash=verbose silent 
pci=hpiosize=0,hpmemsize=0,nobar"
+      end
+    end
+
+    context "when there is special characters for filter on s390" do
+      let(:cmdline) { " splash=verbose silent User=root init=5 
ramdisk_size=5G\n" }
+
+      before do
+        allow(Yast::Arch).to receive(:architecture).and_return("s390_64")
+      end
+
+      it "it filters it out of CmdLine" do
+        subject.ParseInstallationKernelCmdline
+        expect(subject.GetCmdLine).to eq " splash=verbose silent"
+      end
+    end
+  end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.0.58/package/yast2.changes 
new/yast2-4.0.59/package/yast2.changes
--- old/yast2-4.0.58/package/yast2.changes      2018-03-07 11:17:47.000000000 
+0100
+++ new/yast2-4.0.59/package/yast2.changes      2018-03-12 11:12:43.000000000 
+0100
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Fri Mar  9 11:51:07 UTC 2018 - [email protected]
+
+- Fix extracting kernel parameters from installation when there is
+  parameter with '=' in value like
+  pci=hpiosize=0,hpmemsize=0,nobar (bsc#1081353)
+- 4.0.59
+
+-------------------------------------------------------------------
 Wed Mar  7 07:12:27 UTC 2018 - [email protected]
 
 - Use the correct release notes URL during upgrade (bsc#1073488).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-4.0.58/package/yast2.spec 
new/yast2-4.0.59/package/yast2.spec
--- old/yast2-4.0.58/package/yast2.spec 2018-03-07 11:17:47.000000000 +0100
+++ new/yast2-4.0.59/package/yast2.spec 2018-03-12 11:12:43.000000000 +0100
@@ -16,7 +16,7 @@
 #
 
 Name:           yast2
-Version:        4.0.58
+Version:        4.0.59
 Release:        0
 Summary:        YaST2 - Main Package
 License:        GPL-2.0


Reply via email to