[virt-tools-list] [libosinfo] Don't entertain empty ID headers from ISOs
Christophe Fergeau
cfergeau at redhat.com
Thu Nov 24 16:49:15 UTC 2011
For what it's worth I'd do something like
diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 6c98ba7..8e7cb18 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -311,9 +310,13 @@ static void on_pvd_read (GObject *source,
}
data->pvd.volume[MAX_VOLUME - 1] = 0;
+ g_strchomp(data->pvd.volume);
data->pvd.system[MAX_SYSTEM - 1] = 0;
+ g_strchomp(data->pvd.system);
data->pvd.publisher[MAX_PUBLISHER - 1] = 0;
+ g_strchomp(data->pvd.publisher);
I haven't successfully tested any of these 2 patches for now since the
block below needs to be changed too:
if (data->pvd.volume[0] &&
(data->pvd.system[0] == 0 && data->pvd.publisher[0] == 0)) {
g_set_error(&error, ....);
and even after commenting it out, my ubuntu 11.10 iso isn't identified. No
time to look more into it just now though :-/
Christophe
On Thu, Nov 24, 2011 at 04:09:26PM +0000, Daniel P. Berrange wrote:
> On Thu, Nov 24, 2011 at 06:00:55PM +0200, Zeeshan Ali (Khattak) wrote:
> > From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
> >
> > ---
> > osinfo/osinfo_media.c | 20 +++++++++++++++++---
> > 1 files changed, 17 insertions(+), 3 deletions(-)
> >
> > diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
> > index cf065f0..8c51a0d 100644
> > --- a/osinfo/osinfo_media.c
> > +++ b/osinfo/osinfo_media.c
> > @@ -517,6 +517,20 @@ OsinfoMedia *osinfo_media_create_from_location(const gchar *location,
> > return ret;
> > }
> >
> > +static gboolean is_str_empty(const gchar *str) {
> > + guint8 i;
> > + gboolean ret = TRUE;
> > +
> > + for (i = 0; i < strlen (str); i++)
> > + if (!g_ascii_isspace (str[i])) {
> > + ret = FALSE;
> > +
> > + break;
> > + }
> > +
> > + return ret;
> > +}
> > +
> > static void on_svd_read (GObject *source,
> > GAsyncResult *res,
> > gpointer user_data)
> > @@ -564,15 +578,15 @@ static void on_svd_read (GObject *source,
> > OSINFO_MEDIA_PROP_URL,
> > uri);
> > g_free(uri);
> > - if (data->pvd.volume[0] != 0)
> > + if (data->pvd.volume[0] != 0 && !is_str_empty (data->pvd.volume))
> > osinfo_entity_set_param(OSINFO_ENTITY(ret),
> > OSINFO_MEDIA_PROP_VOLUME_ID,
> > data->pvd.volume);
> > - if (data->pvd.system[0] != 0)
> > + if (data->pvd.system[0] != 0 && !is_str_empty (data->pvd.system))
> > osinfo_entity_set_param(OSINFO_ENTITY(ret),
> > OSINFO_MEDIA_PROP_SYSTEM_ID,
> > data->pvd.system);
> > - if (data->pvd.publisher[0] != 0)
> > + if (data->pvd.publisher[0] != 0 && !is_str_empty (data->pvd.publisher))
> > osinfo_entity_set_param(OSINFO_ENTITY(ret),
> > OSINFO_MEDIA_PROP_PUBLISHER_ID,
> > data->pvd.publisher);
>
> ACK
>
>
> Daniel
> --
> |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
> |: http://libvirt.org -o- http://virt-manager.org :|
> |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
> |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20111124/d9341ac6/attachment.sig>
More information about the virt-tools-list
mailing list