Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 870799

Summary: x11-libs/motif-2.3.8-r3 - /.../XpmCrBufFrI.c: error: call to undeclared library function strcpy with type char (char , const char
Product: Gentoo Linux Reporter: Toralf Förster <toralf>
Component: Current packagesAssignee: Ulrich Müller <ulm>
Status: RESOLVED FIXED    
Severity: normal CC: sam
Priority: Normal Keywords: PATCH, UPSTREAM
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 870412    
Attachments: emerge-info.txt
clang.tar.bz2
emerge-history.txt
environment
etc.portage.tar.bz2
logs.tar.bz2
temp.tar.bz2
x11-libs:motif-2.3.8-r3:20220917-144650.log
motif-2.3.8-string_h.patch
motif-2.3.8-acinclude.patch
motif-2.3.8-acinclude.patch

Description Toralf Förster gentoo-dev 2022-09-17 15:34:13 UTC
^
/var/tmp/portage/x11-libs/motif-2.3.8-r3/work/motif-2.3.8/lib/Xm/XpmP.h:61:37: note: expanded from macro 'XpmCreateBufferFromXpmImage'
#define XpmCreateBufferFromXpmImage XmeXpmCreateBufferFromXpmImage
                                    ^
/var/tmp/portage/x11-libs/motif-2.3.8-r3/work/motif-2.3.8/lib/Xm/XpmCrBufFrI.c:155:5: error: call to undeclared library function 'strcpy' with type 'char *(char *, const char *)'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
    strcpy(ptr, buf);
    ^

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1-j4-20220915-203738

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-12.2.0 *
clang/llvm (if any):
clang version 15.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/15/bin
/usr/lib/llvm/15
15.0.0
Python 3.10.7
Available Ruby profiles:
  (none found)
Available Rust versions:
  [1]   rust-bin-1.63.0 *
The following VMs are available for generation-2:
1)	Eclipse Temurin JDK 11.0.16.1_p1 [openjdk-bin-11]
*)	Eclipse Temurin JDK 17.0.4.1_p1 [openjdk-bin-17]
3)	Eclipse Temurin JDK 8.345_p01 [openjdk-bin-8]
Available Java Virtual Machines:
  [1]   openjdk-bin-8 
  [2]   openjdk-bin-11 
  [3]   openjdk-bin-17  system-vm

The Glorious Glasgow Haskell Compilation System, version 9.0.2
php cli (if any):
  [1]   php8.1 *
GNU Make 4.3.90

  HEAD of ::gentoo
commit a7abb04fd6c213f3bf85ff69b1fd07d64b30626c
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Sat Sep 17 13:46:46 2022 +0000

    2022-09-17 13:46:46 UTC

