GNOME Bugzilla – Bug 320062
problems with lsb-release and $distro-release existing side by side
Last modified: 2006-01-06 19:41:10 UTC
bug-buddy is not handling this case gracefully it seems. The lsb-release file has one mandatory field: "LSB_RELEASE" which isn't handled in get_lsb_release() in distributions.c and three optional fields that are handled. This is causing problems on Fedora Rawhide where we have both lsb-release and fedora-release in /etc. Firstly it doesn't get any sane release info and secondly it causes a Glib-CRITICAL warning in g_str_has_prefix() because there's no DISTRIB_ID field in lsb-release at all on fedora.
After looking at the code it seems to me like get_distro_name_from_file() should look for both lsb-release and $distro-release before breaking out and then have the rest handle the combined case?
Here's the backtrace from the CRITICAL warning: GLib-CRITICAL **: g_str_has_prefix: assertion `str != NULL' failed aborting... Program received signal SIGTRAP, Trace/breakpoint trap.
+ Trace 64498
Thread NaN (LWP 2106)
Created attachment 56479 [details] [review] Don't assume a certain number of lines exist in the lsb file This was also biting me on RHEL4. If you look at distribution.c:get_lsb_version(), it reads all lines from the relevant file, and then does a sanity check to ensure that the lines array itself isn't NULL, and that the first and second (lines[0], lines[1]) lines from the file aren't NULL either. However, it unconditionally tries to read from lines[2] anyway. This patch just checks lines[2] before trying to read from it. I'm not sure if you want to also fixup the g_strdup_printf() below it as the codename can be NULL and removing the empty parentheses that would result in name may be worthwhile.
Created attachment 56823 [details] [review] Proposed patch Can you please test this patch? It should handle all my know cases correctly (/etc/fedora-release mandatory over /etc/lsb-release, and /etc/lsb-release mandatory over /etc/debian_version)
Committed a fixed version (with i++ :) )