Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 734984 - app-crypt/libmd installs generically named headers directly to /usr/include
Summary: app-crypt/libmd installs generically named headers directly to /usr/include
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Debian-related package maintainers [DISBANDED]
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-31 17:31 UTC by Lars Wendler (Polynomial-C) (RETIRED)
Modified: 2021-02-01 05:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,263.47 KB, text/plain)
2020-07-31 17:31 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2020-07-31 17:31:54 UTC
Created attachment 651912 [details]
build.log

Apparently, app-crypt/libmd's /usr/include/sha2.h file is bleeding into openssh build:

x86_64-pc-linux-gnu-gcc -march=native -mtune=native -O2 -pipe -pipe -Wno-error=format-truncation -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -Wimp
licit-fallthrough -fno-strict-aliasing  -ftrapv -fno-builtin-memset -fstack-protector-strong -fPIE   -I. -I.  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE  -DSSHDIR=\"/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/usr/bin/ssh\" -D_PATH_SSH_ASK
PASS_DEFAULT=\"/usr/lib64/misc/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/usr/lib64/misc/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/usr/lib64/misc/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/usr/lib64/misc/ssh-pkcs11-helper\" -D_PATH_SSH_SK_HELPER=\
"/usr/lib64/misc/ssh-sk-helper\" -D_PATH_SSH_PIDDIR=\"/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c sk-usbhid.c -o sk-usbhid.o
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:57:16: error: redefinition of ‘struct _SHA2_CTX’
   57 | typedef struct _SHA2_CTX {
      |                ^~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:66:16: note: originally defined here
   66 | typedef struct _SHA2_CTX {
      |                ^~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:64:3: error: conflicting types for ‘SHA2_CTX’
   64 | } SHA2_CTX;
      |   ^~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:73:3: note: previous declaration of ‘SHA2_CTX’ was here
   73 | } SHA2_CTX;
      |   ^~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:70:6: error: conflicting types for ‘SHA256Init’
   70 | void SHA256Init(SHA2_CTX *);
      |      ^~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:96:6: note: previous declaration of ‘SHA256Init’ was here
   96 | void SHA256Init(SHA2_CTX *);
      |      ^~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:72:6: error: conflicting types for ‘SHA256Update’
   72 | void SHA256Update(SHA2_CTX *, const uint8_t *, size_t);
      |      ^~~~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:98:6: note: previous declaration of ‘SHA256Update’ was here
   98 | void SHA256Update(SHA2_CTX *, const u_int8_t *, size_t)
      |      ^~~~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:73:6: error: conflicting types for ‘SHA256Pad’
   73 | void SHA256Pad(SHA2_CTX *);
      |      ^~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:100:6: note: previous declaration of ‘SHA256Pad’ was here
  100 | void SHA256Pad(SHA2_CTX *);
      |      ^~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:74:6: error: conflicting types for ‘SHA256Final’
   74 | void SHA256Final(uint8_t [SHA256_DIGEST_LENGTH], SHA2_CTX *);
      |      ^~~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:101:6: note: previous declaration of ‘SHA256Final’ was here
  101 | void SHA256Final(u_int8_t [SHA256_DIGEST_LENGTH], SHA2_CTX *)
      |      ^~~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:75:7: error: conflicting types for ‘SHA256End’
   75 | char *SHA256End(SHA2_CTX *, char *);
      |       ^~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:103:7: note: previous declaration of ‘SHA256End’ was here
  103 | char *SHA256End(SHA2_CTX *, char *)
      |       ^~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:80:6: error: conflicting types for ‘SHA384Init’
   80 | void SHA384Init(SHA2_CTX *);
      |      ^~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:115:6: note: previous declaration of ‘SHA384Init’ was here
  115 | void SHA384Init(SHA2_CTX *);
      |      ^~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:82:6: error: conflicting types for ‘SHA384Update’
   82 | void SHA384Update(SHA2_CTX *, const uint8_t *, size_t);
      |      ^~~~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:117:6: note: previous declaration of ‘SHA384Update’ was here
  117 | void SHA384Update(SHA2_CTX *, const u_int8_t *, size_t)
      |      ^~~~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:83:6: error: conflicting types for ‘SHA384Pad’
   83 | void SHA384Pad(SHA2_CTX *);
      |      ^~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:119:6: note: previous declaration of ‘SHA384Pad’ was here
  119 | void SHA384Pad(SHA2_CTX *);
      |      ^~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:84:6: error: conflicting types for ‘SHA384Final’
   84 | void SHA384Final(uint8_t [SHA384_DIGEST_LENGTH], SHA2_CTX *);
      |      ^~~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:120:6: note: previous declaration of ‘SHA384Final’ was here
  120 | void SHA384Final(u_int8_t [SHA384_DIGEST_LENGTH], SHA2_CTX *)
      |      ^~~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:85:7: error: conflicting types for ‘SHA384End’
   85 | char *SHA384End(SHA2_CTX *, char *);
      |       ^~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:122:7: note: previous declaration of ‘SHA384End’ was here
  122 | char *SHA384End(SHA2_CTX *, char *)
      |       ^~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:90:6: error: conflicting types for ‘SHA512Init’
   90 | void SHA512Init(SHA2_CTX *);
      |      ^~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:134:6: note: previous declaration of ‘SHA512Init’ was here
  134 | void SHA512Init(SHA2_CTX *);
      |      ^~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:92:6: error: conflicting types for ‘SHA512Update’
   92 | void SHA512Update(SHA2_CTX *, const uint8_t *, size_t);
      |      ^~~~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:136:6: note: previous declaration of ‘SHA512Update’ was here
  136 | void SHA512Update(SHA2_CTX *, const u_int8_t *, size_t)
      |      ^~~~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:93:6: error: conflicting types for ‘SHA512Pad’
   93 | void SHA512Pad(SHA2_CTX *);
      |      ^~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:138:6: note: previous declaration of ‘SHA512Pad’ was here
  138 | void SHA512Pad(SHA2_CTX *);
      |      ^~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:94:6: error: conflicting types for ‘SHA512Final’
   94 | void SHA512Final(uint8_t [SHA512_DIGEST_LENGTH], SHA2_CTX *);
      |      ^~~~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:139:6: note: previous declaration of ‘SHA512Final’ was here
  139 | void SHA512Final(u_int8_t [SHA512_DIGEST_LENGTH], SHA2_CTX *)
      |      ^~~~~~~~~~~
