From f4a53e34d0402dddda7706ba6268121625a6628e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 17 Apr 2020 04:12:34 +0000 Subject: [PATCH] Fix missing inline function definition The coreutils-i18n-expand-unexpand.patch adds 3 definitions of the mbfile_multi_getc function. 2 of the definitions are marked with the inline keyword, which means that there must also be an externally visible definition. The 3rd definition is marked extern inline, which statisfies this requirement. However, the 3rd definition is defined in mbfile.c which is not compiled or linked in to any executable. This causes build failures if the compiler decides not to inline the function (which it is allowed to do) e.g. src/expand.c:153: undefined reference to `mbfile_multi_getc' clang does not inline this function, but gcc does which is why you will not see this failure when compiling with gcc. However, gcc could choose not to inline this, so even though the build succeeds, it is depending on an implementation detail of gcc rather than the C specification. In order to fix this problem, mbfile.c was added to the list of sources for any executable that uses mbfile_multi_getc. --- coreutils-i18n-expand-unexpand.patch | 16 ++++++++++++++++ coreutils.spec | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/coreutils-i18n-expand-unexpand.patch b/coreutils-i18n-expand-unexpand.patch index b5f571f..32089cf 100644 --- a/coreutils-i18n-expand-unexpand.patch +++ b/coreutils-i18n-expand-unexpand.patch @@ -23,6 +23,7 @@ Co-authored-by: Pádraig Brady lib/mbfile.h | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++ m4/mbfile.m4 | 14 +++ src/expand.c | 43 +++++---- + src/local.mk | 4 +- src/unexpand.c | 54 +++++++---- tests/expand/mb.sh | 98 ++++++++++++++++++++ tests/local.mk | 2 + @@ -458,6 +459,21 @@ index 9fa2e10..380e020 100644 } } +diff --git a/src/local.mk b/src/local.mk +index 72db9c704..ef3bfa469 100644 +--- a/src/local.mk ++++ b/src/local.mk +@@ -415,8 +415,8 @@ src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS) + + src_ginstall_CPPFLAGS = -DENABLE_MATCHPATHCON=1 $(AM_CPPFLAGS) + +-src_expand_SOURCES = src/expand.c src/expand-common.c +-src_unexpand_SOURCES = src/unexpand.c src/expand-common.c ++src_expand_SOURCES = src/expand.c src/expand-common.c lib/mbfile.c ++src_unexpand_SOURCES = src/unexpand.c src/expand-common.c lib/mbfile.c + + # Ensure we don't link against libcoreutils.a as that lib is + # not compiled with -fPIC which causes issues on 64 bit at least diff --git a/src/unexpand.c b/src/unexpand.c index 7801274..569a7ee 100644 --- a/src/unexpand.c diff --git a/coreutils.spec b/coreutils.spec index e85c4c2..934ed6f 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.32 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ Url: https://www.gnu.org/software/coreutils/ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz @@ -259,6 +259,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %license COPYING %changelog +* Fri Apr 17 2020 Tom Stellard - 8.32-4 +- Fix missing inline function definition + * Wed Mar 11 2020 Kamil Dudka - 8.32-3 - uniq: remove collation handling as required by newer POSIX