[Bug 212310] devel/glib20: Error messages with trailing garbage when uninstalling devel/gnome-vfs

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Sep 1 20:00:38 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212310

Tobias Kortkamp <t at tobik.me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gnome at FreeBSD.org
 Attachment #174298|                            |maintainer-approval?(gnome@
              Flags|                            |FreeBSD.org)

--- Comment #1 from Tobias Kortkamp <t at tobik.me> ---
Created attachment 174298
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=174298&action=edit
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 = 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 = 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 

      else
        msg = g_strdup(buf);

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

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

Also see
https://git.gnome.org/browse/glib/commit/glib/gstrfuncs.c?id=f87e002313d566dcce71a9aba040d22ddb5c1e80

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

Poudriere testport 9.3/amd64 ok

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.


More information about the freebsd-gnome mailing list