NetBSD Problem Report #48318

From ef@math.uni-bonn.de  Wed Oct 16 17:56:42 2013
Return-Path: <ef@math.uni-bonn.de>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A592C725D1
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 16 Oct 2013 17:56:42 +0000 (UTC)
Message-Id: <20131016175640.12CAC5636@jade.math.uni-bonn.de>
Date: Wed, 16 Oct 2013 19:56:40 +0200 (CEST)
From: ef@math.uni-bonn.de
Reply-To: ef@math.uni-bonn.de
To: gnats-bugs@gnats.NetBSD.org
Subject: devel/glib2 doesn't build with clang
X-Send-Pr-Version: 3.95

>Number:         48318
>Category:       pkg
>Synopsis:       devel/glib2 doesn't build with clang
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 16 18:00:00 +0000 2013
>Closed-Date:    Sun Nov 23 06:43:28 +0000 2014
>Last-Modified:  Sun Nov 23 06:43:28 +0000 2014
>Originator:     ef@math.uni-bonn.de
>Release:        pkgsrc-2013Q3
>Organization:

>Environment:

>Description:
	Building devel/glib2 fails with
	gmessages.c:1062:3: error: data argument not used by format string [-Wformat-extra-args]
>How-To-Repeat:
	cd devel/glib2; make build
>Fix:
	$NetBSD: patch-glib_gmessages.c $
	# clang will error out on the unused NULL-"expression" argument in g_assert_warning()
	--- glib/gmessages.c.orig	2013-08-07 16:34:32.000000000 +0200
	+++ glib/gmessages.c	2013-10-16 18:47:27.000000000 +0200
	@@ -1051,15 +1051,21 @@
			  const char *pretty_function,
			  const char *expression)
	 {
	-  g_log (log_domain,
	-	 G_LOG_LEVEL_ERROR,
	-	 expression 
	-	 ? "file %s: line %d (%s): assertion failed: (%s)"
	-	 : "file %s: line %d (%s): should not be reached",
	-	 file, 
	-	 line, 
	-	 pretty_function,
	-	 expression);
	+  if (expression)
	+    g_log (log_domain,
	+	   G_LOG_LEVEL_ERROR,
	+	   "file %s: line %d (%s): assertion failed: (%s)",
	+	   file, 
	+	   line, 
	+	   pretty_function,
	+	   expression);
	+  else
	+    g_log (log_domain,
	+	   G_LOG_LEVEL_ERROR,
	+	   "file %s: line %d (%s): should not be reached",
	+	   file, 
	+	   line, 
	+	   pretty_function);
	   abort ();
	 }


>Release-Note:

>Audit-Trail:
From: Patrick Welche <prlw1@cam.ac.uk>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/48318
Date: Wed, 18 Dec 2013 23:30:37 +0000

 I was about to create an upstream bug for this, but then I saw:

 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
 page 309 (327th of document):

    "If the format is exhausted while arguments remain, the excess
     arguments are evaluated (as always) but are otherwise ignored."

 So, amazingly, that code seems to be legal. Any thoughts from the
 language lawyers?

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/48318
Date: Thu, 19 Dec 2013 00:43:28 +0100

 On Wed, Dec 18, 2013 at 11:35:01PM +0000, Patrick Welche wrote:
 > The following reply was made to PR pkg/48318; it has been noted by GNATS.
 > 
 > From: Patrick Welche <prlw1@cam.ac.uk>
 > To: gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: pkg/48318
 > Date: Wed, 18 Dec 2013 23:30:37 +0000
 > 
 >  I was about to create an upstream bug for this, but then I saw:
 >  
 >  http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
 >  page 309 (327th of document):
 >  
 >     "If the format is exhausted while arguments remain, the excess
 >      arguments are evaluated (as always) but are otherwise ignored."
 >  
 >  So, amazingly, that code seems to be legal. Any thoughts from the
 >  language lawyers?

 It's legal, but it doesn't mean it is good style. It is certainly making
 it harder for the compiler to check the correctness of the format
 string. That alone is a very good reason for avoiding the construct.

 Joerg

From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/48318
Date: Sat, 21 Dec 2013 18:49:16 +0000

 On Wed, Dec 18, 2013 at 11:35:01PM +0000, Patrick Welche wrote:
  >  I was about to create an upstream bug for this, but then I saw:
  >  
  >  http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
  >  page 309 (327th of document):
  >  
  >     "If the format is exhausted while arguments remain, the excess
  >      arguments are evaluated (as always) but are otherwise ignored."
  >  
  >  So, amazingly, that code seems to be legal. Any thoughts from the
  >  language lawyers?

 It is legal, but so is

    printf("hello\n", "world\n");

 and many compilers correctly warn about or reject this.

 The correct way to write printfs like this is

    g_log(log_domain, G_LOG_LEVEL_ERROR,
          "file %s: line %d (%s): %s%s%s",
          file, line, pretty_function,
          expression ? "assertion failed: (" : "should not be reached",
          expression ? expression : "",
          expression ? ")" : "");

 or, less tidily,

    g_log(log_domain, G_LOG_LEVEL_ERROR,
          expression ? "file %s: line %d (%s): assertion failed: (%s)"
                     : "file %s: line %d (%s): should not be reached%s",
          file, line, pretty_function,
          expression ? expression : "");

 -- 
 David A. Holland
 dholland@netbsd.org

