#4 Fix missing inline function definition
Merged 4 years ago by kdudka. Opened 4 years ago by tstellar.
rpms/ tstellar/coreutils mbfile-fix  into  master

@@ -23,6 +23,7 @@ 

   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 @@ 

       }

   }

   

+ 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

file modified
+4 -1
@@ -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 @@ 

  %license COPYING

  

  %changelog

+ * Fri Apr 17 2020 Tom Stellard <tstellar@redhat.com> - 8.32-4

+ - Fix missing inline function definition

+ 

  * Wed Mar 11 2020 Kamil Dudka <kdudka@redhat.com> - 8.32-3

  - uniq: remove collation handling as required by newer POSIX

  

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.

I think that the module was supposed to be listed in lib/gnulib.mk, which is generated by the bootstrap script. But the script does not run during the build from a release tarball (and its effect on the generated files was not reflected in the downstream patch). Since expand and unexpand are the only users of the module, your change to the downstream patch makes sense to me. So I am merging it as it is. Thank you for taking care of it!

Pull-Request has been merged by kdudka

4 years ago