commit dd17b75f03236a9552ab6f2c1fe97e14ece773a5 Author: EnumDev Date: Fri Sep 5 18:57:43 2025 +0300 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e58e5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Exclude bpm archives +*.bpm \ No newline at end of file diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..c98f55d --- /dev/null +++ b/pkg.info @@ -0,0 +1,9 @@ +name: sharutils +description: Utility that makes so-called shell archives out of many files +version: 4.15.2 +url: https://www.gnu.org/software/sharutils/ +license: GPL3-or-later +architecture: any +depends: ["glibc"] +make_depends: ["gettext"] +type: source diff --git a/source-files/sharutils-4.14.2-Pass-compilation-with-Werror-format-security.patch b/source-files/sharutils-4.14.2-Pass-compilation-with-Werror-format-security.patch new file mode 100644 index 0000000..10460af --- /dev/null +++ b/source-files/sharutils-4.14.2-Pass-compilation-with-Werror-format-security.patch @@ -0,0 +1,87 @@ +From 851a240296ad2ec2a5f67e84d284d3bf7882745e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 15 Dec 2014 11:20:32 +0100 +Subject: [PATCH] Pass compilation with -Werror=format-security +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + + + +Signed-off-by: Petr Písař +--- + libopts/genshell.h | 2 +- + src/shar-opts.h | 2 +- + src/unshar-opts.h | 2 +- + src/uudecode-opts.h | 2 +- + src/uuencode-opts.h | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/libopts/genshell.h b/libopts/genshell.h +index 1c18735..0a69bc2 100644 +--- a/libopts/genshell.h ++++ b/libopts/genshell.h +@@ -168,7 +168,7 @@ extern tOptions genshelloptOptions; + # endif + + # ifndef ATTRIBUTE_FORMAT_ARG +-# define ATTRIBUTE_FORMAT_ARG(_a) ++# define ATTRIBUTE_FORMAT_ARG(_a) __attribute__ ((format_arg(_a))) + # endif + + static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); +diff --git a/src/shar-opts.h b/src/shar-opts.h +index 64f2f12..a32b69d 100644 +--- a/src/shar-opts.h ++++ b/src/shar-opts.h +@@ -374,7 +374,7 @@ extern tOptions sharOptions; + # endif + + # ifndef ATTRIBUTE_FORMAT_ARG +-# define ATTRIBUTE_FORMAT_ARG(_a) ++# define ATTRIBUTE_FORMAT_ARG(_a) __attribute__ ((format_arg(_a))) + # endif + + static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); +diff --git a/src/unshar-opts.h b/src/unshar-opts.h +index ae697af..19e8be7 100644 +--- a/src/unshar-opts.h ++++ b/src/unshar-opts.h +@@ -211,7 +211,7 @@ extern tOptions unsharOptions; + # endif + + # ifndef ATTRIBUTE_FORMAT_ARG +-# define ATTRIBUTE_FORMAT_ARG(_a) ++# define ATTRIBUTE_FORMAT_ARG(_a) __attribute__ ((format_arg(_a))) + # endif + + static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); +diff --git a/src/uudecode-opts.h b/src/uudecode-opts.h +index d457488..fd11a20 100644 +--- a/src/uudecode-opts.h ++++ b/src/uudecode-opts.h +@@ -189,7 +189,7 @@ extern tOptions uudecodeOptions; + # endif + + # ifndef ATTRIBUTE_FORMAT_ARG +-# define ATTRIBUTE_FORMAT_ARG(_a) ++# define ATTRIBUTE_FORMAT_ARG(_a) __attribute__ ((format_arg(_a))) + # endif + + static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); +diff --git a/src/uuencode-opts.h b/src/uuencode-opts.h +index 7c7ed78..41352ea 100644 +--- a/src/uuencode-opts.h ++++ b/src/uuencode-opts.h +@@ -185,7 +185,7 @@ extern tOptions uuencodeOptions; + # endif + + # ifndef ATTRIBUTE_FORMAT_ARG +-# define ATTRIBUTE_FORMAT_ARG(_a) ++# define ATTRIBUTE_FORMAT_ARG(_a) __attribute__ ((format_arg(_a))) + # endif + + static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1); +-- +1.9.3 + diff --git a/source-files/sharutils-4.15.2-Do-not-include-lib-md5.c-into-src-shar.c.patch b/source-files/sharutils-4.15.2-Do-not-include-lib-md5.c-into-src-shar.c.patch new file mode 100644 index 0000000..19f77cc --- /dev/null +++ b/source-files/sharutils-4.15.2-Do-not-include-lib-md5.c-into-src-shar.c.patch @@ -0,0 +1,39 @@ +From 4c47a36fb6e2e4349995376cee063bb37d4e68e3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 23 Jan 2020 15:57:05 +0100 +Subject: [PATCH 2/2] Do not include lib/md5.c into src/shar.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +lib/md5.o is part of libgnu.a that is linked to shar. There is no +point in linking md5.o twice into shar executable. Moreover SuSE +reports that this triggers a linking error with GCC 10: + +/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: +../lib/libgnu.a(md5.o): in function `md5_stream': +[ 30s] md5.c:(.text+0x15d): multiple definition of `md5_stream'; +shar.o:shar.c:(.text+0x28): first defined here + + + +Signed-off-by: Petr Písař +--- + src/shar.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/shar.c b/src/shar.c +index 11cbada..6d7ed1d 100644 +--- a/src/shar.c ++++ b/src/shar.c +@@ -53,7 +53,6 @@ static const char cright_years_z[] = + + #include "inttostr.h" + #include "liballoca.h" +-#include "md5.c" + #include "md5.h" + #include "quotearg.h" + #include "xalloc.h" +-- +2.21.1 + diff --git a/source-files/sharutils-4.15.2-Fix-a-heap-buffer-overflow-in-find_archive.patch b/source-files/sharutils-4.15.2-Fix-a-heap-buffer-overflow-in-find_archive.patch new file mode 100644 index 0000000..bf9d583 --- /dev/null +++ b/source-files/sharutils-4.15.2-Fix-a-heap-buffer-overflow-in-find_archive.patch @@ -0,0 +1,58 @@ +From 1067cdba6d08f2a765cb0ea371189a5b703eb4db Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 22 Feb 2018 16:39:43 +0100 +Subject: [PATCH] Fix a heap-buffer-overflow in find_archive() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +rw_buffer has allocated rw_base_size bytes. But subsequend fgets() in +find_archive() reads up-to BUFSIZ bytes. + +On my system, BUFSIZ is 8192. rw_base_size is usually equaled to +a memory page size, 4096 on my system. Thus find_archive() can write +beyonded allocated memmory for rw_buffer array: + +$ valgrind -- ./unshar /tmp/id\:000000\,sig\:06\,src\:000005+000030\,op\:splice\,rep\:4 +==30582== Memcheck, a memory error detector +==30582== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. +==30582== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info +==30582== Command: ./unshar /tmp/id:000000,sig:06,src:000005+000030,op:splice,rep:4 +==30582== +==30582== Invalid write of size 1 +==30582== at 0x4EAB480: _IO_getline_info (in /usr/lib64/libc-2.27.so) +==30582== by 0x4EB47C2: fgets_unlocked (in /usr/lib64/libc-2.27.so) +==30582== by 0x10BF60: fgets_unlocked (stdio2.h:320) +==30582== by 0x10BF60: find_archive (unshar.c:243) +==30582== by 0x10BF60: unshar_file (unshar.c:379) +==30582== by 0x10BCCC: validate_fname (unshar-opts.c:604) +==30582== by 0x10BCCC: main (unshar-opts.c:639) +==30582== Address 0x523a790 is 0 bytes after a block of size 4,096 alloc'd +==30582== at 0x4C2DBBB: malloc (vg_replace_malloc.c:299) +==30582== by 0x10C670: init_unshar (unshar.c:450) +==30582== by 0x10BC55: main (unshar-opts.c:630) + +This was reported in +. + +Signed-off-by: Petr Písař +--- + src/unshar.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/unshar.c b/src/unshar.c +index 80bc3a9..0fc3773 100644 +--- a/src/unshar.c ++++ b/src/unshar.c +@@ -240,7 +240,7 @@ find_archive (char const * name, FILE * file, off_t start) + off_t position = ftello (file); + + /* Read next line, fail if no more and no previous process. */ +- if (!fgets (rw_buffer, BUFSIZ, file)) ++ if (!fgets (rw_buffer, rw_base_size, file)) + { + if (!start) + error (0, 0, _("Found no shell commands in %s"), name); +-- +2.13.6 + diff --git a/source-files/sharutils-4.15.2-Fix-building-with-GCC-10.patch b/source-files/sharutils-4.15.2-Fix-building-with-GCC-10.patch new file mode 100644 index 0000000..c423fe1 --- /dev/null +++ b/source-files/sharutils-4.15.2-Fix-building-with-GCC-10.patch @@ -0,0 +1,97 @@ +From ec4ceb632abc0d54061269bc779459e13172f264 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 23 Jan 2020 15:42:41 +0100 +Subject: [PATCH 1/2] Fix building with GCC 10 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC 10 defaults to -fno-common that results into errors on multiple +global variable definitions: + +/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: +shar-opts.o:(.data.rel.ro.local+0x0): multiple definition of +`program_name'; shar.o:(.rodata+0x10): first defined here + +This patch fixes it by changing the definitions in header files into extern +declarations. + + + +Signed-off-by: Petr Písař +--- + src/shar-opts.h | 2 +- + src/shar-std.def | 2 +- + src/unshar-opts.h | 2 +- + src/uudecode-opts.h | 2 +- + src/uuencode-opts.h | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/shar-opts.h b/src/shar-opts.h +index 75dcae2..5055d1c 100644 +--- a/src/shar-opts.h ++++ b/src/shar-opts.h +@@ -352,7 +352,7 @@ extern "C" { + * global exported definitions + */ + #include "local.h" +-char const * const program_name; ++extern char const * const program_name; + + extern bool initialization_done; + extern int optidx; +diff --git a/src/shar-std.def b/src/shar-std.def +index ed06b77..a28f61c 100644 +--- a/src/shar-std.def ++++ b/src/shar-std.def +@@ -41,7 +41,7 @@ no-misuse-usage; + usage-message; + die-code; + +-export = '#include "local.h"'"\nchar const * const program_name;"; ++export = '#include "local.h"'"\nextern char const * const program_name;"; + + #shell + echo "include = 'char const * const program_name = \"${progname}\";';" +diff --git a/src/unshar-opts.h b/src/unshar-opts.h +index 2c3febe..9ebe2fc 100644 +--- a/src/unshar-opts.h ++++ b/src/unshar-opts.h +@@ -192,7 +192,7 @@ extern "C" { + extern size_t separator_str_len; + + #include "local.h" +-char const * const program_name; ++extern char const * const program_name; + + + /* * * * * * +diff --git a/src/uudecode-opts.h b/src/uudecode-opts.h +index 29b3b5c..5494289 100644 +--- a/src/uudecode-opts.h ++++ b/src/uudecode-opts.h +@@ -170,7 +170,7 @@ extern "C" { + * global exported definitions + */ + #include "local.h" +-char const * const program_name; ++extern char const * const program_name; + + + /* * * * * * +diff --git a/src/uuencode-opts.h b/src/uuencode-opts.h +index e71c9b8..d6ec03e 100644 +--- a/src/uuencode-opts.h ++++ b/src/uuencode-opts.h +@@ -166,7 +166,7 @@ extern "C" { + * global exported definitions + */ + #include "local.h" +-char const * const program_name; ++extern char const * const program_name; + + + /* * * * * * +-- +2.21.1 + diff --git a/source-files/sharutils-4.15.2-ISO-C23-Backport-stdbool.m4-from-gnulib-devel-0-52.2.patch b/source-files/sharutils-4.15.2-ISO-C23-Backport-stdbool.m4-from-gnulib-devel-0-52.2.patch new file mode 100644 index 0000000..394e229 --- /dev/null +++ b/source-files/sharutils-4.15.2-ISO-C23-Backport-stdbool.m4-from-gnulib-devel-0-52.2.patch @@ -0,0 +1,210 @@ +From 17788304f96fca8b1b83e04ce6d99980027062b9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 3 Mar 2025 17:58:11 +0100 +Subject: [PATCH 1/3] ISO C23: Backport stdbool.m4 from + gnulib-devel-0-52.20230709git.fc42.noarch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The bundled gnulib check for stdbool.h did not account for ISO C23 +which provides its own false and true keywords. As a result stdbool.h +presence was not correctly detected and libopts/compat/compat.h, +bundled from AutoGen, failed to compile with GCC 15 which defaults to +ISO C23: + + In file included from autoopts/project.h:30, + from libopts.c:2: + ./compat/compat.h:188:19: error: cannot use keyword ‘false’ as enumeration constant + 188 | typedef enum { false = 0, true = 1 } _Bool; + | ^~~~~ + ./compat/compat.h:188:19: note: ‘false’ is a keyword with ‘-std=c23’ onwards + ./compat/compat.h:188:41: error: expected ‘;’, identifier or ‘(’ before ‘_Bool’ + 188 | typedef enum { false = 0, true = 1 } _Bool; + | ^~~~~ + +Signed-off-by: Petr Písař +--- + m4/stdbool.m4 | 129 +++++++++++++++++++++++++++++--------------------- + 1 file changed, 74 insertions(+), 55 deletions(-) + +diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 +index 7273b82..8e00e4a 100644 +--- a/m4/stdbool.m4 ++++ b/m4/stdbool.m4 +@@ -1,27 +1,40 @@ + # Check for stdbool.h that conforms to C99. + +-dnl Copyright (C) 2002-2006, 2009-2015 Free Software Foundation, Inc. ++dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. + dnl This file is free software; the Free Software Foundation + dnl gives unlimited permission to copy and/or distribute it, + dnl with or without modifications, as long as this notice is preserved. + +-#serial 5 ++#serial 10 + + # Prepare for substituting if it is not supported. + + AC_DEFUN([AM_STDBOOL_H], + [ + AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) ++ AC_REQUIRE([AC_CANONICAL_HOST]) + +- # Define two additional variables used in the Makefile substitution. +- ++ dnl On some platforms, does not exist or does not conform to C99. ++ dnl On Solaris 10 with CC=cc CXX=CC, exists but is not usable ++ dnl in C++ mode (and no exists). In this case, we use our ++ dnl replacement, also in C mode (for binary compatibility between C and C++). + if test "$ac_cv_header_stdbool_h" = yes; then +- STDBOOL_H='' ++ case "$host_os" in ++ solaris*) ++ if test -z "$GCC"; then ++ GL_GENERATE_STDBOOL_H=true ++ else ++ GL_GENERATE_STDBOOL_H=false ++ fi ++ ;; ++ *) ++ GL_GENERATE_STDBOOL_H=false ++ ;; ++ esac + else +- STDBOOL_H='stdbool.h' ++ GL_GENERATE_STDBOOL_H=true + fi +- AC_SUBST([STDBOOL_H]) +- AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) ++ AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test "$GL_GENERATE_STDBOOL_H" = "true"]) + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 +@@ -31,70 +44,76 @@ AC_DEFUN([AM_STDBOOL_H], + AC_SUBST([HAVE__BOOL]) + ]) + +-# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. +-AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) +- +-# This version of the macro is needed in autoconf <= 2.68. ++m4_version_prereq([2.72], [], [ + + AC_DEFUN([AC_CHECK_HEADER_STDBOOL], +- [AC_CACHE_CHECK([for stdbool.h that conforms to C99], ++ [AC_CHECK_TYPES([_Bool]) ++ AC_CACHE_CHECK([for stdbool.h that conforms to C99 or later], + [ac_cv_header_stdbool_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +- [[ +- #include +- #ifndef bool +- "error: bool is not defined" ++ [[#include ++ ++ /* "true" and "false" should be usable in #if expressions and ++ integer constant expressions, and "bool" should be a valid ++ type name. ++ ++ Although C99 requires bool, true, and false to be macros, ++ C23 and C++11 overrule that, so do not test for that. ++ Although C99 requires __bool_true_false_are_defined and ++ _Bool, C23 says they are obsolescent, so do not require ++ them. */ ++ ++ #if !true ++ #error "'true' is not true" + #endif +- #ifndef false +- "error: false is not defined" ++ #if true != 1 ++ #error "'true' is not equal to 1" + #endif ++ char b[true == 1 ? 1 : -1]; ++ char c[true]; ++ + #if false +- "error: false is not 0" ++ #error "'false' is not false" + #endif +- #ifndef true +- "error: true is not defined" +- #endif +- #if true != 1 +- "error: true is not 1" +- #endif +- #ifndef __bool_true_false_are_defined +- "error: __bool_true_false_are_defined is not defined" ++ #if false != 0 ++ #error "'false' is not equal to 0" + #endif ++ char d[false == 0 ? 1 : -1]; ++ ++ enum { e = false, f = true, g = false * true, h = true * 256 }; ++ ++ char i[(bool) 0.5 == true ? 1 : -1]; ++ char j[(bool) 0.0 == false ? 1 : -1]; ++ char k[sizeof (bool) > 0 ? 1 : -1]; ++ ++ struct sb { bool s: 1; bool t; } s; ++ char l[sizeof s.t > 0 ? 1 : -1]; + +- struct s { _Bool s: 1; _Bool t; } s; +- +- char a[true == 1 ? 1 : -1]; +- char b[false == 0 ? 1 : -1]; +- char c[__bool_true_false_are_defined == 1 ? 1 : -1]; +- char d[(bool) 0.5 == true ? 1 : -1]; +- /* See body of main program for 'e'. */ +- char f[(_Bool) 0.0 == false ? 1 : -1]; +- char g[true]; +- char h[sizeof (_Bool)]; +- char i[sizeof s.t]; +- enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ +- _Bool n[m]; +- char o[sizeof n == m * sizeof n[0] ? 1 : -1]; +- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; ++ bool m[h]; ++ char n[sizeof m == h * sizeof m[0] ? 1 : -1]; ++ char o[-1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See +- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html +- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html ++ https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html ++ https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + */ +- _Bool q = true; +- _Bool *pq = &q; ++ bool p = true; ++ bool *pp = &p; + ]], + [[ +- bool e = &s; +- *pq |= q; +- *pq |= ! q; +- /* Refer to every declared value, to avoid compiler optimizations. */ +- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l +- + !m + !n + !o + !p + !q + !pq); ++ bool ps = &s; ++ *pp |= p; ++ *pp |= ! p; ++ ++ /* Refer to every declared value, so they cannot be ++ discarded as unused. */ ++ return (!b + !c + !d + !e + !f + !g + !h + !i + !j + !k ++ + !l + !m + !n + !o + !p + !pp + !ps); + ]])], + [ac_cv_header_stdbool_h=yes], + [ac_cv_header_stdbool_h=no])]) +- AC_CHECK_TYPES([_Bool]) +-]) ++])# AC_CHECK_HEADER_STDBOOL ++ ++]) # m4_version_prereq 2.72 +-- +2.48.1 + diff --git a/source-files/sharutils-4.15.2-ISO-C23-Port-getcwd.m4-to-ISO-C23.patch b/source-files/sharutils-4.15.2-ISO-C23-Port-getcwd.m4-to-ISO-C23.patch new file mode 100644 index 0000000..0f94e5c --- /dev/null +++ b/source-files/sharutils-4.15.2-ISO-C23-Port-getcwd.m4-to-ISO-C23.patch @@ -0,0 +1,44 @@ +From c6b3af7a1e9119e08a640d9cd93dcb0c984149ee Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 5 Mar 2025 10:13:08 +0100 +Subject: [PATCH 2/3] ISO C23: Port getcwd.m4 to ISO C23 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some confgure tests failed because of function arguments missing from +the prototypes: + + configure:16105: checking whether getcwd (NULL, 0) allocates memory for result + configure:16162: gcc -o conftest -g -O2 conftest.c >&5 + conftest.c:186:16: error: conflicting types for 'getcwd'; have 'char *(void)' + 186 | char *getcwd (); + | ^~~~~~ + In file included from conftest.c:181: + /usr/include/unistd.h:531:14: note: previous declaration of 'getcwd' with type 'char *(char *, size_t)' + +This patch fixes it. + +Maintainer is encouraged to rebase the m4 files to the latest gnulib. + +Signed-off-by: Petr Písař +--- + m4/getcwd.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/m4/getcwd.m4 b/m4/getcwd.m4 +index b9fbcec..6f24b14 100644 +--- a/m4/getcwd.m4 ++++ b/m4/getcwd.m4 +@@ -21,7 +21,7 @@ AC_DEFUN([gl_FUNC_GETCWD_NULL], + # include + # endif + # ifndef getcwd +- char *getcwd (); ++ char *getcwd (char *buf, size_t size); + # endif + ]], [[ + #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +-- +2.48.1 + diff --git a/source-files/sharutils-4.15.2-ISO-C23-Port-the-code-to-ISO-C23.patch b/source-files/sharutils-4.15.2-ISO-C23-Port-the-code-to-ISO-C23.patch new file mode 100644 index 0000000..8c7f1ba --- /dev/null +++ b/source-files/sharutils-4.15.2-ISO-C23-Port-the-code-to-ISO-C23.patch @@ -0,0 +1,132 @@ +From bd072f85a75568eee2ddd7466a041ad91f38f0ce Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 3 Mar 2025 18:06:08 +0100 +Subject: [PATCH 3/3] ISO C23: Port the code to ISO C23 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With GCC 15, which defaults to ISO 23, a build failed, for example like +this: + + gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I.. -I../libopts -I. -I.. -I../lib -I + ../lib -I../intl -Wno-format-contains-nul -g -O2 -Wno-format-contains-nul -c -o shar.o shar.c + In file included from local.h:23, + from shar-opts.h:354, + from shar.c:46: + ../lib/system.h:78:7: error: conflicting types for ‘fdopen’; have ‘FILE *(void)’ + 78 | FILE *fdopen (); + | ^~~~~~ + +The cause is that ISO C23 changed a meaning of an empty argument list +from an unspecified list to no arguments. + +Also K&R syntax is now deprecated and the compiler warned: + + encode.c: In function ‘write_encoded_bytes’: + encode.c:33:1: warning: old-style function definition [-Wold-style-definition] + 33 | write_encoded_bytes (group, file) + | ^~~~~~~~~~~~~~~~~~~ + +This patch fixes both the erros and the warnigs by specifying all the +arguments in the modern syntax. + +Signed-off-by: Petr Písař +--- + lib/system.h | 6 +++--- + src/encode.c | 13 +++---------- + src/shar.c | 2 +- + src/uudecode.c | 2 +- + 4 files changed, 8 insertions(+), 15 deletions(-) + +diff --git a/lib/system.h b/lib/system.h +index 2b9846b..811e8cf 100644 +--- a/lib/system.h ++++ b/lib/system.h +@@ -52,7 +52,7 @@ typedef enum {false = 0, true = 1} bool; + #endif + + #if !HAVE_DECL_STRTOIMAX && !defined strtoimax +-intmax_t strtoimax (); ++intmax_t strtoimax (const char *nptr, char **endptr, int base); + #endif + + #if HAVE_STRING_H +@@ -75,8 +75,8 @@ intmax_t strtoimax (); + # include + #endif + +-FILE *fdopen (); +-FILE *popen (); ++FILE *fdopen (int fd, const char *mode); ++FILE *popen (const char *command, const char *type); + + /* Global functions of the shar package. */ + +diff --git a/src/encode.c b/src/encode.c +index 09e0c69..b1de8bd 100644 +--- a/src/encode.c ++++ b/src/encode.c +@@ -30,9 +30,7 @@ + `------------------------------------------*/ + + static void +-write_encoded_bytes (group, file) +- char *group; +- FILE *file; ++write_encoded_bytes (char *group, FILE *file) + { + int c1, c2, c3, c4; + +@@ -52,10 +50,7 @@ write_encoded_bytes (group, file) + `--------------------------------------------------------------------*/ + + static int +-read_raw_bytes (file, buffer, buffer_size) +- FILE *file; +- char *buffer; +- int buffer_size; ++read_raw_bytes (FILE *file, char *buffer, int buffer_size) + { + int character; + int counter; +@@ -75,9 +70,7 @@ read_raw_bytes (file, buffer, buffer_size) + `----------------------------------------------------*/ + + void +-copy_file_encoded (input, output) +- FILE *input; +- FILE *output; ++copy_file_encoded (FILE *input, FILE *output) + { + char buffer[LINE_BUFFER_SIZE]; + int counter; +diff --git a/src/shar.c b/src/shar.c +index 6d7ed1d..2c6e2e1 100644 +--- a/src/shar.c ++++ b/src/shar.c +@@ -109,7 +109,7 @@ static inline unsigned char to_uchar (char ch) { return ch; } + #define IS_GRAPH(_c) (isprint (to_uchar (_c)) && !isspace (to_uchar (_c))) + #endif + +-struct tm *localtime (); ++struct tm *localtime (const time_t *timep); + + #if MSDOS + /* 1 extra for CR. */ +diff --git a/src/uudecode.c b/src/uudecode.c +index 0621c99..b8a316e 100644 +--- a/src/uudecode.c ++++ b/src/uudecode.c +@@ -82,7 +82,7 @@ static char const cright_years_z[] = + #define UU_CHMOD(_n, _fd, _m) chmod ((_n), UU_MODE_BITS(_m)) + #endif + +-struct passwd *getpwnam (); ++struct passwd *getpwnam (const char *name); + + static uudecode_exit_code_t read_stduu( + const char *inname, const char *outname); +-- +2.48.1 + diff --git a/source-files/sharutils-4.15.2-fflush-adjust-to-glibc-2.28-libio.h-removal.patch b/source-files/sharutils-4.15.2-fflush-adjust-to-glibc-2.28-libio.h-removal.patch new file mode 100644 index 0000000..78e6564 --- /dev/null +++ b/source-files/sharutils-4.15.2-fflush-adjust-to-glibc-2.28-libio.h-removal.patch @@ -0,0 +1,178 @@ +From 0e2f412eeec2e1f7f5743ea23c62bdf98bf4102c Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Thu, 8 Mar 2018 16:42:45 -0800 +Subject: [PATCH] fflush: adjust to glibc 2.28 libio.h removal +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Petr Písař: Ported to sharutils-4.15.2 from: + +commit 4af4a4a71827c0bc5e0ec67af23edef4f15cee8e +Author: Paul Eggert +Date: Mon Mar 5 10:56:29 2018 -0800 + + fflush: adjust to glibc 2.28 libio.h removal + +Problem reported by Daniel P. Berrangé in: +https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html +* lib/fbufmode.c (fbufmode): +* lib/fflush.c (clear_ungetc_buffer_preserving_position) +(disable_seek_optimization, rpl_fflush): +* lib/fpending.c (__fpending): +* lib/fpurge.c (fpurge): +* lib/freadable.c (freadable): +* lib/freadahead.c (freadahead): +* lib/freading.c (freading): +* lib/freadptr.c (freadptr): +* lib/freadseek.c (freadptrinc): +* lib/fseeko.c (fseeko): +* lib/fseterr.c (fseterr): +* lib/fwritable.c (fwritable): +* lib/fwriting.c (fwriting): +Check _IO_EOF_SEEN instead of _IO_ftrylockfile. +* lib/stdio-impl.h (_IO_IN_BACKUP) [_IO_EOF_SEEN]: +Define if not already defined. + +commit 74d9d6a293d7462dea8f83e7fc5ac792e956a0ad +Author: Paul Eggert +Date: Thu Mar 8 16:42:45 2018 -0800 + + fflush: be more paranoid about libio.h change + +Suggested by Eli Zaretskii in: +https://lists.gnu.org/r/emacs-devel/2018-03/msg00270.html +* lib/fbufmode.c (fbufmode): +* lib/fflush.c (clear_ungetc_buffer_preserving_position) +(disable_seek_optimization, rpl_fflush): +* lib/fpending.c (__fpending): +* lib/fpurge.c (fpurge): +* lib/freadable.c (freadable): +* lib/freadahead.c (freadahead): +* lib/freading.c (freading): +* lib/freadptr.c (freadptr): +* lib/freadseek.c (freadptrinc): +* lib/fseeko.c (fseeko): +* lib/fseterr.c (fseterr): +* lib/fwritable.c (fwritable): +* lib/fwriting.c (fwriting): +Look at _IO_ftrylockfile as well as at _IO_EOF_SEEN. + +This is needed for glibc-2.28 (First spotted with +glibc-2.27.9000-13.fc29 on Fedora). + +Signed-off-by: Petr Písař +--- + lib/fflush.c | 9 ++++++--- + lib/fpurge.c | 3 ++- + lib/freading.c | 3 ++- + lib/fseeko.c | 6 ++++-- + lib/stdio-impl.h | 6 ++++++ + 5 files changed, 20 insertions(+), 7 deletions(-) + +diff --git a/lib/fflush.c b/lib/fflush.c +index 5ae3e41..d887ecb 100644 +--- a/lib/fflush.c ++++ b/lib/fflush.c +@@ -33,7 +33,8 @@ + #undef fflush + + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 ++/* GNU libc, BeOS, Haiku, Linux libc5 */ + + /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ + static void +@@ -72,7 +73,8 @@ clear_ungetc_buffer (FILE *fp) + + #endif + +-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) ++#if ! (defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1) ++/* GNU libc, BeOS, Haiku, Linux libc5 */ + + # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */ +@@ -148,7 +150,8 @@ rpl_fflush (FILE *stream) + if (stream == NULL || ! freading (stream)) + return fflush (stream); + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */ + + clear_ungetc_buffer_preserving_position (stream); + +diff --git a/lib/fpurge.c b/lib/fpurge.c +index f313b22..a760c4d 100644 +--- a/lib/fpurge.c ++++ b/lib/fpurge.c +@@ -62,7 +62,8 @@ fpurge (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_IO_read_end = fp->_IO_read_ptr; + fp->_IO_write_ptr = fp->_IO_write_base; + /* Avoid memory leak when there is an active ungetc buffer. */ +diff --git a/lib/freading.c b/lib/freading.c +index 0512b19..2341577 100644 +--- a/lib/freading.c ++++ b/lib/freading.c +@@ -31,7 +31,8 @@ freading (FILE *fp) + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++# if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */ + return ((fp->_flags & _IO_NO_WRITES) != 0 + || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 + && fp->_IO_read_base != NULL)); +diff --git a/lib/fseeko.c b/lib/fseeko.c +index 1c65d2a..1b1cc2f 100644 +--- a/lib/fseeko.c ++++ b/lib/fseeko.c +@@ -47,7 +47,8 @@ fseeko (FILE *fp, off_t offset, int whence) + #endif + + /* These tests are based on fpurge.c. */ +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */ + if (fp->_IO_read_end == fp->_IO_read_ptr + && fp->_IO_write_ptr == fp->_IO_write_base + && fp->_IO_save_base == NULL) +@@ -123,7 +124,8 @@ fseeko (FILE *fp, off_t offset, int whence) + return -1; + } + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 ++ /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_flags &= ~_IO_EOF_SEEN; + fp->_offset = pos; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ +diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h +index 502d891..ea38ee2 100644 +--- a/lib/stdio-impl.h ++++ b/lib/stdio-impl.h +@@ -18,6 +18,12 @@ + the same implementation of stdio extension API, except that some fields + have different naming conventions, or their access requires some casts. */ + ++/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this ++ problem by defining it ourselves. FIXME: Do not rely on glibc ++ internals. */ ++#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN ++# define _IO_IN_BACKUP 0x100 ++#endif + + /* BSD stdio derived implementations. */ + +-- +2.14.3 + diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..6064fb5 --- /dev/null +++ b/source.sh @@ -0,0 +1,42 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://ftp.gnu.org/gnu/sharutils/sharutils-${BPM_PKG_VERSION}.tar.xz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" + + cd "$BPM_SOURCE" + # Apply all patches + for patch in "$BPM_WORKDIR"/*.patch; do + patch -Np1 -i "$patch" + done + autoreconf -fiv +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + ./configure --prefix=/usr --disable-dependency-tracking + make +} + +# The check function is executed in the source directory +# This function is used to run tests to verify the package has been compiled correctly +check() { + make check +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + make DESTDIR="$BPM_OUTPUT" install + + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/sharutils/COPYING +}