Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Sep 2016 20:00:37 +0000
From:      bugzilla-noreply@freebsd.org
To:        gnome@FreeBSD.org
Subject:   maintainer-approval requested: [Bug 212310] devel/glib20: Error messages with trailing garbage when uninstalling devel/gnome-vfs : [Attachment 174298] glib.diff
Message-ID:  <bug-212310-6497-46TIwoDZiA@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-212310-6497@https.bugs.freebsd.org/bugzilla/>
References:  <bug-212310-6497@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
Tobias Kortkamp <t@tobik.me> has asked gnome@FreeBSD.org for
maintainer-approval:
Bug 212310: devel/glib20: Error messages with trailing garbage when
uninstalling devel/gnome-vfs
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D212310

Attachment 174298: glib.diff
https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D174298&action=3Dedit



--- Comment #1 from Tobias Kortkamp <t@tobik.me> ---
Created attachment 174298
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D174298&action=
=3Dedit
glib.diff

The example can be a lot smaller:

#include <errno.h>
#include <glib.h>
#include <locale.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[]) {
    setlocale(LC_ALL, "");
    const gchar *err =3D g_strerror(ENOENT);
    printf("%lu: %s\n", strlen(err), err);
    return 1;
}

And it's also pretty clear that the problem is in devel/glib20 and in
g_strerror.

g_strerror is defined in glib/gstrfunc.c line 1254. We see this snippet in
there

      if (!g_get_charset (NULL))
	{
	  msg =3D g_locale_to_utf8 (msg, -1, NULL, NULL, &error);
	  if (error)
	    g_print ("%s\n", error->message);
	}

When g_get_charset returns FALSE (which it does when we setlocale(LC_ALL, "=
"))
msg is a pointer to a local variable which is put into a GHashTable and
returned. Adding=20

      else
	msg =3D g_strdup(buf);

fixes the problem or at least prevents printing of garbage values.  glib ma=
ster
has a similar patch for this:

      else if (msg =3D=3D (const gchar *)buf)
	msg =3D g_strdup (buf);

Also see
https://git.gnome.org/browse/glib/commit/glib/gstrfuncs.c?id=3Df87e002313d5=
66dcce
71a9aba040d22ddb5c1e80

I'm attaching a patch against devel/glib20 with a backport of this.

Poudriere testport 9.3/amd64 ok



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-212310-6497-46TIwoDZiA>