From: Edgar =?iso-8859-1?B?RnXf?= <ef@math.uni-bonn.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/48318
Date: Sun, 22 Dec 2013 00:05:19 +0100

 >  The correct way to write printfs like this is
 [...]
 I would still regard the expanded version in my patch as more readable.

From: "Patrick Welche" <prlw1@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48318 CVS commit: pkgsrc/devel/glib2
Date: Fri, 5 Sep 2014 20:49:55 +0000

 Module Name:	pkgsrc
 Committed By:	prlw1
 Date:		Fri Sep  5 20:49:55 UTC 2014

 Modified Files:
 	pkgsrc/devel/glib2: Makefile.common PLIST distinfo
 	pkgsrc/devel/glib2/patches: patch-aa patch-af patch-an patch-ba
 	    patch-cl patch-glib_gtimezone.c
 Added Files:
 	pkgsrc/devel/glib2/patches: patch-gio_gcredentials.c
 	    patch-gio_gcredentialsprivate.h patch-gio_gioenums.h
 	    patch-gio_gsocket.c patch-gio_gunixcredentialsmessage.c
 	    patch-gio_tests_credentials.c patch-glib_gmessages.c
 Removed Files:
 	pkgsrc/devel/glib2/patches: patch-ai patch-ap patch-aq patch-cj
 	    patch-gio_gdbusmessage.c patch-gio_gfile.c patch-gio_glocalfile.c

 Log Message:
 Update glib2 to 2.40.0

 Patches removed:
 - patch-ai
     Fixed in e3fa9c9a (Bug 583321)
 - patch-cj
     Fixed in c58a7b8c (Bugs 641350 711047)
 - patch-gio_gdbusmessage.c
     Fixed in 0167c334
 - patch-gio_gfile.c
     Fixed in 091e4660 (Bug 721034)
 - patch-gio_glocalfile.c
     Fixed in 7eb1e5fc (Bug 708860)
 - patch-ap and
 - patch-aq
     Credentials have changed, see below
 Patches changed:
 - patch-aa
     Second chunk fixed in 838b49ea (Bug 711600)
 - patch-ba
     Third chunk fixed in 7cf221aa
     Reworked Bug 583330
 Patches added:
 - patch-glib_gmessages.c
     Closes PR pkg/48318, fixed in 7328089e (Bug 720708)
 - patch-gio_gcredentials.c
 - patch-gio_gcredentialsprivate.h
 - patch-gio_gioenums.h
 - patch-gio_gsocket.c
 - patch-gio_gunixcredentialsmessage.c
 - patch-gio_tests_credentials.c
     Attempt at gcredential support for NetBSD (Bug 728256)

 Highlights from changes:

  * Disable IPv6 testcases on machines without IPv6
  * Document that it is a bad idea to match on generic error codes
  * This release introduces a hard dependency on present and functioning
    clock_gettime() and CLOCK_MONOTONIC.  It also introduces a
    dependency on pthread_condattr_setclock() unless your system
    happens to have pthread_cond_timedwait_relative_np() (as do Mac
    OS and Android).  This release is known to be broken with at
    least GNU/Hurd, pending addition of working
    pthread_condattr_setclock(CLOCK_MONOTONIC) there.
  * New API: g_str_to_ascii()
  * fix a crasher in code from gdbus-codegen
  * improvements to gobject gdb helper script
  * Portability:
    - fix a deadlock issue with kqueue on FreeBSD
    - work around a quirk in the sunstudio compiler
    - rename a variable to avoid clashing with a macro definition of
      'environ' on some platforms (like mingw)
    - use POSIX-specified <poll.h> over <sys/poll.h>
    - many improvements to Visual Studio projects and and some build
      fixes for Windows
  * tests
    - a very large number of improvements in test coverage
    - don't report skipped tests as failures
    - return 77 if we skip all tests in an executable
    - improve gtest documentation and fix some minor issues
    - fix g_test_trap_reached_timeout() return value
    - remove some dead code uncovered during test coverage expansion
    - Use tap mode for installed tests too, when using tap
  * fix races in unix signal handling
  * make our GVariant-based commandline tools (glib-compile-schemas,
    gdbus, gapplication) print out GVariant parse errors in context
  * GApplication now has a --gapplication-service command line switch to
    turn any GApplication into a service
  * improve compatibility of GApplication and GOptionContext
  * fix gsettings.m4 wrt. builddir != srcdir with non-recursive make
  * use a directory monitor in GKeyfileSettingsBackend
  * improve robustness of some GIcon classes
  * Portability
    - Remove alleged support for OS/2
    - Remove alleged support for BeOS
    - Remove alleged support for last-millennium Unixes
    - Require C90 compliance
    - Require POSIX.1 (1990) compliance on Unix
    - Require GNU make
  * GSettings fixes/improvements
    - GSettingsSchema API is now more powerful and consistent
    - new GSettingsSchemaKey API allows accessing metadata for keys:
      type, default value, range and the long-awaited support for summary
      and description
    - GSettingsSchemaSource gains support for listing schemas within a
      source.  Deprecate the global API that did this for the default
      source.
    - 'gsettings list-schemas' now works properly with --schemadir
    - deprecate a bunch of now-redundant functionality on GSettings
    - add API to GSettings for getting the default value of a key (as set
      by the sysadmin)
    - add API to GSettings for determining if the user has assigned a
      particular value to a key (ie: we are not just reading the default)
    - ignore qualified tags and attributes appearing in schema files
  * Applications/Actions
    - make GSimpleAction a bit more strict with respect to state changes
      that would violate the interface (ie: by changing the state type
      after construction)
    - throw an error when attempting to 'Describe' a non-existent action
      via D-Bus instead of returning a bogus description
    - throw an error when attempting to invoke unsupported methods on an
      Application (eg: 'Open' on an app that doesn't HANDLES_OPEN)
      instead of emitting a g_critical() in context of the app (which is
      not itself at fault for the errant call)
  * Appinfo
    - substantially rework GDesktopAppInfo to reduce the amount of disk
      accesses that are performed in common situations
    - add a new class: GAppInfoMonitor for discovering when applications
      are installed/removed
    - add a new g_desktop_app_info_search() API for searching for
      installed applications by name, keywords, etc.
  * GMarkup: add new G_MARKUP_IGNORE_QUALIFIED flag for skipping over
    "qualified" tags and attributes (those with a colon in the name, such
    as 'my:tag')
  * GDBus
    - ignore qualified tags, as above
    - GTestDBus: unset all D-Bus addresses (such as STARTER) to ensure
      that test programs don't pick them up
    - add new session_bus_run() convenience in the tests and use it
  * GRand: use real random data as a seed on win32 and use the
    timestamp/pid/uid fallback only on UNIX machines where we can't open
    '/dev/urandom'.  This may cause issues with older mingw32 releases
    due to a missing prototype for the rand_s() API.
  * Many win32 (and particularly MSVC) portability fixes.  Many
    additional tests are now runnable when building with MSVC.
  * Due to early testing of the (soon to land) GCleanup framework, a very
    large number of memory errors have been found and fixed (mostly in
    the testcases, but some in glib itself).
  * GIO:
    - some more seeking cleanups: particularly on GLocalFileInputStream
    - don't leave a .trashinfo file around if trashing a file fails
    - Add a request_certificate virtual method to GTlsInteraction
  * GNotification
    - new API for sending persistent notifications via the desktop shell
    - notifications persist when the application has quit and clicking on
      them can restart the application with an action (via
      DBusActivatable)
  * GSubprocess
    - new API for launching subprocesses
    - nice GIO integration like async functions, cancellability, etc.
    - a convenient communicate() API inspired by the same API in Python
    - related: the gspawn API now has a CLOEXEC flag for the created
      pipes for stdin/stdout/stderr
  * New gapplication(1) commandline tool
    - intended to be used with DBusActivatable apps
    - can be used for launching apps, opening files, invoking application
      actions and listing apps and actions
    - bash tab completion is supported
  * GDesktopAppInfo changes:
    - g_file_get_path() can implicitly cause a FUSE mount so don't call
      it until we know we need it (for an app that doesn't support URIs)
    - don't crash when trying to load from a keyfile with
      DBusActivatable=true
    - remove some dead code, refactor the search path handling a bit and
      do a large-scale whitespace cleanup (prep work for the pending
      desktop file index)
  * File monitors
    - fix broken handling of mount point monitoring
    - remove some strange use of GObject::constructor() from the base
      class and inotify backend
    - fix GFileMonitor to work in the non-default main context even when
      the main context is not running (or is blocked)
    - add internal private API for easily creating a file monitor in the
      GLib worker thread
  * GSettings
    - g_settings_list_children: only list viable schemas.  This fixes a
      longstanding issue where 'gsettings list-recursively' will crash
      when there are invalid schemas installed
    - don't accept invalid paths on g_settings_new_with_path, etc.
  * GIO
    - GFile now has a thumbnail::is-valid attribute to check if the
      thumbnail in thumbnail::path needs to be regenerated
    - GDBusProxy now has a flag to control autostarting of services at
      construction time
    - for GSeekable, properly introduce the concept of "resizable" vs.
      "fixed-sized" streams in the docs, explaining the expected
      semantics of the interface in each case
    - fix some cases in GMemoryOutputStream that were violating the above
      expectations (which may cause a slight API incompatibility)
    - clean up GCredentials code and add support for Hurd and Solaris
    - improve splicing by using different codepaths for the case where we
      have real _read_async() and _write_async() implementations on the
      stream vs. the case where they are internally emulated (via
      dispatching the sync variant of the call in a thread)
  * GKeyFile
    - fix a leak in g_key_file_get_(u)int64 when we fail to parse the
      value as an integer
    - add long-requested API g_key_file_save_to_file()
  * Portability improvements
    - avoid using O_DIRECTORY on platforms that don't have it
    - be careful about systems that define SOCK_CLOEXEC but don't
      actually support it (like Hurd)
    - only use SA_RESTART if it exists
  * Other small API changes/additions
    - a pair of functions to support matching strings for the type of
      search functionality that you'd expect to have with things like
      GtkSearchBar.  This will also be used by the desktop file index.
    - g_str_is_ascii() with obvious purpose
    - g_test_expect_message() no longer appears to allow you to catch
      G_LOG_ERROR messages
  * GMainContext/GSource
    - fix handling of overflowing the 'next source id' counter
    - g_source_remove() will now throw a critical in the case that you
      try to remove a non-existent source.  We expect that there is some
      code in the wild that will fall afoul of this new critical but
      considering that we now reuse source IDs, this code is already
      broken and should probably be fixed.
    - simplify handling of the 'current dispatching source' to not
      require use of a linked list
  * GObject
    - the long-broken (and leaky) pattern of destroying a just-allocated
      object from inside of a custom GObject::constructor is now
      officially completely illegal and will abort the program
  * Unicode: update to 6.3.0
  * Many bug fixes
  * Many translation updates

 For full details see:
 https://git.gnome.org/browse/glib/tree/NEWS?id=2.40.0


 To generate a diff of this commit:
 cvs rdiff -u -r1.36 -r1.37 pkgsrc/devel/glib2/Makefile.common
 cvs rdiff -u -r1.78 -r1.79 pkgsrc/devel/glib2/PLIST
 cvs rdiff -u -r1.199 -r1.200 pkgsrc/devel/glib2/distinfo
 cvs rdiff -u -r1.56 -r1.57 pkgsrc/devel/glib2/patches/patch-aa
 cvs rdiff -u -r1.15 -r1.16 pkgsrc/devel/glib2/patches/patch-af
 cvs rdiff -u -r1.22 -r0 pkgsrc/devel/glib2/patches/patch-ai
 cvs rdiff -u -r1.11 -r1.12 pkgsrc/devel/glib2/patches/patch-an
 cvs rdiff -u -r1.5 -r0 pkgsrc/devel/glib2/patches/patch-ap
 cvs rdiff -u -r1.6 -r0 pkgsrc/devel/glib2/patches/patch-aq
 cvs rdiff -u -r1.13 -r1.14 pkgsrc/devel/glib2/patches/patch-ba
 cvs rdiff -u -r1.11 -r0 pkgsrc/devel/glib2/patches/patch-cj
 cvs rdiff -u -r1.10 -r1.11 pkgsrc/devel/glib2/patches/patch-cl
 cvs rdiff -u -r0 -r1.1 pkgsrc/devel/glib2/patches/patch-gio_gcredentials.c \
     pkgsrc/devel/glib2/patches/patch-gio_gcredentialsprivate.h \
     pkgsrc/devel/glib2/patches/patch-gio_gioenums.h \
     pkgsrc/devel/glib2/patches/patch-gio_gsocket.c \
     pkgsrc/devel/glib2/patches/patch-gio_gunixcredentialsmessage.c \
     pkgsrc/devel/glib2/patches/patch-gio_tests_credentials.c \
     pkgsrc/devel/glib2/patches/patch-glib_gmessages.c
 cvs rdiff -u -r1.1 -r0 pkgsrc/devel/glib2/patches/patch-gio_gdbusmessage.c
 cvs rdiff -u -r1.2 -r0 pkgsrc/devel/glib2/patches/patch-gio_gfile.c
 cvs rdiff -u -r1.3 -r0 pkgsrc/devel/glib2/patches/patch-gio_glocalfile.c
 cvs rdiff -u -r1.1 -r1.2 pkgsrc/devel/glib2/patches/patch-glib_gtimezone.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 23 Nov 2014 06:43:28 +0000
State-Changed-Why:
Patch was merged in September.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.