emerge -qpvO x11-libs/motif
[ebuild  N    ] x11-libs/motif-2.3.8-r3  USE="motif22-compatibility unicode -examples -jpeg -png -static-libs -xft" ABI_X86="(64) -32 (-x32)"
Comment 1 Toralf Förster gentoo-dev 2022-09-17 15:34:14 UTC
Created attachment 807790 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2022-09-17 15:34:15 UTC
Created attachment 807793 [details]
clang.tar.bz2
Comment 3 Toralf Förster gentoo-dev 2022-09-17 15:34:16 UTC
Created attachment 807796 [details]
emerge-history.txt
Comment 4 Toralf Förster gentoo-dev 2022-09-17 15:34:18 UTC
Created attachment 807799 [details]
environment
Comment 5 Toralf Förster gentoo-dev 2022-09-17 15:34:19 UTC
Created attachment 807802 [details]
etc.portage.tar.bz2
Comment 6 Toralf Förster gentoo-dev 2022-09-17 15:34:20 UTC
Created attachment 807805 [details]
logs.tar.bz2
Comment 7 Toralf Förster gentoo-dev 2022-09-17 15:34:22 UTC
Created attachment 807808 [details]
temp.tar.bz2
Comment 8 Toralf Förster gentoo-dev 2022-09-17 15:34:24 UTC
Created attachment 807811 [details]
x11-libs:motif-2.3.8-r3:20220917-144650.log
Comment 9 Ulrich Müller gentoo-dev 2022-09-17 18:11:44 UTC
Missing include for <string.h>?
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-17 18:14:45 UTC
(In reply to Ulrich Müller from comment #9)
> Missing include for <string.h>?

Yeah, looks like it. I'd also fix the prototypes if possible, as that's a timebomb.
Comment 11 Ulrich Müller gentoo-dev 2022-09-17 18:35:21 UTC
Created attachment 808678 [details, diff]
motif-2.3.8-string_h.patch

Please test if attached patch fixes the problem.
Comment 12 Ulrich Müller gentoo-dev 2022-09-17 18:53:16 UTC
(In reply to Sam James from comment #10)
> I'd also fix the prototypes if possible, as that's a timebomb.

That's something that should be reported and fixed upstream.
Comment 13 David Seifert gentoo-dev 2022-09-17 20:01:12 UTC
(In reply to Ulrich Müller from comment #12)
> (In reply to Sam James from comment #10)
> > I'd also fix the prototypes if possible, as that's a timebomb.
> 
> That's something that should be reported and fixed upstream.

You are the maintainer, I'd expect you to do this then?
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-17 20:09:19 UTC
(In reply to Ulrich Müller from comment #12)
> (In reply to Sam James from comment #10)
> > I'd also fix the prototypes if possible, as that's a timebomb.
> 
> That's something that should be reported and fixed upstream.

I'm really just giving a heads up that the log indicates other issues which _will_ become fatal when compilers inevitably change to C23.

If you want to be pre-emptive, you can just get -std= if you want.

I've got hundreds of these to handle, I can't report it myself.
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-20 21:32:45 UTC
*** Bug 882181 has been marked as a duplicate of this bug. ***
Comment 16 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-22 07:40:07 UTC
(In reply to Ulrich Müller from comment #11)
> Created attachment 808678 [details, diff] [details, diff]
> motif-2.3.8-string_h.patch
> 
> Please test if attached patch fixes the problem.

Fixes the reported problem for me, however, in config.log:
```
configure:14286: checking whether libXt was compiled with -DXTHREADS
configure:14316: x86_64-pc-linux-gnu-gcc -o conftest  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -fno-strict-aliasing -Werror=implicit-function-declaration -
Werror=implicit-int   -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs conftest.c  -lXt  -lSM -lICE -lX11   >&5
conftest.c: In function 'main':
conftest.c:29:3: error: implicit declaration of function 'exit' [-Werror=implicit-function-declaration]
   29 |   exit(0);
      |   ^~~~
conftest.c:25:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
   24 | #include <X11/Intrinsic.h>
  +++ |+#include <stdlib.h>
   25 | int main() {
conftest.c:29:3: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   29 |   exit(0);
      |   ^~~~
conftest.c:29:3: note: include '<stdlib.h>' or provide a declaration of 'exit'
conftest.c:31:3: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   31 |   exit(1);
      |   ^~~~
conftest.c:31:3: note: include '<stdlib.h>' or provide a declaration of 'exit'
cc1: some warnings being treated as errors
configure:14316: $? = 1
```

and
```
configure:15796: checking whether sprintf returns void
configure:15811: x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -fno-strict-aliasing -Werror=implicit-function-declaration -W
error=implicit-int  -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs conftest.c  >&5
conftest.c:53:5: error: conflicting types for 'sprintf'; have 'int()'
   53 | int sprintf(); main() { exit(sprintf(".")); }
      |     ^~~~~~~
conftest.c:53:1: note: a parameter list with an ellipsis cannot match an empty parameter name list declaration
   53 | int sprintf(); main() { exit(sprintf(".")); }
      | ^~~
In file included from /usr/include/features.h:490,
                 from /usr/include/bits/libc-header-start.h:33,
                 from /usr/include/stdio.h:27,
                 from conftest.c:52:
/usr/include/bits/stdio2.h:28:1: note: previous definition of 'sprintf' with type 'int(char *, const char *, ...)'
   28 | __NTH (sprintf (char *__restrict __s, const char *__restrict __fmt, ...))
      | ^~~~~
conftest.c:53:16: error: return type defaults to 'int' [-Werror=implicit-int]
   53 | int sprintf(); main() { exit(sprintf(".")); }
      |                ^~~~
conftest.c: In function 'main':
conftest.c:53:25: error: implicit declaration of function 'exit' [-Werror=implicit-function-declaration]
   53 | int sprintf(); main() { exit(sprintf(".")); }
      |                         ^~~~
conftest.c:53:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
   52 | #include <stdio.h>
  +++ |+#include <stdlib.h>
   53 | int sprintf(); main() { exit(sprintf(".")); }
conftest.c:53:25: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
   53 | int sprintf(); main() { exit(sprintf(".")); }
      |                         ^~~~
conftest.c:53:25: note: include '<stdlib.h>' or provide a declaration of 'exit'
cc1: some warnings being treated as errors
```
Comment 17 Ulrich Müller gentoo-dev 2022-11-22 09:13:26 UTC
Created attachment 835861 [details, diff]
motif-2.3.8-acinclude.patch

(In reply to Sam James from comment #16)
> Fixes the reported problem for me, however, in config.log:
> ```
> [...]
> ```

*sigh*
Try attached patch (in addition to the previous patch).
Comment 18 Ulrich Müller gentoo-dev 2022-11-22 10:17:40 UTC
(In reply to Ulrich Müller from comment #12)
> That's something that should be reported and fixed upstream.

Their bug tracker at bugs.motifzone.net is down since several months, therefore I have now reported the issue per e-mail to <support@ics.com>.
Comment 19 Ulrich Müller gentoo-dev 2022-11-22 12:28:46 UTC
Created attachment 835867 [details, diff]
motif-2.3.8-acinclude.patch
Comment 20 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-23 08:38:31 UTC
(In reply to Ulrich Müller from comment #19)
> Created attachment 835867 [details, diff] [details, diff]
> motif-2.3.8-acinclude.patch

WFM, thank you! I suggest changing to int main(void) while there to head off -Wstrict-prototypes (no need to do it everywhere right now, but if you're already on the line..)
Comment 21 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-23 08:51:02 UTC
See also: https://sourceforge.net/p/motif/code/merge-requests/3/.
Comment 23 Larry the Git Cow gentoo-dev 2022-11-23 09:06:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/dev/ulm.git/commit/?id=2e3d889da79e4e362129438fd699c2758e17fc36

commit 2e3d889da79e4e362129438fd699c2758e17fc36
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-11-23 09:04:48 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-11-23 09:04:48 +0000

    motif: Fix some function declarations
    
    Bug: https://bugs.gentoo.org/870799
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 patchsets/motif/2.3.8/10_all_string_h.patch  | 22 ++++++++++++++++++++++
 patchsets/motif/2.3.8/11_all_acinclude.patch | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)
Comment 24 Larry the Git Cow gentoo-dev 2022-11-23 09:24:44 UTC
The bug has been closed via the following commit(s):

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

commit af0fe7b8933f09dbb41227b43c7d4d831b3c162d
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2022-11-23 09:23:02 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2022-11-23 09:24:12 +0000

    x11-libs/motif: Fix some function declarations
    
    Closes: https://bugs.gentoo.org/864533
    Closes: https://bugs.gentoo.org/870799
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 x11-libs/motif/Manifest              |   1 +
 x11-libs/motif/motif-2.3.8-r4.ebuild | 112 +++++++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)