In file included from sk-usbhid.c:28:
/usr/include/sha2.h:95:7: error: conflicting types for ‘SHA512End’
   95 | char *SHA512End(SHA2_CTX *, char *);
      |       ^~~~~~~~~
In file included from openbsd-compat/openbsd-compat.h:46,
                 from includes.h:174,
                 from sk-usbhid.c:17:
openbsd-compat/sha2.h:141:7: note: previous declaration of ‘SHA512End’ was here
  141 | char *SHA512End(SHA2_CTX *, char *)
      |       ^~~~~~~~~
make: *** [Makefile:197: sk-usbhid.o] Error 1
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2020-07-31 18:21:16 UTC
OK, that's bad. Is there anything app-crypt should change?
Comment 2 Patrick McLean gentoo-dev 2020-07-31 18:39:26 UTC
This is actually a bug in app-crypt/libmd, it should not be installing generic names such as "sha2.h" to the root of /usr/include, instead it should install it's headers to /usr/inclide/libmd so they don't pollute the main namespace. This will probably cause problems with other packages as well.

I am going to push a workaround to openssh for now, but app-crypt/libmd really should be fixed.
Comment 3 Larry the Git Cow gentoo-dev 2020-07-31 18:41:28 UTC
The bug has been referenced in the following commit(s):

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

commit eaf0a3123c2d98d8a7c6f3a46f6565577cf0d11a
Author:     Patrick McLean <patrick.mclean@sony.com>
AuthorDate: 2020-07-31 18:41:04 +0000
Commit:     Patrick McLean <chutzpah@gentoo.org>
CommitDate: 2020-07-31 18:41:19 +0000

    net-misc/openssh-8.3_p1-r4: Add workaround libmd bug 734984
    
    Bug: https://bugs.gentoo.org/734984
    Copyright: Sony Interactive Entertainment Inc.
    Package-Manager: Portage-3.0.1, Repoman-2.3.23
    Signed-off-by: Patrick McLean <chutzpah@gentoo.org>

 net-misc/openssh/files/openssh-8.3_p1-sha2-include.patch | 13 +++++++++++++
 net-misc/openssh/openssh-8.3_p1-r4.ebuild                |  3 +++
 2 files changed, 16 insertions(+)
Comment 4 Patrick McLean gentoo-dev 2020-07-31 18:58:23 UTC
libmd installs these headers:
/usr/include/sha512.h
/usr/include/sha256.h
/usr/include/sha.h
/usr/include/ripemd.h
/usr/include/sha2.h
/usr/include/sha1.h
/usr/include/rmd160.h
/usr/include/md5.h
/usr/include/md4.h
/usr/include/md2.h

