From 64d1cd4e23943acc5c38cbc2d35be0fdaaaa81ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 19 Apr 2017 16:32:22 +0200 Subject: [PATCH] [WIP] Fstab agent - handle better white space only lines (bsc#1030425) (#570) * Added a fstab white space test * Fstab agent - workaround for white space only lines (bsc#1030425) * Added a comment * 3.2.28 --- library/general/src/scrconf/etc_fstab.scr | 9 ++++++++- library/general/test/agents_test/fstab_agent_test.rb | 7 +++++++ library/general/test/agents_test/test_root3/etc/fstab | 8 ++++++++ package/yast2.changes | 6 ++++++ package/yast2.spec | 2 +- 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 library/general/test/agents_test/test_root3/etc/fstab diff --git a/library/general/src/scrconf/etc_fstab.scr b/library/general/src/scrconf/etc_fstab.scr index e1be8f812..83b043809 100644 --- a/library/general/src/scrconf/etc_fstab.scr +++ b/library/general/src/scrconf/etc_fstab.scr @@ -42,10 +42,17 @@ */ .etc.fstab +/* + * Note: the same agent definition is used in + * https://github.com/yast/yast-update/blob/e2052274034f5240e9f09bceae7c6d888b18468d/src/modules/RootPart.rb#L812 + * apply any fixes also there. + */ + `ag_anyagent( `Description ( (`File("/etc/fstab")), // real file name - "#\n", // Comment + // tab and space is a workaround for white space only lines (bsc#1030425) + "#\n\t ", // Comment false, // read-only (`List ( `Tuple ( diff --git a/library/general/test/agents_test/fstab_agent_test.rb b/library/general/test/agents_test/fstab_agent_test.rb index dc0efa58e..caa6ac186 100755 --- a/library/general/test/agents_test/fstab_agent_test.rb +++ b/library/general/test/agents_test/fstab_agent_test.rb @@ -21,7 +21,14 @@ root = File.join(File.dirname(__FILE__), "test_root2") change_scr_root(root) expect(content).to be_a(Array) + end + it "can read fstab containing just whitespace lines" do + reset_scr_root + root = File.join(File.dirname(__FILE__), "test_root3") + change_scr_root(root) + # all lines are returned + expect(content.size).to eq(6) end it "returns an array containing nfs entries" do diff --git a/library/general/test/agents_test/test_root3/etc/fstab b/library/general/test/agents_test/test_root3/etc/fstab new file mode 100644 index 000000000..1f8c0f6b7 --- /dev/null +++ b/library/general/test/agents_test/test_root3/etc/fstab @@ -0,0 +1,8 @@ +UUID=b66c1028-cd4a-4c08-b92d-fc4b9840845d / ext4 noatime,data=writeback,acl,user_xattr 1 1 +UUID=d2811ace-66e0-4ef2-9b68-9b2758359391 /home ext4 noatime,data=writeback,acl 1 2 + +192.168.1.2:/home/kv /home/kv2 nfs defaults 0 0 +192.168.1.2:/media/new2 /media/new2 nfs defaults 0 0 +192.168.1.2:/media/new /media/new nfs defaults 0 0 +# my fine comment +tmpfs /tmp tmpfs defaults,size=25% 0 0 diff --git a/package/yast2.changes b/package/yast2.changes index 44ed04eb5..a1c688001 100644 --- a/package/yast2.changes +++ b/package/yast2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Apr 19 14:16:33 UTC 2017 - lslezak@suse.cz + +- Fixed parsing whitespace lines in /etc/fstab (bsc#1030425) +- 3.2.28 + ------------------------------------------------------------------- Mon Apr 10 15:23:06 UTC 2017 - jreidinger@suse.com diff --git a/package/yast2.spec b/package/yast2.spec index 3a140eb5b..411e6c681 100644 --- a/package/yast2.spec +++ b/package/yast2.spec @@ -17,7 +17,7 @@ Name: yast2 -Version: 3.2.27 +Version: 3.2.28 Release: 0 Summary: YaST2 - Main Package License: GPL-2.0