zip: Don't define NO_DIR
PATCH 1/1 zip: Don't define NO_DIR
The build framework of zip adds -DNO_DIR to CFLAGS after failing to link this piece of test code:
int main() { return closedir(opendir(".")); }
However, zip does not take a case into account when it does not need to link to an extra library for these functions.
When -DNO_DIR is used, the code in unix.c defines custom opendir()/readdir()/closedir() functions in a way that GCC 14 chokes on.
GLIBC has both <dirent.h> and <sys/dir.h> and apps don't need any extra library to link with.
Add a patch to remove the definition of NO_DIR.
Instead, use -DHAVE_DIRENT_H in the recipe.
Remove 0002-unix.c-Do-not-redefine-DIR-as-FILE.patch which is now unnecessary.
This fixes the compiler error observed with GCC 14.
--- ...2-unix.c-Do-not-redefine-DIR-as-FILE.patch | 35 ------------------- .../zip/zip-3.0/dont-define-NO_DIR.patch | 14 ++++++++ meta/recipes-extended/zip/zip_3.0.bb | 6 ++-- 3 files changed, 17 insertions(+), 38 deletions(-) delete mode 100644 meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch create mode 100644 meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch
meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch deleted +0 -35
@@ -1,35 +0,0 @@ -From 76f5bf3546d826dcbc03acbefcf0b10b972bf136 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Wed, 10 Aug 2022 17:19:38 -0700 -Subject: [PATCH 2/2] unix.c: Do not redefine DIR as FILE - -DIR is already provided on Linux via -/usr/include/dirent.h system header - -Upstream-Status: Inactive-Upstream -Signed-off-by: Khem Raj <[email protected]> ---- - unix/unix.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/unix/unix.c b/unix/unix.c -index ba87614..6e6f4d2 100644 ---- a/unix/unix.c -+++ b/unix/unix.c -@@ -61,13 +61,11 @@ local time_t label_utim = 0; - /* Local functions */ - local char *readd OF((DIR *)); - -- - #ifdef NO_DIR /* for AT&T 3B1 */ - #include <sys/dir.h> - #ifndef dirent - # define dirent direct - #endif --typedef FILE DIR; - /* - ** Apparently originally by Rich Salz. - ** Cleaned up and modified by James W. Birdsall. --- -2.37.1 -
meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch new file +14 -0
@@ -0,0 +1,14 @@ +Upstream-Status: Inactive-Upstream [no upstream] +Signed-off-by: Zoltán Böszörményi <[email protected]> + +--- zip30/unix/configure~ 2024-05-01 07:22:18.000000000 +0200 ++++ zip30/unix/configure 2024-05-01 07:23:04.725337836 +0200 +@@ -604,8 +604,6 @@ + done + if [ ${OPT} ]; then + LFLAGS2="${LFLAGS2} ${OPT}" +- else +- CFLAGS="${CFLAGS} -DNO_DIR" + fi + fi +
meta/recipes-extended/zip/zip_3.0.bb +3 -3
@@ -17,8 +17,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar. file://0002-configure-support-PIC-code-build.patch \ file://0001-configure-Use-CFLAGS-and-LDFLAGS-when-doing-link-tes.patch \ file://0001-configure-Specify-correct-function-signatures-and-de.patch \ - file://0002-unix.c-Do-not-redefine-DIR-as-FILE.patch \ file://0001-unix-configure-use-_Static_assert-to-do-correct-dete.patch \ + file://dont-define-NO_DIR.patch \ " UPSTREAM_VERSION_UNKNOWN = "1"
@@ -32,8 +32,8 @@ CVE_STATUS[CVE-2018-13684] = "cpe-incorrect: Not for zip but for smart contract # CFLAGS_NOOPT. It will also force -O3 optimization, overriding # whatever we set. EXTRA_OEMAKE = "'CC=${CC}' 'BIND=${CC}' 'AS=${CC} -c' 'CPP=${CPP}' \ - 'CFLAGS=-I. -DUNIX ${CFLAGS}' \ - 'CFLAGS_NOOPT=-I. -DUNIX ${CFLAGS}' \ + 'CFLAGS=-I. -DUNIX -DHAVE_DIRENT_H ${CFLAGS}' \ + 'CFLAGS_NOOPT=-I. -DUNIX -DHAVE_DIRENT_H ${CFLAGS}' \ 'INSTALL=install' 'INSTALL_D=install -d' \ 'BINFLAGS=0755'"
Signature · 1 line
2.44.0
Patchtest results for [PATCH] zip: Don't define NO_DIR
Thank you for your submission. Patchtest identified one or more issues with the patch. Please see the log below for more information:
---
Testing patch /home/patchtest/share/mboxes/zip-Don-t-define-NO_DIR.patch
FAIL: test Upstream-Status presence: Upstream-Status is in incorrect format (test_patch.TestPatch.test_upstream_status_presence_format)
PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
PASS: test CVE check ignore (test_metadata.TestMetadata.test_cve_check_ignore)
PASS: test CVE tag format (test_patch.TestPatch.test_cve_tag_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test Signed-off-by presence (test_patch.TestPatch.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test lic files chksum modified not mentioned (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test src uri left files (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
SKIP: test target mailing list: Series merged, no reason to check other mailing lists (test_mbox.TestMbox.test_target_mailing_list)
---
Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this email with an explanation of why the patch should be accepted. If you believe these results are due to an error in patchtest, please submit a bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!
Quoted 32 lines · Zoltan Boszormenyi via lists.openembedded.org
The build framework of zip adds -DNO_DIR to CFLAGS after failing to link this piece of test code:
int
main(){ return closedir(opendir(".")); }However, zip does not take a case into account when it does not need to link to an extra library for these functions.
When -DNO_DIR is used, the code in
unix.cdefines custom opendir()/readdir()/closedir() functions in a way that GCC 14 chokes on.GLIBC has both <
dirent.h> and <sys/dir.h> and apps don't need any extra library to link with.Add a patch to remove the definition of
NO_DIR.
Instead, use -DHAVE_DIRENT_H in the recipe.Remove 0002-unix.c-Do-not-redefine-DIR-as-FILE.patch which is now unnecessary.
This fixes the compiler error observed with GCC 14.
Signed-off-by Zoltán Böszörményi <[email protected]>---
...2-unix.c-Do-not-redefine-DIR-as-FILE.patch | 35 ------------------- .../zip/zip-3.0/dont-define-NO_DIR.patch | 14 ++++++++ meta/recipes-extended/zip/zip_3.0.bb | 6 ++--3 files changed, 17 insertions(+), 38 deletions(-)delete mode 100644
meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patchcreate mode 100644meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch
[...]
meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch line 6
Quoted 12 lines
meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch new file +6
-0@@ -0,0 +1,14 @@ +Upstream-Status: Inactive-Upstream [no upstream] +Signed-off-by: Zoltán Böszörményi <[email protected]> + +--- zip30/unix/configure~ 2024-05-01 07:22:18.000000000 +0200 ++++ zip30/unix/configure 2024-05-01 07:23:04.725337836 +0200 +
I'm struggling to get to replying to patches for review but I just wanted to explain the issue here.
The challenge is this change removed one patch and added a new one which is fine but the new patch has no headers/information on it.
In the context of this commit, it makes sense but anyone coming to it later would wonder what the issue was, why it was there and so on.
Whilst it is a pain, some of the info in the commit does need to be duplicated into the patch header so that over time, we can know why we're carrying these things.
I believe Khem tweaked and sent a v2.
Cheers,
Richard