Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 883223 - dev-libs/glib: g_str_equal: New macro version breaks compilation in C++ projects
Summary: dev-libs/glib: g_str_equal: New macro version breaks compilation in C++ projects
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords: PATCH, PMASKED, PullRequest
: 883093 883119 883133 883145 883151 883217 883227 883229 883231 883233 883253 883255 883257 883277 883309 883311 883331 883341 883373 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-11-27 00:07 UTC by Alexandra Parker
Modified: 2022-12-02 03:30 UTC (History)
15 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Implements the suggested fix from upstream (glib-strcmp-const-char.patch,619 bytes, patch)
2022-11-27 00:10 UTC, Alexandra Parker
Details | Diff
Compilation failed for gjs-1.74.1 with glib-2.74.2 (compilation_failed_gjs-1.74.1_glib-2.74.2.txt,42.04 KB, text/plain)
2022-11-28 00:03 UTC, Guillermo Joandet
Details
Compilation succesfull for gjs-1.74.1 with glib-2.74.2-r1 (compilation_succesfull_gjs-1.74.1_glib-2.74.2-r1.txt,246.03 KB, text/plain)
2022-11-28 00:05 UTC, Guillermo Joandet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandra Parker 2022-11-27 00:07:40 UTC
Building a project like dev-libs/gjs with dev-libs/glib-2.74.2 and sys-devel/gcc-12.2.1_p20221008 gives this compilation error:

/usr/include/glib-2.0/glib/ghash.h:165:38: error: invalid conversion from ‘gconstpointer’ {aka ‘const void*’} to ‘const char*’ [-fpermissive]
  165 | #define g_str_equal(v1, v2) (strcmp ((gconstpointer) (v1), (gconstpointer) (v2)) == 0)
      |                                      ^~~~~~~~~~~~~~~~~~~~
      |                                      |
      |                                      gconstpointer {aka const void*}

Reproducible: Always

Steps to Reproduce:
- Update to dev-libs/glib-2.74.2
- Build dev-libs/gjs-1.74.1
Actual Results:  
Compile-time error.

Expected Results:  
Successful build.

Upstream error is here: https://gitlab.gnome.org/GNOME/glib/-/issues/2820

Upstream will fix this in 2.74.3 on 12/22/2022. I don't want my world update to be stuck that long though.
Comment 1 Alexandra Parker 2022-11-27 00:10:45 UTC
Created attachment 837335 [details, diff]
Implements the suggested fix from upstream