These are all very generic names with a high chance of causing compilation failures in packages all over the tree. Please update the ebuild to install these files to /usr/include/libmd instead (make sure to update the pkgconfig file to reflect the new location.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2020-08-01 02:58:42 UTC
(In reply to Larry the Git Cow from comment #3)
> The bug has been referenced in the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=eaf0a3123c2d98d8a7c6f3a46f6565577cf0d11a
> 
> commit eaf0a3123c2d98d8a7c6f3a46f6565577cf0d11a
> Author:     Patrick McLean <patrick.mclean@sony.com>
> AuthorDate: 2020-07-31 18:41:04 +0000
> Commit:     Patrick McLean <chutzpah@gentoo.org>
> CommitDate: 2020-07-31 18:41:19 +0000
> 
>     net-misc/openssh-8.3_p1-r4: Add workaround libmd bug 734984
>     
>     Bug: https://bugs.gentoo.org/734984
>     Copyright: Sony Interactive Entertainment Inc.
>     Package-Manager: Portage-3.0.1, Repoman-2.3.23
>     Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
> 
>  net-misc/openssh/files/openssh-8.3_p1-sha2-include.patch | 13 +++++++++++++
>  net-misc/openssh/openssh-8.3_p1-r4.ebuild                |  3 +++
>  2 files changed, 16 insertions(+)

Your workaround seems a bit broad. Couldn't you just have removed a single line?

--- configure.ac.orig   2020-08-01 04:42:54.946113106 +0200
+++ configure.ac        2020-08-01 04:57:11.090469906 +0200
@@ -407,7 +407,6 @@
        readpassphrase.h \
        rpc/types.h \
        security/pam_appl.h \
-       sha2.h \
        shadow.h \
        stddef.h \
        stdint.h \
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2020-08-01 03:12:02 UTC
Now that you have completely changed the purpose of this bug report, is it OK to close it as WONTFIX?
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2020-08-01 06:15:21 UTC
checking md5.h usability... no
checking md5.h presence... no
checking for md5.h... no
configure: error: in `/home/jer/portage/app-arch/dpkg-1.20.5/work/dpkg-1.20.5':
configure: error: md5 digest functions not found
See `config.log' for more details

...


make -C pgpring pgpring
make[2]: Entering directory '/home/jer/portage/app-crypt/signing-party-2.11/work/signing-party-2.11/keyanalyze/pgpring'
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.     -frecord-gcc-switches -g -pipe -O2 -Wall -march=amdfam10 -mtune=amdfam10 -fno-common -Wno-comment -MT pgppubring.o -MD -MP -MF .deps/pgppubring.Tpo -c -o pgppubring.o pgppubring.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.     -frecord-gcc-switches -g -pipe -O2 -Wall -march=amdfam10 -mtune=amdfam10 -fno-common -Wno-comment -MT pgplib.o
-MD -MP -MF .deps/pgplib.Tpo -c -o pgplib.o pgplib.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.     -frecord-gcc-switches -g -pipe -O2 -Wall -march=amdfam10 -mtune=amdfam10 -fno-common -Wno-comment -MT lib.o -MD -MP -MF .deps/lib.Tpo -c -o lib.o lib.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.     -frecord-gcc-switches -g -pipe -O2 -Wall -march=amdfam10 -mtune=amdfam10 -fno-common -Wno-comment -MT extlib.o
-MD -MP -MF .deps/extlib.Tpo -c -o extlib.o extlib.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.     -frecord-gcc-switches -g -pipe -O2 -Wall -march=amdfam10 -mtune=amdfam10 -fno-common -Wno-comment -MT pgppacket.o -MD -MP -MF .deps/pgppacket.Tpo -c -o pgppacket.o pgppacket.c
pgppacket.c:27:10: fatal error: sha1.h: No such file or directory
   27 | #include "sha1.h"
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [Makefile:405: pgppacket.o] Error 1
make[2]: *** Waiting for unfinished jobs....
pgppubring.c:48:10: fatal error: sha1.h: No such file or directory
   48 | #include <sha1.h>
      |          ^~~~~~~~
compilation terminated.
make[2]: *** [Makefile:405: pgppubring.o] Error 1
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2020-08-01 06:18:35 UTC
(In reply to Patrick McLean from comment #4)
> make sure to update the pkgconfig file to reflect the new location.

Make sure all packages upstream actually use pkg-config in the first place:

- openssh does not, which is what got us here; it just looks for a (very familiar) sha2.h like on some BSDs and unsurprisingly finds it.
- dpkg and signing-party do not; these are Debian sourced packages that assume no conflict over these header files at all.
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2020-08-01 06:26:24 UTC
A simple --includedir="${EROOT}"/usr/include/${PN} argument in libmd configure would also make the man pages it installs inconsistent, e.g. sha2.3 would still mention "#include <sha2.h>" and not #include <libmd/sha2.h>.