Re: [libvirt] [PATCH] virsh edit command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 29, 2008 at 01:27:42PM +0100, Richard W.M. Jones wrote:
> but with much more sanity checking.  The editor is $EDITOR or vi, and
> it does the right thing if the user doesn't modify the file, or if
> another user edits the configuration at the same time.
[...]
> +    /* Compare original XML with edited.  Has it changed at all? */
> +    if (STREQ (doc, doc_edited)) {
> +        vshPrint(ctl, _("Domain %s XML configuration not changed.\n"),
> +                 virDomainGetName (dom));
> +        ret = TRUE;
> +        goto cleanup;
> +    }

  Hum, I would check for basic well-formedness here because it just
too easy to break the XML file while editing with a text editor
  http://xmlsoft.org/html/libxml-parser.html#xmlReadMemory
if the call fails to build a parsed document suggest to reedit from
scratch, based on the current buffer or just abort the edit.

  Numerous newbies will get trapped in vi, get lost and looking for
a safe exit path :-)

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]