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.
Reported at:
https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html
../lib/freadahead.c: In function 'freadahead':
../lib/freadahead.c:97:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
#error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
^~~~~
../lib/freadahead.c:99:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[2]: *** [Makefile:9144: lib/freadahead.o] Error 1
make[2]: *** Waiting for unfinished jobs....
../lib/freadptr.c: In function 'freadptr':
../lib/freadptr.c:119:3: error: #error "Please port gnulib freadptr.c to your platform! Look at the definition of fflush, fread, getc, getc_unlocked on your system, then report this to bug-gnulib."
#error "Please port gnulib freadptr.c to your platform! Look at the definition of fflush, fread, getc, getc_unlocked on your system, then report this to bug-gnulib."
^~~~~
../lib/freadptr.c:29:10: warning: unused variable 'size' [-Wunused-variable]
size_t size;
^~~~
../lib/freadptr.c:121:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^