From 2565e67f724032cdc6217c2a2d2c1bc25ca23605 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 13 Feb 2018 07:21:55 +0100
Subject: [PATCH] Fstab: allow leading whitespace in lines with spec (#544)
The documentation does not explicitly mention this possibility, but
tooling that parses fstab actually supports this: hence, allow leading
whitespace in lines with filesystem specification.
---
lenses/fstab.aug | 1 +
lenses/tests/test_fstab.aug | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/lenses/fstab.aug b/lenses/fstab.aug
index bceaddd1..d67a3067 100644
--- a/lenses/fstab.aug
+++ b/lenses/fstab.aug
@@ -23,6 +23,7 @@ module Fstab =
Build.opt_list lns comma
let record = [ seq "mntent" .
+ Util.indent .
[ label "spec" . store spec ] . sep_tab .
[ label "file" . store file ] . sep_tab .
comma_sep_list "vfstype" .
diff --git a/lenses/tests/test_fstab.aug b/lenses/tests/test_fstab.aug
index fa044aea..438f619a 100644
--- a/lenses/tests/test_fstab.aug
+++ b/lenses/tests/test_fstab.aug
@@ -11,6 +11,8 @@ module Test_fstab =
{ "dump" = "1" }
{ "passno" = "1" } }
+ let leading_ws = " /dev/vg00/lv00\t /\t ext3\t defaults 1 1\n"
+
let trailing_ws = "/dev/vg00/lv00\t /\t ext3\t defaults 1 1 \t\n"
let gen_no_passno(passno:string) =
@@ -60,6 +62,8 @@ module Test_fstab =
test Fstab.lns get simple = simple_tree
+ test Fstab.lns get leading_ws = simple_tree
+
test Fstab.lns get trailing_ws = simple_tree
test Fstab.lns get no_passno = no_passno_tree
--
2.14.3