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.
Detected by Coverity Analysis:
Error: RESOURCE_LEAK (CWE-772):
coreutils-8.30/src/sync.c:112: open_fn: Returning handle opened by "open". [Note: The source code implementation of the function has been overridden by a user model.]
coreutils-8.30/src/sync.c:112: var_assign: Assigning: "fd" = handle returned from "open(file, 2049)".
coreutils-8.30/src/sync.c:115: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
113| if (fd < 0)
114| error (0, rd_errno, _("error opening %s"), quoteaf (file));
115|-> return false;
116| }
117|
Bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33287
Error: COMPILER_WARNING:
coreutils-8.30/lib/mgetgroups.c: scope_hint: In function 'mgetgroups'
coreutils-8.30/lib/mgetgroups.c:167:11: warning: implicit declaration of function 'xrealloc'; did you mean 'realloc'? [-Wimplicit-function-declaration]
g = xrealloc (g, max_n_groups * sizeof (GETGROUPS_T));
^~~~~~~~
165| {
166| max_n_groups = ng;
167|-> g = xrealloc (g, max_n_groups * sizeof (GETGROUPS_T));
168| }
169| if (e == -1)
- coreutils-i18n-suse-merge.patch:
* src/exand.c,src/unexpand.c: Avoid -Wcomment warning.
* src/cut.c (cut_characters_or_cut_bytes_no_split): Change idx from size_t
to uintmax_t type to avoid a regression on i586, armv7l and ppc.
Compare upstream, non-MB commit:
https://git.sv.gnu.org/cgit/coreutils.git/commit/?id=d1a754c8272
(cut_fields_mb): Likewise for field_idx.
* tests/misc/cut.pl: Remove downstream tweaks as upstream MB tests are
working since a while.