Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,134 @@
From 8810f2643c9372a8083272dc1fc157427646d961 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 10 Aug 2022 17:16:23 -0700
Subject: [PATCH 1/2] configure: Specify correct function signatures and
declarations
Include needed system headers in configure tests, this is needed because
newer compilers are getting stricter about the C99 specs and turning
-Wimplicit-function-declaration into hard error e.g. clang-15+
Upstream-Status: Inactive-Upstream
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
unix/configure | 79 +++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 66 insertions(+), 13 deletions(-)
diff --git a/unix/configure b/unix/configure
index 1d9a9bb..f2b3d02 100644
--- a/unix/configure
+++ b/unix/configure
@@ -513,21 +513,70 @@ $CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
# Check for missing functions
# add NO_'function_name' to flags if missing
-for func in rmdir strchr strrchr rename mktemp mktime mkstemp
-do
- echo Check for $func
- echo "int main(){ $func(); return 0; }" > conftest.c
- $CC $CFLAGS $LDFLAGS $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
- [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
-done
+echo Check for rmdir
+cat > conftest.c << _EOF_
+#include <unistd.h>
+int main(){ rmdir(NULL); return 0; }
+_EOF_
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RMDIR"
+
+echo Check for strchr
+cat > conftest.c << _EOF_
+#include <string.h>
+int main(){ strchr(NULL,0); return 0; }
+_EOF_
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRCHR"
+echo Check for strrchr
+cat > conftest.c << _EOF_
+#include <string.h>
+int main(){ strrchr(NULL,0); return 0; }
+_EOF_
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_STRRCHR"
+
+echo Check for rename
+cat > conftest.c << _EOF_
+#include <stdio.h>
+int main(){ rename(NULL,NULL); return 0; }
+_EOF_
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_RENAME"
+
+echo Check for mktemp
+cat > conftest.c << _EOF_
+#include <stdlib.h>
+int main(){ mktemp(NULL); return 0; }
+_EOF_
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTEMP"
+
+echo Check for mktime
+cat > conftest.c << _EOF_
+#include <time.h>
+int main(){ mktime(NULL); return 0; }
+_EOF_
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKTIME"
+
+echo Check for mkstemp
+cat > conftest.c << _EOF_
+#include <stdlib.h>
+int main(){ return mkstemp(NULL); }
+_EOF_
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
+[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_MKSTEMP"
echo Check for memset
-echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
+cat > conftest.c << _EOF_
+#include <string.h>
+int main(){ char k; memset(&k,0,0); return 0; }
+_EOF_
$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
-
echo Check for memmove
cat > conftest.c << _EOF_
#include <string.h>
@@ -548,7 +597,7 @@ $CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
echo Check for errno declaration
cat > conftest.c << _EOF_
#include <errno.h>
-main()
+int main()
{
errno = 0;
return 0;
@@ -625,14 +674,18 @@ CFLAGS="${CFLAGS} ${OPT}"
echo Check for valloc
cat > conftest.c << _EOF_
-main()
+#include <stdlib.h>
+int main()
{
#ifdef MMAP
- valloc();
+ valloc(0);
#endif
+ return 0;
}
_EOF_
-$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
+#$CC ${CFLAGS} -c conftest.c > /dev/null 2>/dev/null
+$CC ${CFLAGS} -c conftest.c
+echo "==========================================="
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"
--
2.37.1
@@ -0,0 +1,88 @@
From ab5df4826c4a532da78828b72a2751c899e27ef2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 8 Mar 2022 22:31:21 -0800
Subject: [PATCH] configure: Use CFLAGS and LDFLAGS when doing link tests
Some case link flags contain important flags which are required during
linking, link fails otherwise without them, which can result in
configure detection go wrong, ensure these flags are used along with CC
when tests involve linking
Upstream-Status: Inactive-Upstream
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
unix/configure | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/unix/configure b/unix/configure
index 1bc698b..1d9a9bb 100644
--- a/unix/configure
+++ b/unix/configure
@@ -517,14 +517,14 @@ for func in rmdir strchr strrchr rename mktemp mktime mkstemp
do
echo Check for $func
echo "int main(){ $func(); return 0; }" > conftest.c
- $CC $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
+ $CC $CFLAGS $LDFLAGS $BFLAG -o conftest conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
done
echo Check for memset
echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"
@@ -533,7 +533,7 @@ cat > conftest.c << _EOF_
#include <string.h>
int main() { int a; int b = 0; memmove( &a, &b, sizeof( a)); return a; }
_EOF_
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_MEMMOVE"
@@ -542,7 +542,7 @@ cat > conftest.c << _EOF_
#include <string.h>
int main() { strerror( 0); return 0; }
_EOF_
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNEED_STRERROR"
echo Check for errno declaration
@@ -563,7 +563,7 @@ cat > conftest.c << _EOF_
int main() { return closedir(opendir(".")); }
_EOF_
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
OPT=""
for lib in ndir dir ucb bsd BSD PW x dirent
@@ -583,9 +583,9 @@ fi
echo Check for readlink
echo "int main(){ return readlink(); }" > conftest.c
-$CC -o conftest conftest.c >/dev/null 2>/dev/null
+$CC $CFLAGS $LDFLAGS -o conftest conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
- $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
+ $CC $CFLAGS $LDFLAGS -o conftest conftest.c -lseq >/dev/null 2>/dev/null
[ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
fi
@@ -661,7 +661,7 @@ elif [ -f /xenix ]; then
elif uname -X >/dev/null 2>/dev/null; then
# SCO shared library check
echo "int main() { return 0;}" > conftest.c
- $CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
+ $CC $CFLAGS $LDFLAGS -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
[ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"
else
SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown"
--
2.35.1
@@ -0,0 +1,47 @@
From 7a2729ee7f5d9b9d4a0d9b83fe641a2ab03c4ee0 Mon Sep 17 00:00:00 2001
From: Joe Slater <joe.slater@windriver.com>
Date: Thu, 24 Feb 2022 17:36:59 -0800
Subject: [PATCH 1/2] configure: use correct CPP
configure uses CPP to test that two assembler routines
can be built. Unfortunately, it will use /usr/bin/cpp
if it exists, invalidating the tests. We use the $CC
passed to configure.
Upstream-Status: Inappropriate [openembedded specific]
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
unix/configure | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/unix/configure b/unix/configure
index 73ba803..7e21070 100644
--- a/unix/configure
+++ b/unix/configure
@@ -220,13 +220,16 @@ fi
echo Check for the C preprocessor
# on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
CPP="${CC} -E"
+
+# We should not change CPP for yocto builds.
+#
# solaris as(1) needs -P, maybe others as well ?
-[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
-[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
-[ -f /lib/cpp ] && CPP=/lib/cpp
-[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
-[ -f /xenix ] && CPP="${CC} -E"
-[ -f /lynx.os ] && CPP="${CC} -E"
+# [ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
+# [ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
+# [ -f /lib/cpp ] && CPP=/lib/cpp
+# [ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp
+# [ -f /xenix ] && CPP="${CC} -E"
+# [ -f /lynx.os ] && CPP="${CC} -E"
echo "#include <stdio.h>" > conftest.c
$CPP conftest.c >/dev/null 2>/dev/null || CPP="${CC} -E"
--
2.24.1
@@ -0,0 +1,96 @@
From 9916fc6f1f93f3e092e3c6937c30dc8137c26d34 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Thu, 15 Jun 2023 18:31:26 +0800
Subject: [PATCH] unix/configure: use _Static_assert to do correct detection
We're doing cross compilation, running a cross-compiled problem
on host to detemine feature is not correct. Use _Static_assert
to do the detection correctly.
Upstream-Status: Inactive-Upstream
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
unix/configure | 42 ++++++++++++------------------------------
1 file changed, 12 insertions(+), 30 deletions(-)
diff --git a/unix/configure b/unix/configure
index f2b3d02..f917086 100644
--- a/unix/configure
+++ b/unix/configure
@@ -361,6 +361,10 @@ cat > conftest.c << _EOF_
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
+
+_Static_assert(sizeof((struct stat){0}.st_uid) == 2, "sizeof st_uid is not 16 bit");
+_Static_assert(sizeof((struct stat){0}.st_gid) == 2, "sizeof st_gid is not 16 bit");
+
int main()
{
struct stat s;
@@ -385,21 +389,7 @@ if [ $? -ne 0 ]; then
echo -- UID/GID test failed on compile - disabling old 16-bit UID/GID support
CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
else
-# run it
- ./conftest
- r=$?
- if [ $r -eq 1 ]; then
- echo -- UID not 2 bytes - disabling old 16-bit UID/GID support
- CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
- elif [ $r -eq 2 ]; then
- echo -- GID not 2 bytes - disabling old 16-bit UID/GID support
- CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
- elif [ $r -eq 3 ]; then
- echo -- 16-bit UIDs and GIDs - keeping old 16-bit UID/GID support
- else
- echo -- test failed - conftest returned $r - disabling old 16-bit UID/GID support
- CFLAGS="${CFLAGS} -DUIDGID_NOT_16BIT"
- fi
+ echo -- 16-bit UIDs and GIDs - keeping old 16-bit UID/GID support
fi
@@ -417,6 +407,10 @@ cat > conftest.c << _EOF_
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
+
+_Static_assert(sizeof(off_t) < 8, "sizeof off_t < 8 failed");
+_Static_assert(sizeof((struct stat){0}.st_size) < 8, "sizeof st_size < 8 failed");
+
int main()
{
off_t offset;
@@ -436,24 +430,12 @@ _EOF_
# compile it
$CC -o conftest conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
- echo -- no Large File Support
+ echo -- yes we have Large File Support!
+ CFLAGS="${CFLAGS} -DLARGE_FILE_SUPPORT"
else
-# run it
- ./conftest
- r=$?
- if [ $r -eq 1 ]; then
- echo -- no Large File Support - no 64-bit off_t
- elif [ $r -eq 2 ]; then
- echo -- no Large File Support - no 64-bit stat
- elif [ $r -eq 3 ]; then
- echo -- yes we have Large File Support!
- CFLAGS="${CFLAGS} -DLARGE_FILE_SUPPORT"
- else
- echo -- no Large File Support - conftest returned $r
- fi
+ echo -- no Large File Support
fi
-
# Check for wide char for Unicode support
# Added 11/24/2005 EG
--
2.34.1
@@ -0,0 +1,34 @@
From b0492506d2c28581193906e9d260d4f0451e2c39 Mon Sep 17 00:00:00 2001
From: Joe Slater <joe.slater@windriver.com>
Date: Thu, 24 Feb 2022 17:46:03 -0800
Subject: [PATCH 2/2] configure: support PIC code build
Disable building match.S. The code requires
relocation in .text.
Upstream-Status: Inappropriate [openembedded specific]
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
unix/configure | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/unix/configure b/unix/configure
index 7e21070..1bc698b 100644
--- a/unix/configure
+++ b/unix/configure
@@ -242,8 +242,9 @@ if eval "$CPP match.S > _match.s 2>/dev/null"; then
if test ! -s _match.s || grep error < _match.s > /dev/null; then
:
elif eval "$CC -c _match.s >/dev/null 2>/dev/null" && [ -f _match.o ]; then
- CFLAGS="${CFLAGS} -DASMV"
- OBJA="match.o"
+ # disable match.S for PIC code
+ # CFLAGS="${CFLAGS} -DASMV"
+ # OBJA="match.o"
echo "int foo() { return 0;}" > conftest.c
$CC -c conftest.c >/dev/null 2>/dev/null
echo Check if compiler generates underlines
--
2.24.1
@@ -0,0 +1,35 @@
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
@@ -0,0 +1,19 @@
From: Santiago Vila <sanvila@debian.org>
Subject: Remove (optional) build date to make the build reproducible
Bug-Debian: http://bugs.debian.org/779042
Upstream-Status: Inactive-Upstream [no upstream]
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
--- a/unix/unix.c
+++ b/unix/unix.c
@@ -1020,7 +1020,7 @@
/* Define the compile date string */
-#ifdef __DATE__
+#if 0
# define COMPILE_DATE " on " __DATE__
#else
# define COMPILE_DATE ""
@@ -0,0 +1,42 @@
zip: Fixing security formatting issues
Fix security formatting issues related to printing without NULL argument
zip.c: In function 'help_extended':
zip.c:1031:5: error: format not a string literal and no format arguments [-Werror=format-security]
printf(text[i]);
^
zip.c: In function 'version_info':
zip.c:1228:5: error: format not a string literal and no format arguments [-Werror=format-security]
printf(cryptnote[i]);
^
[YOCTO #9552]
[https://bugzilla.yoctoproject.org/show_bug.cgi?id=9552]
Upstream-Status: Inactive-Upstream [need a new release]
Signed-off-by: Edwin Plauchu <edwin.plauchu.camacho@intel.com>
diff --git a/zip.c b/zip.c
index 439821f..d7da768 100644
--- a/zip.c
+++ b/zip.c
@@ -1028,7 +1028,7 @@ local void help_extended()
for (i = 0; i < sizeof(text)/sizeof(char *); i++)
{
- printf(text[i]);
+ fputs(text[i],stdout);
putchar('\n');
}
#ifdef DOS
@@ -1225,7 +1225,7 @@ local void version_info()
CR_MAJORVER, CR_MINORVER, CR_BETA_VER, CR_VERSION_DATE);
for (i = 0; i < sizeof(cryptnote)/sizeof(char *); i++)
{
- printf(cryptnote[i]);
+ fputs(cryptnote[i],stdout);
putchar('\n');
}
++i; /* crypt support means there IS at least one compilation option */
@@ -0,0 +1,22 @@
Close the correct file descriptor
https://bugs.archlinux.org/task/47713
Signed-off-by: Jate Sujjavanich <jatedev@gmail.com>
Upstream-Status: Inactive-Upstream [no upstream]
diff --git a/zipnote.c b/zipnote.c
index 5e02cb6..996f012 100644
--- a/zipnote.c
+++ b/zipnote.c
@@ -661,7 +661,7 @@ char **argv; /* command line tokens */
if ((r = zipcopy(z)) != ZE_OK)
ziperr(r, "was copying an entry");
}
- fclose(x);
+ fclose(in_file);
/* Write central directory and end of central directory with new comments */
if ((c = zftello(y)) == (zoff_t)-1) /* get start of central */
+56
View File
@@ -0,0 +1,56 @@
SUMMARY = "Compressor/archiver for creating and modifying .zip files"
HOMEPAGE = "http://www.info-zip.org"
DESCRIPTION = "Info-ZIP's purpose is to provide free, portable, high-quality versions of the Zip and UnZip compressor-archiver utilities that are compatible with the DOS-based PKZIP by PKWARE, Inc."
SECTION = "console/utils"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=04d43c5d70b496c032308106e26ae17d"
PR = "r2"
S = "${WORKDIR}/zip30"
SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz \
file://fix-security-format.patch \
file://10-remove-build-date.patch \
file://zipnote-crashes-with-segfault.patch \
file://0001-configure-use-correct-CPP.patch \
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 \
"
UPSTREAM_VERSION_UNKNOWN = "1"
SRC_URI[md5sum] = "7b74551e63f8ee6aab6fbc86676c0d37"
SRC_URI[sha256sum] = "f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369"
CVE_STATUS[CVE-2018-13410] = "disputed: Disputed and also Debian doesn't consider a vulnerability"
CVE_STATUS[CVE-2018-13684] = "cpe-incorrect: Not for zip but for smart contract implementation for it"
# zip.inc sets CFLAGS, but what Makefile actually uses is
# 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}' \
'INSTALL=install' 'INSTALL_D=install -d' \
'BINFLAGS=0755'"
do_compile() {
oe_runmake -f unix/Makefile flags IZ_BZIP2=no_such_directory
sed -i 's#LFLAGS1=""#LFLAGS1="${LDFLAGS}"#' flags
oe_runmake -f unix/Makefile generic IZ_BZIP2=no_such_directory
}
do_install() {
oe_runmake -f unix/Makefile prefix=${D}${prefix} \
BINDIR=${D}${bindir} MANDIR=${D}${mandir}/man1 \
install
}
BBCLASSEXTEND = "native"
# exclude version 2.3.2 which triggers a false positive
UPSTREAM_CHECK_REGEX = "^zip(?P<pver>(?!232).+)\.tgz"