Martin,

you are right - in this case, there's a simple way to avoid writing
anything, since Augeas can just check whether the old and the new value
for the tree node are different, and hence can figure out if anything
needs to be written at all.

There are more complicated cases of a noop, like removing something from
the tree and then recreating that part of the tree that are not covered
by that simple check.

For the record, what Augeas does is write the new file as file.augnew,
and then compare with the original file byte-for-byte. If the two files
are identical, file.augnew is simply removed. If there was a change,
file.augnew is renamed. The rename requires that the .augnew and the
original file reside on the same mountpoint, and the simplest way to
ensure that is to create file.augnew in the same directory as the
original one.

To catch your use case in all generality, I could just write the changed
file to a memstream, do the compare from that, and only write to .augnew
when something has changed.

David







-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to