Bug 275958 - benchmarks/stress-ng: namespace collision for crypt_data if libxcrypt installed
Summary: benchmarks/stress-ng: namespace collision for crypt_data if libxcrypt installed
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Luca Pizzamiglio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-27 05:09 UTC by John Hein
Modified: 2024-01-12 16:57 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (pizzamig)


Attachments
[patch] avoid conflicting crypt_data definitions (crypt.h vs unistd.h) (966 bytes, patch)
2023-12-27 05:09 UTC, John Hein
jcfyecrayz: maintainer-approval? (pizzamig)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2023-12-27 05:09:25 UTC
Created attachment 247278 [details]
[patch] avoid conflicting crypt_data definitions (crypt.h vs unistd.h)

If libxcrypt is installed, the build for benchmarks/stress-ng fails (after the recent update to 0.17.03 - but it failed with 0.16.02, too).

 .
 .
cc -O2 -pipe  -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -Wall -Wextra -DVERSION='"0.17.03"' -std=gnu99 -fstack-protector-strong -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -c -o stress-cyclic.o stress-cyclic.c
In file included from stress-crypt.c:24:
/usr/local/include/crypt.h:73:8: error: redefinition of 'crypt_data'
struct crypt_data
       ^
/usr/include/unistd.h:489:8: note: previous definition is here
struct crypt_data {
       ^
1 error generated.
gmake[2]: *** [Makefile:618: stress-crypt.o] Error 1


The attached patch fixes this by preventing the build from using <localbase>/include/crypt.h

While here, the patch adds do-configure so that the configure is a separate step than 'make build'.  This is more typical of the way most FreeBSD ports work.  But this change is not required to fix the crypt_data namespace conflict.

No need for PORTREVISION bump as the resulting package is the same before and after the change (assuming your port build did not fail because of the problem described here).
Comment 1 John Hein 2023-12-27 05:18:09 UTC
QA:
  poudriere testport (bulk build including libxcrypt & stress-ng): ok
  portlint: no new warnings or errors
  portclippy: no new misordered lines
  portfmt: no new formatting improvement suggestions

p.s. The previous patch includes a commented out USES line.  Please just ignore that.
Comment 2 Luca Pizzamiglio freebsd_committer freebsd_triage 2024-01-01 22:35:12 UTC
Hi, thanks for reporting.


The patch forcibly disables this stressor, but it seems it's always the case.

In any case, I need to bump the portrevision, as the hash of the package changes.
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-01-01 22:50:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c02edab71ed071ced61003291219f9e22c0dca8f

commit c02edab71ed071ced61003291219f9e22c0dca8f
Author:     Luca Pizzamiglio <pizzamig@FreeBSD.org>
AuthorDate: 2024-01-01 22:49:21 +0000
Commit:     Luca Pizzamiglio <pizzamig@FreeBSD.org>
CommitDate: 2024-01-01 22:49:21 +0000

    benchmarks/stress-ng: disable crypt.h

    In case it's detected, it causes a conflict with a struct
    defined in unistd.h

    PR:             275958
    Reported by:    John Hein <jcfyecrayz@liamekaens.com>

 benchmarks/stress-ng/Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Comment 4 Colin Ian King 2024-01-12 16:57:26 UTC
FYI, I've pushed a commit to stress-ng to fix this build issue:

https://github.com/ColinIanKing/stress-ng/commit/b4b810d2013cff2c3331db51ccd42c2d8c392cea

Hopefully it won't be an issue for the next release next month.