Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 938569 - sys-fs/xfsprogs-6.10.0: missing cast in /usr/include/xfs/xfs_fs.h(xfs_getparents_next_rec) causes error in C++ compilations
Summary: sys-fs/xfsprogs-6.10.0: missing cast in /usr/include/xfs/xfs_fs.h(xfs_getpare...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-27 20:49 UTC by Matt Whitlock
Modified: 2024-09-17 16:45 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2024-08-27 20:49:51 UTC
/usr/include/xfs/xfs_fs.h contains this inline function definition:

static inline struct xfs_getparents_rec *
xfs_getparents_next_rec(struct xfs_getparents *gp,
			struct xfs_getparents_rec *gpr)
{
	void *next = ((void *)gpr + gpr->gpr_reclen);
	void *end = (void *)(uintptr_t)(gp->gp_buffer + gp->gp_bufsize);

	if (next >= end)
		return NULL;

	return next; //<<<< ERROR: missing cast from void*
}


C allows implicit casts from void* to any pointer type, but C++ does not. Thus, when including <xfs/xfs_fs.h> in a C++ compilation unit, the compiler raises this error:

/usr/include/xfs/xfs_fs.h: In function 'xfs_getparents_rec* xfs_getparents_next_rec(xfs_getparents*, xfs_getparents_rec*)':
/usr/include/xfs/xfs_fs.h:915:16: error: invalid conversion from 'void*' to 'xfs_getparents_rec*' [-fpermissive]
  915 |         return next;
      |                ^~~~
      |                |
      |                void*


I encountered this error while attempting to build net-libs/libktorrent-24.08.0, but it would affect any C++ code that includes <xfs/xfs_fs.h>.


# emerge -pqvO sys-fs/xfsprogs
[ebuild   R   ] sys-fs/xfsprogs-6.10.0  USE="icu -libedit -nls (-selinux) -static-libs" 

# emerge --info sys-fs/xfsprogs
Portage 3.0.65 (python 3.12.5-final-0, default/linux/amd64/23.0/desktop/plasma, gcc-14, glibc-2.40, 6.6.30-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-6.6.30-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-glibc2.40
KiB Mem:     8143808 total,    305568 free
KiB Swap:    8388604 total,   1510720 free
Timestamp of repository gentoo: Tue, 27 Aug 2024 09:15:00 +0000
Head commit of repository gentoo: 423b090b2897e065782f27a9e2dad312074e8c93
Timestamp of repository 4nykey: Thu, 22 Aug 2024 15:34:12 +0000
Head commit of repository 4nykey: ffc888135c0d11e3b3c549c7d4206ea63e1d7ed8

Timestamp of repository bitcoin: Mon, 26 Aug 2024 21:33:46 +0000
Head commit of repository bitcoin: 6ffd2d990214bf6e2c20d0d33cbccfd2c2ecba4b

Timestamp of repository eigenlay: Mon, 19 Aug 2024 06:22:11 +0000
Head commit of repository eigenlay: 9dfc0e40887047043a023c02c04be84266d21d93

Timestamp of repository gentoo-bootstrap: Mon, 19 Aug 2024 18:34:06 +0000
Head commit of repository gentoo-bootstrap: 9d6f4bef26b96d0542468f79dd096acb3362482c

Timestamp of repository kde: Mon, 26 Aug 2024 06:48:55 +0000
Head commit of repository kde: 293231bdad33bc930f85ae289a95f70a715b915f

Timestamp of repository science: Sun, 25 Aug 2024 13:18:58 +0000
Head commit of repository science: 2ec5862572ac3d70c2fa5cd9f0f5397272cf9aec

sh dash 0.5.12
ld GNU ld (Gentoo 2.43 p2) 2.43.1
distcc 3.4 x86_64-pc-linux-gnu [enabled]
ccache version 4.10.2 [enabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p32-r1::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo, 1.17-r1::gentoo
dev-build/cmake:           3.30.2::gentoo
dev-build/libtool:         2.4.7-r4::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.5.1::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.10.14_p3::gentoo, 3.11.9_p2::gentoo, 3.12.5_p1::gentoo, 3.13.0_rc1_p3::gentoo
dev-lang/rust:             1.80.1::gentoo
dev-util/ccache:           4.10.2::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/openrc:           0.54.2::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.43-r1::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/clang:           15.0.7-r3::gentoo, 18.1.8::gentoo
sys-devel/gcc:             14.2.1_p20240824::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/lld:             18.1.8::gentoo
sys-devel/llvm:            15.0.7-r6::gentoo, 18.1.8-r4::gentoo
sys-kernel/linux-headers:  6.10::gentoo (virtual/os-headers)
sys-libs/glibc:            2.40::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync11.us.gentoo.org/gentoo-portage/
    priority: -1000
    volatile: False
    sync-rsync-verify-max-age: 3
    sync-rsync-verify-metamanifest: no
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1

4nykey
    location: /var/db/repos/4nykey
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/4nykey.git
    masters: gentoo
    volatile: False

bitcoin
    location: /var/db/repos/bitcoin
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/bitcoin.git
    masters: gentoo
    volatile: False

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    volatile: False

eigenlay
    location: /var/db/repos/eigenlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/eigenlay.git
    masters: gentoo
    volatile: False

gentoo-bootstrap
    location: /var/db/repos/gentoo-bootstrap
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo-bootstrap.git
    masters: gentoo
    volatile: False

kde
    location: /var/db/repos/kde
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/kde.git
    masters: gentoo
    volatile: False

science
    location: /var/db/repos/science
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/science.git
    masters: gentoo
    volatile: False

local
    location: /var/db/repos/local
    masters: gentoo
    priority: 1000
    volatile: False

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O3 -ggdb -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/X11/xkb /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/i18n/locales/en_US /usr/share/sddm/scripts/Xsetup /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dbus-1 /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.3/ext-active/ /etc/php/cgi-php8.3/ext-active/ /etc/php/cli-php8.3/ext-active/ /etc/php/fpm-php8.3/ext-active/ /etc/php/phpdbg-php8.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-march=core2 -O3 -ggdb -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --unordered-display --verbose-conflicts --autounmask=n --backtrack=100 --usepkg --load-average=8"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live ccache compressdebug config-protect-if-modified distcc distlocks ebuild-locks fixlafiles ipc-sandbox merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync warn-on-large-env"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="        http://mirror.leaseweb.com/gentoo/      http://mirrors.rit.edu/gentoo/  http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ "
INSTALL_MASK="/etc/grub.d /etc/pm       /etc/systemd /lib/systemd /usr/lib/systemd/system /usr/lib/sysusers.d   /etc/xinetd.d   /usr/share/bash-completion /usr/share/fish /usr/share/zsh   /usr/share/cmake/Help /usr/share/gtk-doc        /usr/share/locale/*/ -/usr/share/locale/en -/usr/share/locale/en_US"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O2 -Wl,--as-needed"
LEX="flex"
LINGUAS="en_US en"
MAKEOPTS="-j32 -l12"
PKGDIR="/var/cache/binpkgs"
PORTAGE_COMPRESS="xz"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git --exclude=/CACHEDIR.TAG"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acpi alsa amd64 branding bzip2 cairo cdda cdparanoia cdr crypt cups curl dbus declarative dri dts dvd dvdr elogind encode evdev exif ffmpeg flac fontconfig gif git gmp gtk gui iconv icu id3tag ipv6 jpeg kde kf6compat kwallet lame lcms libnotify libsamplerate libtirpc lzma mad matroska mng mp3 mp4 mpeg multilib ncurses networkmanager ogg opengl opus pam pango pcre pdf php plasma png policykit postgres ppds qml qt5 quicktime readline sctp sdl seccomp smp sound spell ssl startup-notification subversion svg taglib tcmalloc test-rust theora threads tiff truetype udev udisks unicode upower usb v4l vaapi vdpau vnc vorbis vpx vulkan wayland webkit webp widgets x264 xcb xft xml xv xvid xvmc zlib zstd" ABI_X86="64" ADA_TARGET="gcc_12" ALSA_CARDS="hda-intel" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="evdev libinput" KERNEL="linux" L10N="en-US en" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="AMDGPU" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" QEMU_SOFTMMU_TARGETS="arm" RUBY_TARGETS="ruby31 ruby32" SANE_BACKENDS="genesys" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

=================================================================
                        Package Settings
=================================================================

sys-fs/xfsprogs-6.10.0::gentoo was built with the following:
USE="icu -libedit -nls (-selinux) -static-libs" ABI_X86="(64)"
CFLAGS="-pipe -march=core2 -O2 -ggdb"
CXXFLAGS="-pipe -march=core2 -O2 -ggdb"
Comment 1 Matt Whitlock 2024-08-27 21:03:33 UTC
Making this change allows net-libs/libktorrent-24.08.0 to build successfully:

--- /usr/include/xfs/xfs_fs.h
+++ /usr/include/xfs/xfs_fs.h
@@ -912,7 +912,7 @@
 	if (next >= end)
 		return NULL;
 
-	return next;
+	return (struct xfs_getparents_rec *)next;
 }
 
 /* Iterate through this file handle's directory parent pointers. */
Comment 2 Matt Whitlock 2024-08-27 21:10:21 UTC
Reported upstream: https://bugzilla.kernel.org/show_bug.cgi?id=219203
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-08-27 21:10:31 UTC
Oh, I'd just reported it upstream because of you but just saw https://bugzilla.kernel.org/show_bug.cgi?id=219203. Oops.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-08-27 21:12:08 UTC
This also, interestingly, exposes automagic use in libktorrent.
Comment 5 Larry the Git Cow gentoo-dev 2024-08-27 23:44:11 UTC
The bug has been closed via the following commit(s):

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

commit 56527dba237030fc69ac2bb4c6725a5ac58a7e16
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-08-27 23:42:38 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-08-27 23:43:47 +0000

    sys-fs/xfsprogs: fix C++ compat in headers
    
    Closes: https://bugs.gentoo.org/938569
    Thanks-to: Matt Whitlock <gentoo@mattwhitlock.name>
    Signed-off-by: Sam James <sam@gentoo.org>

 .../xfsprogs/files/xfsprogs-6.10.0-c++-void.patch  | 46 ++++++++++++++++++++++
 ...-6.10.0-r1.ebuild => xfsprogs-6.10.0-r2.ebuild} |  4 ++
 2 files changed, 50 insertions(+)
Comment 6 Larry the Git Cow gentoo-dev 2024-09-17 16:45:14 UTC
The bug has been referenced in the following commit(s):

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

commit e5a25a74515446fa910869bd2834bf513341fc44
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-09-17 16:44:20 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-09-17 16:44:24 +0000

    sys-fs/xfsprogs: add 6.10.1
    
    It's equivalent to 6.10.0-r2.
    
    Bug: https://bugs.gentoo.org/938569
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-fs/xfsprogs/Manifest               |   1 +
 sys-fs/xfsprogs/xfsprogs-6.10.1.ebuild | 110 +++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)