($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: "Zoltán Böszörményi" <zboszor@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: "Zoltán Böszörményi" <zboszor@gmail.com>
Subject: [PATCH] zip: Don't define NO_DIR
Date: Wed,  1 May 2024 08:17:36 +0200	[thread overview]
Message-ID: <20240501061736.3738477-1-zboszor@gmail.com> (raw)

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.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 ...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

diff --git a/meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch b/meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch
deleted file mode 100644
index a86e03e620..0000000000
--- a/meta/recipes-extended/zip/zip-3.0/0002-unix.c-Do-not-redefine-DIR-as-FILE.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 76f5bf3546d826dcbc03acbefcf0b10b972bf136 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-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 <raj.khem@gmail.com>
----
- 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
-
diff --git a/meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch b/meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch
new file mode 100644
index 0000000000..8528dbb55e
--- /dev/null
+++ b/meta/recipes-extended/zip/zip-3.0/dont-define-NO_DIR.patch
@@ -0,0 +1,14 @@
+Upstream-Status: Inactive-Upstream [no upstream]
+Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
+
+--- 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
+ 
diff --git a/meta/recipes-extended/zip/zip_3.0.bb b/meta/recipes-extended/zip/zip_3.0.bb
index 70df5ab872..a548087545 100644
--- a/meta/recipes-extended/zip/zip_3.0.bb
+++ b/meta/recipes-extended/zip/zip_3.0.bb
@@ -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'"
 
-- 
2.44.0



             reply	other threads:[~2024-05-01  6:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-01  6:17 Zoltán Böszörményi [this message]
2024-05-01  6:33 ` Patchtest results for [PATCH] zip: Don't define NO_DIR patchtest
2024-05-09  8:54 ` [OE-core] " Richard Purdie
  -- strict thread matches above, loose matches on Subject: below --
2024-05-01  5:55 Zoltán Böszörményi
2024-05-01  5:55 Zoltán Böszörményi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240501061736.3738477-1-zboszor@gmail.com \
    --to=zboszor@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).