Signed-off-by: Alexandra Parker <alex.iris.parker@gmail.com>
Comment 2 Holger Hoffstätte 2022-11-27 00:30:41 UTC
(In reply to Alexandra Parker from comment #1)
> Created attachment 837335 [details, diff] [details, diff]
> Implements the suggested fix from upstream

Works fine and also fixes both 883093 & 883133
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:02:31 UTC
*** Bug 883227 has been marked as a duplicate of this bug. ***
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:02:40 UTC
*** Bug 883133 has been marked as a duplicate of this bug. ***
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:02:49 UTC
*** Bug 883093 has been marked as a duplicate of this bug. ***
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:03:02 UTC
*** Bug 883217 has been marked as a duplicate of this bug. ***
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:03:31 UTC
*** Bug 883151 has been marked as a duplicate of this bug. ***
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:03:48 UTC
*** Bug 883145 has been marked as a duplicate of this bug. ***
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:04:01 UTC
*** Bug 883119 has been marked as a duplicate of this bug. ***
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 01:04:33 UTC
*** Bug 883229 has been marked as a duplicate of this bug. ***
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 03:41:42 UTC
*** Bug 883231 has been marked as a duplicate of this bug. ***
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 04:45:33 UTC
*** Bug 883233 has been marked as a duplicate of this bug. ***
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 15:45:31 UTC
*** Bug 883309 has been marked as a duplicate of this bug. ***
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 15:45:45 UTC
*** Bug 883311 has been marked as a duplicate of this bug. ***
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 15:46:06 UTC
*** Bug 883257 has been marked as a duplicate of this bug. ***
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 15:46:18 UTC
*** Bug 883277 has been marked as a duplicate of this bug. ***
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 15:46:32 UTC
*** Bug 883253 has been marked as a duplicate of this bug. ***
Comment 18 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 15:46:41 UTC
*** Bug 883255 has been marked as a duplicate of this bug. ***
Comment 19 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 17:37:45 UTC
*** Bug 883331 has been marked as a duplicate of this bug. ***
Comment 20 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 17:43:10 UTC
on possibility of a mask: needs someone to abidiff a downgrade to see if it's problematic, I hope/suspect they don't add new symbols (versioned) on point releases
Comment 21 Larry the Git Cow gentoo-dev 2022-11-27 18:27:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15d4c35b62e142eedcb2570b78560af0eb7e51cf

commit 15d4c35b62e142eedcb2570b78560af0eb7e51cf
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2022-11-27 18:26:53 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2022-11-27 18:26:53 +0000

    profiles: mask dev-libs/glib-2.74.2 due to C++ breakage
    
    * 2.74.2 hasn't added any new symbols, hence we can safely mask it.
    
    Bug: https://bugs.gentoo.org/883223
    Signed-off-by: David Seifert <soap@gentoo.org>

 profiles/package.mask | 5 +++++
 1 file changed, 5 insertions(+)
Comment 22 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-27 18:42:14 UTC
*** Bug 883341 has been marked as a duplicate of this bug. ***
Comment 23 Guillermo Joandet 2022-11-28 00:03:14 UTC
Created attachment 837843 [details]
Compilation failed for gjs-1.74.1 with glib-2.74.2

Reproduction of bug 883223
Comment 24 Guillermo Joandet 2022-11-28 00:05:24 UTC
Created attachment 837845 [details]
Compilation succesfull for gjs-1.74.1 with glib-2.74.2-r1

Succesfull compiled gjs after fix glib-2.74.2-r1

https://github.com/gentoo/gentoo/pull/28458
Comment 25 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-28 02:37:46 UTC
*** Bug 883373 has been marked as a duplicate of this bug. ***
Comment 26 John Bowler 2022-11-28 03:02:17 UTC
The patch is better than a mask; in C++ terms it is a nested reinterpret_cast which, technically, isn't necessary; changing (gconstptr) to (const char*) should be sufficient, but so far as I can see it is totally harmless until upstream comes up with a real fix to deal with g++ (it is, I believe, g++ specific; those guys have always gone in for excessive warnings of this type.)

In the past I've done this with a macro to use either (type) or static_cast<type> as appropriate.
Comment 27 Guillermo Joandet 2022-11-28 13:28:59 UTC
New fix by upstream 33 minutes ago:

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3094/diffs?commit_id=6c39f08f371da68a4ff104ca2b9f1cd5e38b6cdf

Added to PR for glib-2.74.2-r1.ebuild

https://github.com/gentoo/gentoo/pull/28458
Comment 28 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-28 14:12:23 UTC
(In reply to John Bowler from comment #26)
> The patch is better than a mask; in C++ terms it is a nested
> reinterpret_cast which, technically, isn't necessary; changing (gconstptr)
> to (const char*) should be sufficient, but so far as I can see it is totally
> harmless until upstream comes up with a real fix to deal with g++ (it is, I
> believe, g++ specific; those guys have always gone in for excessive warnings
> of this type.)
> 
> In the past I've done this with a macro to use either (type) or
> static_cast<type> as appropriate.

We usually prefer to use patches which are merged upstream unless something is obviously correct, especially given this is in headers. Indeed, upstream seem likely to merge something different. A mask doesn't really do any harm here anyway.
Comment 30 Larry the Git Cow gentoo-dev 2022-12-01 15:44:13 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c6c0f08982143db8227d208391f6ed62f974c53c

commit c6c0f08982143db8227d208391f6ed62f974c53c
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2022-12-01 15:28:34 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2022-12-01 15:44:01 +0000

    dev-libs/glib: Version bump to 2.74.3
    
    Closes: https://bugs.gentoo.org/883223
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 dev-libs/glib/Manifest           |   1 +
 dev-libs/glib/glib-2.74.3.ebuild | 287 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 288 insertions(+)
Comment 31 Larry the Git Cow gentoo-dev 2022-12-02 03:30:45 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da492e33f9ad0d1cf09c4c643737755999fa7425

commit da492e33f9ad0d1cf09c4c643737755999fa7425
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-02 03:23:49 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-02 03:27:32 +0000

    dev-libs/glib: drop 2.74.2 (broken)
    
    Will keep the mask for a little bit for folks who still have it installed
    as a prompt to upgrade.
    
    Bug: https://bugs.gentoo.org/883223
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-libs/glib/Manifest           |   1 -
 dev-libs/glib/glib-2.74.2.ebuild | 287 ---------------------------------------
 2 files changed, 288 deletions(-)