diff --git a/.gitignore b/.gitignore index c54486c..bb24a27 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ sed-4.2.1.tar.bz2 /sed-4.4.tar.xz /sed-4.5.tar.xz /sed-4.8.tar.xz -/sed-4.9.tar.xz diff --git a/sed-b-flag.patch b/sed-b-flag.patch index f4e6a03..809ad9e 100644 --- a/sed-b-flag.patch +++ b/sed-b-flag.patch @@ -1,18 +1,17 @@ -From f40556883a40ed7aaa4f44c9c9c95215c95eab9f Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Tue, 30 Jan 2024 10:31:57 +0100 -Subject: [PATCH 1/3] enable the -b option on all platforms -Content-Type: text/plain; charset=UTF-8 +From 613057152c4f6caba22a15ed2ff0aeb9c4ce6a83 Mon Sep 17 00:00:00 2001 +From: Jakub Martisko +Date: Wed, 5 Feb 2020 15:50:15 +0100 +Subject: [PATCH] enable the -b option on all platforms --- sed/sed.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sed/sed.c b/sed/sed.c -index af83065..bdf590b 100644 +index f75e4b6..1ca5839 100644 --- a/sed/sed.c +++ b/sed/sed.c -@@ -153,7 +153,12 @@ Usage: %s [OPTION]... {script-only-if-no-other-script} [input-file]...\n\ +@@ -174,7 +174,12 @@ Usage: %s [OPTION]... {script-only-if-no-other-script} [input-file]...\n\ fprintf (out, _(" -b, --binary\n\ open files in binary mode (CR+LFs are not" \ " processed specially)\n")); @@ -26,5 +25,5 @@ index af83065..bdf590b 100644 specify the desired line-wrap length for the `l' command\n")); fprintf (out, _(" --posix\n\ -- -2.43.0 +2.24.1 diff --git a/sed-c-flag.patch b/sed-c-flag.patch index 590ccd0..114d5c7 100644 --- a/sed-c-flag.patch +++ b/sed-c-flag.patch @@ -1,43 +1,50 @@ -From 100738652ca35e39f21742b8c54c1181efb38a0f Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Tue, 30 Jan 2024 10:38:50 +0100 -Subject: [PATCH 2/3] -c flag -Content-Type: text/plain; charset=UTF-8 +From f336bde91e3fd9c3c2960aa548b8917eb1216678 Mon Sep 17 00:00:00 2001 +From: Jakub Martisko +Date: Thu, 6 Feb 2020 15:26:33 +0100 +Subject: [PATCH] -c flag --- - sed/execute.c | 10 ++++-- + sed/execute.c | 18 +++++++++-- sed/sed.c | 20 +++++++++++- sed/sed.h | 4 +++ sed/utils.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++ sed/utils.h | 2 ++ - 5 files changed, 119 insertions(+), 3 deletions(-) + 5 files changed, 127 insertions(+), 3 deletions(-) diff --git a/sed/execute.c b/sed/execute.c -index 485bca7..8d0cde7 100644 +index c5f07cc..4e5f5b3 100644 --- a/sed/execute.c +++ b/sed/execute.c -@@ -673,11 +673,17 @@ closedown (struct input *input) +@@ -670,11 +670,25 @@ closedown (struct input *input) if (strcmp (in_place_extension, "*") != 0) { char *backup_file_name = get_backup_file_name (target_name); -- ck_rename (target_name, backup_file_name); +- ck_rename (target_name, backup_file_name, input->out_file_name); + if (copy_instead_of_rename) -+ ck_fccopy (target_name, backup_file_name); ++ { ++ ck_fccopy (target_name, backup_file_name, input->out_file_name); ++ } + else -+ ck_rename (target_name, backup_file_name); ++ { ++ ck_rename (target_name, backup_file_name, input->out_file_name); ++ } free (backup_file_name); } -- ck_rename (input->out_file_name, target_name); +- ck_rename (input->out_file_name, target_name, input->out_file_name); + if (copy_instead_of_rename) -+ ck_fcmove (input->out_file_name, target_name); ++ { ++ ck_fcmove (input->out_file_name, target_name, input->out_file_name); ++ } + else -+ ck_rename (input->out_file_name, target_name); ++ { ++ ck_rename (input->out_file_name, target_name, input->out_file_name); ++ } cancel_cleanup (); free (input->out_file_name); } diff --git a/sed/sed.c b/sed/sed.c -index bdf590b..cebef70 100644 +index 1ca5839..745159e 100644 --- a/sed/sed.c +++ b/sed/sed.c @@ -67,6 +67,10 @@ bool debug = false; @@ -51,7 +58,7 @@ index bdf590b..cebef70 100644 /* The mode to use to read/write files, either "r"/"w" or "rb"/"wb". */ char const *read_mode = "r"; char const *write_mode = "w"; -@@ -149,6 +153,10 @@ Usage: %s [OPTION]... {script-only-if-no-other-script} [input-file]...\n\ +@@ -170,6 +174,10 @@ Usage: %s [OPTION]... {script-only-if-no-other-script} [input-file]...\n\ #endif fprintf (out, _(" -i[SUFFIX], --in-place[=SUFFIX]\n\ edit files in place (makes backup if SUFFIX supplied)\n")); @@ -62,7 +69,7 @@ index bdf590b..cebef70 100644 #if O_BINARY fprintf (out, _(" -b, --binary\n\ open files in binary mode (CR+LFs are not" \ -@@ -193,7 +201,7 @@ specified, then the standard input is read.\n\ +@@ -214,7 +222,7 @@ specified, then the standard input is read.\n\ int main (int argc, char **argv) { @@ -71,7 +78,7 @@ index bdf590b..cebef70 100644 enum { SANDBOX_OPTION = CHAR_MAX+1, DEBUG_OPTION -@@ -207,6 +215,7 @@ main (int argc, char **argv) +@@ -228,6 +236,7 @@ main (int argc, char **argv) {"file", 1, NULL, 'f'}, {"in-place", 2, NULL, 'i'}, {"line-length", 1, NULL, 'l'}, @@ -79,7 +86,7 @@ index bdf590b..cebef70 100644 {"null-data", 0, NULL, 'z'}, {"zero-terminated", 0, NULL, 'z'}, {"quiet", 0, NULL, 'n'}, -@@ -285,6 +294,10 @@ main (int argc, char **argv) +@@ -306,6 +315,10 @@ main (int argc, char **argv) follow_symlinks = true; break; @@ -90,7 +97,7 @@ index bdf590b..cebef70 100644 case 'i': separate_files = true; IF_LINT (free (in_place_extension)); -@@ -355,6 +368,11 @@ main (int argc, char **argv) +@@ -376,6 +389,11 @@ main (int argc, char **argv) } } @@ -103,10 +110,10 @@ index bdf590b..cebef70 100644 { if (optind < argc) diff --git a/sed/sed.h b/sed/sed.h -index 1c96bc5..2de60ae 100644 +index 1c8e83a..0859e72 100644 --- a/sed/sed.h +++ b/sed/sed.h -@@ -241,6 +241,10 @@ extern countT lcmd_out_line_len; +@@ -236,6 +236,10 @@ extern countT lcmd_out_line_len; /* How do we edit files in-place? (we don't if NULL) */ extern char *in_place_extension; @@ -118,7 +125,7 @@ index 1c96bc5..2de60ae 100644 extern char const *read_mode; extern char const *write_mode; diff --git a/sed/utils.c b/sed/utils.c -index 4bd6587..05f7a44 100644 +index 9576dd1..371d5a9 100644 --- a/sed/utils.c +++ b/sed/utils.c @@ -25,6 +25,7 @@ @@ -128,8 +135,8 @@ index 4bd6587..05f7a44 100644 +#include #include "binary-io.h" - #include "eloop-threshold.h" -@@ -408,7 +409,78 @@ ck_rename (const char *from, const char *to) + #include "unlocked-io.h" +@@ -400,7 +401,92 @@ ck_rename (const char *from, const char *to, const char *unlink_if_fail) panic (_("cannot rename %s: %s"), from, strerror (errno)); } @@ -143,6 +150,20 @@ index 4bd6587..05f7a44 100644 + panic (_("cannot remove %s: %s"), name, strerror (errno)); +} + ++/* Attempt to unlink denoted file if operation rd failed. */ ++static int ++_unlink_if_fail (int rd,const char * unlink_if_fail) ++{ ++ if (rd == -1 && unlink_if_fail) ++ { ++ int save_errno = errno; ++ ck_unlink (unlink_if_fail); ++ errno = save_errno; ++ } ++ ++ return rd != -1; ++} ++ +/* Copy contents between files. */ +static int +_copy (from, to) @@ -151,7 +172,7 @@ index 4bd6587..05f7a44 100644 + static char buf[4096]; + + FILE *infile, *outfile; -+ int retval = 0; ++ int c, retval = 0; + errno = 0; + + infile = fopen (from, "r"); @@ -192,35 +213,35 @@ index 4bd6587..05f7a44 100644 + +/* Attempt to copy file contents between the files. */ +void -+ck_fccopy (const char *from, const char *to) ++ck_fccopy (const char *from,const char *to, const char *unlink_if_fail) +{ -+ if (_copy (from, to) == -1) -+ panic (_("cannot copy %s to %s: %s"), from, to, strerror (errno)); -+} ++ if (!_unlink_if_fail (_copy (from, to), unlink_if_fail)) ++ panic (_("cannot copy %s to %s: %s"), from, to, strerror (errno)); ++ } + +/* Copy contents between files, and then unlink the source. */ +void -+ck_fcmove (const char *from, const char *to) ++ck_fcmove (const char *from, const char *to,const char *unlink_if_fail) +{ -+ ck_fccopy (from, to); -+ ck_unlink (from); ++ ck_fccopy (from, to, unlink_if_fail); ++ ck_unlink (from); +} /* Implement a variable sized buffer of `stuff'. We don't know what it is, diff --git a/sed/utils.h b/sed/utils.h -index cac8a05..93bbcf2 100644 +index 47a029e..0aba107 100644 --- a/sed/utils.h +++ b/sed/utils.h -@@ -41,6 +41,8 @@ size_t ck_getdelim (char **text, size_t *buflen, char buffer_delimiter, +@@ -40,6 +40,8 @@ size_t ck_getdelim (char **text, size_t *buflen, char buffer_delimiter, FILE * ck_mkstemp (char **p_filename, const char *tmpdir, const char *base, const char *mode) _GL_ARG_NONNULL ((1, 2, 3, 4)); - void ck_rename (const char *from, const char *to); -+void ck_fccopy (const char *from, const char *to); -+void ck_fcmove (const char *from, const char *to); + void ck_rename (const char *from, const char *to, const char *unlink_if_fail); ++void ck_fccopy (const char *from, const char *to, const char *unlink_if_fail); ++void ck_fcmove (const char *from, const char *to, const char *unlink_if_fail); void *ck_malloc (size_t size); void *ck_realloc (void *ptr, size_t size); -- -2.43.0 +2.24.1 diff --git a/sed-covscan-annotations.patch b/sed-covscan-annotations.patch deleted file mode 100644 index a36eada..0000000 --- a/sed-covscan-annotations.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 7dbe9c0c2b3f2cac602ce352cad11dab4defe896 Mon Sep 17 00:00:00 2001 -From: Paolo Bonzini -Date: Tue, 30 Jan 2024 10:41:40 +0100 -Subject: [PATCH 3/3] covscan annotations -Content-Type: text/plain; charset=UTF-8 - ---- - lib/malloca.c | 1 + - sed/compile.c | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/lib/malloca.c b/lib/malloca.c -index 1e19978..11783b4 100644 ---- a/lib/malloca.c -+++ b/lib/malloca.c -@@ -71,6 +71,7 @@ mmalloca (size_t n) - [mem, mem + nplus). */ - p[-1] = offset; - /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ -+ /* cppcheck-suppress memleak */ - return p; - } - } -diff --git a/sed/compile.c b/sed/compile.c -index f96fbca..52759a5 100644 ---- a/sed/compile.c -+++ b/sed/compile.c -@@ -830,6 +830,7 @@ setup_replacement (struct subst *sub, const char *text, size_t length) - - tail->next = NULL; - sub->replacement = root.next; -+ /* coverity [leaked_storage] */ - } - - static void -@@ -1328,6 +1329,7 @@ compile_program (struct vector *vector) - bad_prog (_(Y_CMD_LEN)); - - IF_LINT (free (src_lens)); -+ /* coverity [leaked_storage] */ - } - else - { --- -2.43.0 - diff --git a/sed-gnulib.patch b/sed-gnulib.patch new file mode 100644 index 0000000..902b847 --- /dev/null +++ b/sed-gnulib.patch @@ -0,0 +1,218 @@ +From 1831628c0630ae96a43586b2a25ca51cbdba3e53 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Mon, 5 Mar 2018 10:56:29 -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 + +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. +--- + ChangeLog | 23 +++++++++++++++++++++++ + lib/fbufmode.c | 2 +- + lib/fflush.c | 6 +++--- + lib/fpending.c | 2 +- + lib/fpurge.c | 2 +- + lib/freadable.c | 2 +- + lib/freadahead.c | 2 +- + lib/freading.c | 2 +- + lib/freadptr.c | 2 +- + lib/freadseek.c | 2 +- + lib/fseeko.c | 4 ++-- + lib/fseterr.c | 2 +- + lib/fwritable.c | 2 +- + lib/fwriting.c | 2 +- + lib/stdio-impl.h | 6 ++++++ + 15 files changed, 45 insertions(+), 16 deletions(-) + +diff --git a/ChangeLog b/ChangeLog +index 667f91663..beb835670 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,26 @@ ++2018-03-05 Paul Eggert ++ ++ 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. ++ + 2017-02-03 Jim Meyering + + version 4.4 +diff --git a/gnulib-tests/fflush.c b/gnulib-tests/fflush.c +index 983ade0ff..a6edfa105 100644 +--- a/gnulib-tests/fflush.c ++++ b/gnulib-tests/fflush.c +@@ -33,7 +33,7 @@ + #undef fflush + + +-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ ++#if defined _IO_EOF_SEEN || __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 +72,7 @@ clear_ungetc_buffer (FILE *fp) + + #endif + +-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */) ++#if ! (defined _IO_EOF_SEEN || __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, Minix 3, Android */ +@@ -148,7 +148,7 @@ 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 || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + + clear_ungetc_buffer_preserving_position (stream); + +diff --git a/lib/fpending.c b/lib/fpending.c +index c84e3a5b4..789f50e4e 100644 +--- a/lib/fpending.c ++++ b/lib/fpending.c +@@ -32,7 +32,7 @@ __fpending (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 || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return fp->_IO_write_ptr - fp->_IO_write_base; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ +diff --git a/gnulib-tests/fpurge.c b/gnulib-tests/fpurge.c +index b1d417c7a..3aedcc373 100644 +--- a/gnulib-tests/fpurge.c ++++ b/gnulib-tests/fpurge.c +@@ -62,7 +62,7 @@ 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 || __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/gnulib-tests/freading.c b/gnulib-tests/freading.c +index 73c28acdd..c24d0c88a 100644 +--- a/gnulib-tests/freading.c ++++ b/gnulib-tests/freading.c +@@ -31,7 +31,7 @@ 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 || __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/gnulib-tests/fseeko.c b/gnulib-tests/fseeko.c +index 0101ab55f..193f4e8ce 100644 +--- a/gnulib-tests/fseeko.c ++++ b/gnulib-tests/fseeko.c +@@ -47,7 +47,7 @@ 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 || __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 +123,7 @@ 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 || __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/fwriting.c b/lib/fwriting.c +index 461ab0f1f..4a3d9c8d4 100644 +--- a/lib/fwriting.c ++++ b/lib/fwriting.c +@@ -27,7 +27,7 @@ fwriting (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 || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ + return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0; + #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ +diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h +index 78d896e9f..05c5752a2 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. */ + +diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h +index 78d896e9f..05c5752a2 100644 +--- a/gnulib-tests/stdio-impl.h ++++ b/gnulib-tests/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/sed-selinux.patch b/sed-selinux.patch new file mode 100644 index 0000000..2dca5ab --- /dev/null +++ b/sed-selinux.patch @@ -0,0 +1,29 @@ +diff --git a/NEWS b/NEWS +index e9335f0..e762b2d 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,4 +1,9 @@ GNU sed NEWS -*- outline -*- + GNU sed NEWS -*- outline -*- ++ ++ sed -i now creates selinux context based on the context of the symlink ++ instead of the symlink target. [Bug present since at least sed-4.2] ++ sed -i --follow-symlinks remains unchanged. ++ + + * Noteworthy changes in release 4.4 (2017-02-03) [stable] + +diff --git a/sed/execute.c b/sed/execute.c +index 1843392..453886e 100644 +--- a/sed/execute.c ++++ b/sed/execute.c +@@ -607,7 +607,7 @@ open_next_file(const char *name, struct input *input) + if (is_selinux_enabled () > 0) + { + security_context_t con; +- if (getfilecon (input->in_file_name, &con) != -1) ++ if (lgetfilecon (input->in_file_name, &con) != -1) + { + /* Save and restore the old context for the sake of w and W + commands. */ +2.9.5 + diff --git a/sed.spec b/sed.spec index ad29b17..f3bad6e 100644 --- a/sed.spec +++ b/sed.spec @@ -2,30 +2,22 @@ Summary: A GNU stream text editor Name: sed -Version: 4.9 -Release: 6%{?dist} -License: GPL-3.0-or-later +Version: 4.8 +Release: 5%{?dist} +License: GPLv3+ URL: http://sed.sourceforge.net/ Source0: ftp://ftp.gnu.org/pub/gnu/sed/sed-%{version}.tar.xz Source1: http://sed.sourceforge.net/sedfaq.txt Patch0: sed-b-flag.patch Patch1: sed-c-flag.patch -Patch2: sed-covscan-annotations.patch -BuildRequires: make +#Patch1: sed-selinux.patch +#Build failure with glibc-2.28 +#https://lists.gnu.org/r/bug-gnulib/2018-03/msg00000.html +Patch2: sed-gnulib.patch BuildRequires: glibc-devel, libselinux-devel, libacl-devel, automake, autoconf, gcc BuildRequires: perl-Getopt-Long BuildRequires: perl(FileHandle) -# for tests. More tests require a ja_JP locale, but glibc-langpack-ja gives: -# invalid-mb-seq-UMR.sh: skipped test: locale 'ja_JP' is buggy -# mb-charclass-non-utf8.sh: skipped test: ja_JP shift-jis locale not found -BuildRequires: glibc-langpack-el, glibc-langpack-en -BuildRequires: glibc-langpack-ru - -%ifarch %{valgrind_arches} -BuildRequires: valgrind -%endif - Provides: /bin/sed #copylib @@ -39,16 +31,18 @@ that sed performs (substitutions, deletions, insertions, etc.) can be specified in a script file or from the command line. %prep -%autosetup -p1 +%setup -q +%patch0 -p1 +%patch1 -p1 +#%patch2 -p1 + + +sed -e 's/1729576/EPERM/' \ + -i gnulib-tests/test-{strerror_r,perror2}.c %build %configure --without-included-regex %make_build - -#rhbz#2396649 -sed -i s/"SELinux is enabled on this system."// ./doc/sed.1 -sed -i s/"SELinux is disabled on this system."// ./doc/sed.1 - install -m 644 -p %{SOURCE1} sedfaq.txt gzip -9 sedfaq.txt @@ -73,61 +67,6 @@ rm -f ${RPM_BUILD_ROOT}/%{_infodir}/dir %{_mandir}/man1/sed.1* %changelog -* Fri Oct 24 2025 Jakub Martisko - 4.9-6 -- The manpage should no longer mention whether the SELinux is enabled/disabled on the system -- It was based on the build system anyway -- Resolves: rhbz#2396649 - -* Fri Jul 25 2025 Fedora Release Engineering - 4.9-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Sun Jan 19 2025 Fedora Release Engineering - 4.9-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Sat Jul 20 2024 Fedora Release Engineering - 4.9-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Mon Apr 22 2024 David Abdurachmanov - 4.9-2 -- Properly check valgrind arches (riscv64 is not ported) - -* Tue Jan 30 2024 Paolo Bonzini - 4.9-1 -- Rebase to 4.9 -- Update downstream patches -- Resolves: rhbz#2140486 -- Remove change to gnulib tests, they pass anyway -- Install valgrind and langpacks to increase test coverage - -* Sat Jan 27 2024 Fedora Release Engineering - 4.8-15 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sat Jul 22 2023 Fedora Release Engineering - 4.8-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Tue Apr 11 2023 Lukáš Zaoral - 4.8-13 -- migrate to SPDX license format - -* Sat Jan 21 2023 Fedora Release Engineering - 4.8-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Sat Jul 23 2022 Fedora Release Engineering - 4.8-11 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Sat Jan 22 2022 Fedora Release Engineering - 4.8-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Tue Nov 16 2021 Jakub Martisko - 4.8-9 -- Add annotations to disable false positives in the covscan -- Related: rhbz#1938867 - -* Fri Jul 23 2021 Fedora Release Engineering - 4.8-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Wed Jan 27 2021 Fedora Release Engineering - 4.8-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Aug 17 2020 Jakub Martisko - 4.8-6 -- Minor spec cleanup - * Mon Aug 03 2020 Jakub Martisko - 4.8-5 - Use make macros diff --git a/sources b/sources index efafbe0..63247e0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (sed-4.9.tar.xz) = 36157a4b4a2430cf421b7bd07f1675d680d9f1616be96cf6ad6ee74a9ec0fe695f8d0b1e1f0b008bbb33cc7fcde5e1c456359bbbc63f8aebdd4fedc3982cf6dc +SHA512 (sed-4.8.tar.xz) = 7de25d9bc2981c63321c2223f3fbcab61d7b0df4fcf7d4394b72400b91993e1288d8bf53948ed5fffcf5a98c75265726a68ad4fb98e1d571bf768603a108c1c8