[augeas-devel] Re: Multiline values in INI Files

Free Ekanayaka free at 64studio.com
Fri Aug 29 19:53:12 UTC 2008


|--==> On Fri, 29 Aug 2008 18:00:15 +0000, David Lutterkort <lutter at redhat.com> said:

  DL> On Fri, 2008-08-29 at 13:14 -0400, Nate Foster wrote:
  >>The final q-lens would accept keys like this in the source
  >>
  >>"This is\n   a key\n    with wacky indentation"
  >>
  >>map them to views with no indentation like this
  >>
  >>"This is\nakey with\nwacky indentation"
  >>
  >>and produce sources with standard indentation, maybe like this?
  >>
  >>"This is\n  akey with\n  wacky indentation"
  >>
  >>Is that what you want?

  DL> The problem with this is that Augeas tries very hard to keep changes
  DL> minimal, i.e. as close to what a human would change armed with only vi;
  DL> using q-lenses would mean that if I modify an unrelated part of the
  DL> file, the indentation of those multiline entries might change, too, even
  DL> though they haven't really been touched.

By the way I find that the fstab lens shows this behaviour. For
example if I run 

(echo set /files/etc/fstab/1/spec foo; echo save)| augtool -r fakeroot/

against the fstab below and then diff the two versions I get:

--- /etc/fstab  2008-08-28 11:44:24.000000000 +0200
+++ fakeroot/etc/fstab  2008-08-29 21:44:41.000000000 +0200
@@ -1,10 +1,10 @@
 # /etc/fstab: static file system information.
 #
 # <file system> <mount point>   <type>  <options>       <dump>  <pass>
-proc            /proc           proc    defaults        0       0
+foo            /proc           proc    defaults        0 0
 # /dev/sda1
-UUID=f3789373-bcf5-4f8c-92d7-dae09ca156af /               ext3    relatime,errors=remount-ro 0       1
+UUID=f3789373-bcf5-4f8c-92d7-dae09ca156af /               ext3    relatime,errors=remount-ro   0 1
 # /dev/sda3
-UUID=cfa5ec0e-71c4-4133-b477-8d114a9cfdfd /home           ext3    relatime        0       2
+UUID=cfa5ec0e-71c4-4133-b477-8d114a9cfdfd /home           ext3    relatime     0 2
 # /dev/sda8
-UUID=e28ca2e9-465f-46d7-af0d-9ee9b3836b93 none            swap    sw              0       0
+UUID=e28ca2e9-465f-46d7-af0d-9ee9b3836b93 none            swap    sw   0 0

Notice that parts unrelated to my change got actually modified.

Ciao,

Free

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/sda1
UUID=f3789373-bcf5-4f8c-92d7-dae09ca156af /               ext3    relatime,errors=remount-ro 0       1
# /dev/sda3
UUID=cfa5ec0e-71c4-4133-b477-8d114a9cfdfd /home           ext3    relatime        0       2
# /dev/sda8
UUID=e28ca2e9-465f-46d7-af0d-9ee9b3836b93 none            swap    sw              0       0




More information about the augeas-devel mailing list