On Wed, Feb 12, 2014 at 03:30:52PM +0100, Pino Toscano wrote: > +and replace_host_in_etc_hosts g oldhost newhost = > + let filename = "/etc/hosts" in > + if g#is_file filename then ( > + Perl_edit.edit_file ~debug:false g filename > + ("s,(\\s)" ^ (Str.quote oldhost) ^ "(\\s|\\$),\\1" ^ (Str.quote > newhost) ^ "\\2, if ($_ !~ /^#/)")
I'd be surprised if Str.quote can properly quote this, since Perl regexps > the crappy regexps implemented in the Str module. In any case I'm not convinced this is the right way to do this. You should use Augeas instead. It is already used in one virt-sysprep module (sysprep/sysprep_operation_user_account.ml). So, NACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs