Skip to content

Commit

Permalink
Merge pull request #275 from ancorgs/fix_cmdline_parsing
Browse files Browse the repository at this point in the history
Fix cmdline parsing to support more situations (bnc#889241)
  • Loading branch information
ancorgs committed Jul 29, 2014
2 parents 4a89d81 + 65fdf5b commit 6fe9b41
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 3 deletions.
4 changes: 2 additions & 2 deletions library/system/src/scrconf/proc_cmdline.scr
Expand Up @@ -21,8 +21,8 @@
"#\n", // comment
true, // read-only
(`List(
`String("^ \n"),
" "
`String("^ \n\t"),
`Separator(" \n\t")
))
)
)
2 changes: 2 additions & 0 deletions library/system/test/data/cmdline-newlines/proc/cmdline
@@ -0,0 +1,2 @@
initrd=initrd splash=silent
install=hd:/// biosdevname=1
1 change: 1 addition & 0 deletions library/system/test/data/cmdline-simple/proc/cmdline
@@ -0,0 +1 @@
initrd=initrd splash=silent install=hd:/// biosdevname=1
@@ -0,0 +1 @@
initrd=initrd splash=silent install=hd:/// biosdevname=1
41 changes: 41 additions & 0 deletions library/system/test/proc_cmdline_test.rb
@@ -0,0 +1,41 @@
#! /usr/bin/rspec

top_srcdir = File.expand_path("../../../..", __FILE__)
inc_dirs = Dir.glob("#{top_srcdir}/library/*/src")
ENV["Y2DIR"] = inc_dirs.join(":")

require "yast"

Yast.import "SCR"

DEFAULT_DATA_DIR = File.join(File.expand_path(File.dirname(__FILE__)), "data")

def set_root_path(directory)
root = File.join(DEFAULT_DATA_DIR, directory)
desc = Yast::WFM.SCROpen("chroot=#{root}:scr", false)
Yast::WFM.SCRSetDefault(desc)
end

describe "SCR" do
describe ".proc.cmdline" do
describe "Read" do
let(:expected_list) { %w(biosdevname=1 initrd=initrd install=hd:/// splash=silent) }
let(:read_list) { Yast::SCR.Read(Yast::Path.new(".proc.cmdline")).sort }

it "parses correctly simple files" do
set_root_path("cmdline-simple")
expect(read_list).to eq(expected_list)
end

it "parses correctly files with two separators" do
set_root_path("cmdline-twoseparators")
expect(read_list).to eq(expected_list)
end

it "parses correctly files with several lines" do
set_root_path("cmdline-newlines")
expect(read_list).to eq(expected_list)
end
end
end
end
7 changes: 7 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jul 29 08:09:27 UTC 2014 - ancor@suse.com

- Fixed .proc.cmdline parsing to support more situations
(bnc#889241)
- 3.1.89

-------------------------------------------------------------------
Tue Jul 29 06:46:55 UTC 2014 - jreidinger@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2
Version: 3.1.88
Version: 3.1.89
Release: 0
URL: https://github.com/yast/yast-yast2

Expand Down

0 comments on commit 6fe9b41

Please sign in to comment.