Update to 4.3

Resolves: #1410093
This commit is contained in:
Jakub Martisko 2017-01-05 14:06:58 +01:00
parent a157645f7a
commit 217fe55b6f
4 changed files with 80 additions and 78 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
sed-4.2.1.tar.bz2 sed-4.2.1.tar.bz2
/sed-4.2.2.tar.bz2 /sed-4.2.2.tar.bz2
/sed-4.3.tar.xz

View File

@ -1,43 +1,44 @@
diff -urN sed-4.2.2/sed/execute.c sed-4.2.2.new00/sed/execute.c diff -urN sed-4.3/sed/execute.c sed-4.3.new00/sed/execute.c
--- sed-4.2.2/sed/execute.c 2012-03-16 10:13:31.000000000 +0100 --- sed-4.3/sed/execute.c 2012-03-16 10:13:31.000000000 +0100
+++ sed-4.2.2.new00/sed/execute.c 2014-02-10 14:40:25.603629422 +0100 +++ sed-4.3.new00/sed/execute.c 2014-02-10 14:40:25.603629422 +0100
@@ -703,11 +703,13 @@ @@ -703,11 +703,13 @@
if (strcmp(in_place_extension, "*") != 0) if (strcmp(in_place_extension, "*") != 0)
{ {
char *backup_file_name = get_backup_file_name(target_name); char *backup_file_name = get_backup_file_name(target_name);
- ck_rename (target_name, backup_file_name, input->out_file_name); - ck_rename (target_name, backup_file_name, input->out_file_name);
+ (copy_instead_of_rename?ck_fccopy:ck_rename) + (copy_instead_of_rename?ck_fccopy:ck_rename)
+ (target_name, backup_file_name, input->out_file_name); + (target_name, backup_file_name, input->out_file_name);
free (backup_file_name); free (backup_file_name);
} }
- ck_rename (input->out_file_name, target_name, input->out_file_name); - ck_rename (input->out_file_name, target_name, input->out_file_name);
+ (copy_instead_of_rename?ck_fcmove:ck_rename) + (copy_instead_of_rename?ck_fcmove:ck_rename)
+ (input->out_file_name, target_name, input->out_file_name); + (input->out_file_name, target_name, input->out_file_name);
cancel_cleanup ();
free (input->out_file_name); free (input->out_file_name);
} }
else diff -urN sed-4.3/sed/sed.c sed-4.3.new00/sed/sed.c
diff -urN sed-4.2.2/sed/sed.c sed-4.2.2.new00/sed/sed.c --- sed-4.3/sed/sed.c 2012-03-16 10:13:31.000000000 +0100
--- sed-4.2.2/sed/sed.c 2012-03-16 10:13:31.000000000 +0100 +++ sed-4.3.new00/sed/sed.c 2014-02-10 17:37:19.381273509 +0100
+++ sed-4.2.2.new00/sed/sed.c 2014-02-10 17:37:19.381273509 +0100
@@ -56,6 +56,10 @@ @@ -56,6 +56,10 @@
/* How do we edit files in-place? (we don't if NULL) */ /* How do we edit files in-place? (we don't if NULL) */
char *in_place_extension = NULL; char *in_place_extension = NULL;
+/* Do we use copy or rename when in in-place edit mode? (boolean + /* Do we use copy or rename when in in-place edit mode? (boolean
+ value, non-zero for copy, zero for rename).*/ + value, non-zero for copy, zero for rename).*/
+int copy_instead_of_rename = 0; + int copy_instead_of_rename = 0;
+ +
/* The mode to use to read/write files, either "r"/"w" or "rb"/"wb". */ /* The mode to use to read/write files, either "r"/"w" or "rb"/"wb". */
char *read_mode = "r"; char const *read_mode = "r";
char *write_mode = "w"; char const *write_mode = "w";
@@ -117,10 +121,17 @@ @@ -117,11 +121,16 @@
#endif
fprintf(out, _(" -i[SUFFIX], --in-place[=SUFFIX]\n\ fprintf(out, _(" -i[SUFFIX], --in-place[=SUFFIX]\n\
edit files in place (makes backup if SUFFIX supplied)\n")); edit files in place (makes backup if SUFFIX supplied)\n"));
-#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(MSDOS) || defined(__EMX__) -#if defined WIN32 || defined _WIN32 || defined __CYGWIN__ \
- || defined MSDOS || defined __EMX__
- fprintf(out, _(" -b, --binary\n\ - fprintf(out, _(" -b, --binary\n\
- open files in binary mode (CR+LFs are not processed specially)\n")); - open files in binary mode (CR+LFs are not" \
- " processed specially)\n"));
+ fprintf(out, _(" -c, --copy\n\ + fprintf(out, _(" -c, --copy\n\
+ use copy instead of rename when shuffling files in -i mode\n")); + use copy instead of rename when shuffling files in -i mode\n"));
+ fprintf(out, _(" -b, --binary\n" + fprintf(out, _(" -b, --binary\n"
@ -66,7 +67,7 @@ diff -urN sed-4.2.2/sed/sed.c sed-4.2.2.new00/sed/sed.c
If no -e, --expression, -f, or --file option is given, then the first\n\ If no -e, --expression, -f, or --file option is given, then the first\n\
non-option argument is taken as the sed script to interpret. All\n\ non-option argument is taken as the sed script to interpret. All\n\
@@ -158,9 +171,9 @@ @@ -158,9 +171,9 @@
char **argv; main (int argc, char **argv)
{ {
#ifdef REG_PERL #ifdef REG_PERL
-#define SHORTOPTS "bsnrzRuEe:f:l:i::V:" -#define SHORTOPTS "bsnrzRuEe:f:l:i::V:"
@ -76,7 +77,7 @@ diff -urN sed-4.2.2/sed/sed.c sed-4.2.2.new00/sed/sed.c
+#define SHORTOPTS "bcsnrzuEe:f:l:i::" +#define SHORTOPTS "bcsnrzuEe:f:l:i::"
#endif #endif
static struct option longopts[] = { enum { SANDBOX_OPTION = CHAR_MAX+1 };
@@ -172,6 +185,7 @@ @@ -172,6 +185,7 @@
{"expression", 1, NULL, 'e'}, {"expression", 1, NULL, 'e'},
{"file", 1, NULL, 'f'}, {"file", 1, NULL, 'f'},
@ -86,33 +87,33 @@ diff -urN sed-4.2.2/sed/sed.c sed-4.2.2.new00/sed/sed.c
{"null-data", 0, NULL, 'z'}, {"null-data", 0, NULL, 'z'},
{"zero-terminated", 0, NULL, 'z'}, {"zero-terminated", 0, NULL, 'z'},
@@ -246,6 +260,10 @@ @@ -246,6 +260,10 @@
follow_symlinks = true; follow_symlinks = true;
break; break;
+ case 'c': + case 'c':
+ copy_instead_of_rename = true; + copy_instead_of_rename = true;
+ break; + break;
+ +
case 'i': case 'i':
separate_files = true; separate_files = true;
if (optarg == NULL) if (optarg == NULL)
@@ -272,9 +290,11 @@ @@ -272,9 +290,11 @@
posixicity = POSIXLY_BASIC; posixicity = POSIXLY_BASIC;
break; break;
- case 'b': - case 'b':
+ case 'b': + case 'b':
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(MSDOS) || defined(__EMX__) +#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(MSDOS) || defined(__EMX__)
read_mode = "rb"; read_mode = "rb";
write_mode = "wb"; write_mode = "wb";
+#endif +#endif
break; break;
/* Undocumented, for compatibility with BSD sed. */ case 'E':
@@ -314,6 +334,12 @@ @@ -314,6 +334,12 @@
} }
} }
+ if (copy_instead_of_rename && in_place_extension == NULL) + if (copy_instead_of_rename && in_place_extension == NULL)
+ { + {
+ fprintf (stderr, _("Error: -c used without -i.\n")); + fprintf (stderr, _("Error: -c used without -i.\n"));
@ -122,9 +123,9 @@ diff -urN sed-4.2.2/sed/sed.c sed-4.2.2.new00/sed/sed.c
if (!the_program) if (!the_program)
{ {
if (optind < argc) if (optind < argc)
diff -urN sed-4.2.2/sed/sed.h sed-4.2.2.new00/sed/sed.h diff -urN sed-4.3/sed/sed.h sed-4.3.new00/sed/sed.h
--- sed-4.2.2/sed/sed.h 2012-07-25 12:33:09.000000000 +0200 --- sed-4.3/sed/sed.h 2012-07-25 12:33:09.000000000 +0200
+++ sed-4.2.2.new00/sed/sed.h 2014-02-10 14:40:25.602629419 +0100 +++ sed-4.3.new00/sed/sed.h 2014-02-10 14:40:25.602629419 +0100
@@ -230,6 +230,10 @@ @@ -230,6 +230,10 @@
/* How do we edit files in-place? (we don't if NULL) */ /* How do we edit files in-place? (we don't if NULL) */
extern char *in_place_extension; extern char *in_place_extension;
@ -134,33 +135,28 @@ diff -urN sed-4.2.2/sed/sed.h sed-4.2.2.new00/sed/sed.h
+extern int copy_instead_of_rename; +extern int copy_instead_of_rename;
+ +
/* The mode to use to read and write files, either "rt"/"w" or "rb"/"wb". */ /* The mode to use to read and write files, either "rt"/"w" or "rb"/"wb". */
extern char *read_mode; extern char const *read_mode;
extern char *write_mode; extern char const *write_mode;
diff -urN sed-4.2.2/sed/utils.c sed-4.2.2.new00/sed/utils.c diff -urN sed-4.3/sed/utils.c sed-4.3.new00/sed/utils.c
--- sed-4.2.2/sed/utils.c 2012-03-16 10:13:31.000000000 +0100 --- sed-4.3/sed/utils.c 2012-03-16 10:13:31.000000000 +0100
+++ sed-4.2.2.new00/sed/utils.c 2014-02-10 14:40:25.603629422 +0100 +++ sed-4.3.new00/sed/utils.c 2014-02-10 14:40:25.603629422 +0100
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h> #include <limits.h>
+#include <fcntl.h> +#include <fcntl.h>
#include "unlocked-io.h"
#include "utils.h" #include "utils.h"
#include "pathmax.h" @@ -363,31 +364,106 @@
@@ -410,33 +411,109 @@
return fname;
#endif /* ENABLE_FOLLOW_SYMLINKS */ #endif /* ENABLE_FOLLOW_SYMLINKS */
} }
+
-/* Panic on failing rename */ -/* Panic on failing rename */
+/* Panic on failing unlink */ +/* Panic on failing unlink */
void void
-ck_rename (from, to, unlink_if_fail) -ck_rename (const char *from, const char *to, const char *unlink_if_fail)
- const char *from, *to; +ck_unlink (const char *name)
- const char *unlink_if_fail;
+ck_unlink (name)
+ const char *name;
{ {
- int rd = rename (from, to); - int rd = rename (from, to);
- if (rd != -1) - if (rd != -1)
@ -198,7 +194,8 @@ diff -urN sed-4.2.2/sed/utils.c sed-4.2.2.new00/sed/utils.c
errno = 0; errno = 0;
- unlink (unlink_if_fail); - unlink (unlink_if_fail);
- /* Failure to remove the temporary file is more severe, so trigger it first. */ - /* Failure to remove the temporary file is more severe,
- so trigger it first. */
- if (errno != 0) - if (errno != 0)
- panic (_("cannot remove %s: %s"), unlink_if_fail, strerror (errno)); - panic (_("cannot remove %s: %s"), unlink_if_fail, strerror (errno));
+ infile = fopen (from, "r"); + infile = fopen (from, "r");
@ -218,18 +215,18 @@ diff -urN sed-4.2.2/sed/utils.c sed-4.2.2.new00/sed/utils.c
+ size_t bytes_in = fread (buf, 1, sizeof (buf), infile); + size_t bytes_in = fread (buf, 1, sizeof (buf), infile);
+ size_t bytes_out; + size_t bytes_out;
+ if (bytes_in == 0) + if (bytes_in == 0)
+ { + {
+ if (ferror (infile)) + if (ferror (infile))
+ retval = -1; + retval = -1;
+ break; + break;
+ } + }
+ +
+ bytes_out = fwrite (buf, 1, bytes_in, outfile); + bytes_out = fwrite (buf, 1, bytes_in, outfile);
+ if (bytes_out != bytes_in) + if (bytes_out != bytes_in)
+ { + {
+ retval = -1; + retval = -1;
+ break; + break;
+ } + }
} }
+ fclose (outfile); + fclose (outfile);
@ -270,12 +267,12 @@ diff -urN sed-4.2.2/sed/utils.c sed-4.2.2.new00/sed/utils.c
diff -urN sed-4.2.2/sed/utils.h sed-4.2.2.new00/sed/utils.h diff -urN sed-4.3/sed/utils.h sed-4.3.new00/sed/utils.h
--- sed-4.2.2/sed/utils.h 2012-03-16 10:13:31.000000000 +0100 --- sed-4.3/sed/utils.h 2012-03-16 10:13:31.000000000 +0100
+++ sed-4.2.2.new00/sed/utils.h 2014-02-10 14:40:25.603629422 +0100 +++ sed-4.3.new00/sed/utils.h 2014-02-10 14:40:25.603629422 +0100
@@ -33,6 +33,8 @@ @@ -33,6 +33,8 @@
FILE * ck_mkstemp (char **p_filename, const char *tmpdir, const char *base, FILE * ck_mkstemp (char **p_filename, const char *tmpdir, const char *base,
const char *mode); const char *mode) _GL_ARG_NONNULL ((1, 2, 3, 4));
void ck_rename (const char *from, const char *to, const char *unlink_if_fail); 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_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_fcmove (const char *from, const char *to, const char *unlink_if_fail);

View File

@ -2,12 +2,12 @@
Summary: A GNU stream text editor Summary: A GNU stream text editor
Name: sed Name: sed
Version: 4.2.2 Version: 4.3
Release: 15%{?dist} Release: 1%{?dist}
License: GPLv3+ License: GPLv3+
Group: Applications/Text Group: Applications/Text
URL: http://sed.sourceforge.net/ URL: http://sed.sourceforge.net/
Source0: ftp://ftp.gnu.org/pub/gnu/sed/sed-%{version}.tar.bz2 Source0: ftp://ftp.gnu.org/pub/gnu/sed/sed-%{version}.tar.xz
Source1: http://sed.sourceforge.net/sedfaq.txt Source1: http://sed.sourceforge.net/sedfaq.txt
Patch0: sed-4.2.2-binary_copy_args.patch Patch0: sed-4.2.2-binary_copy_args.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -73,6 +73,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man*/* %{_mandir}/man*/*
%changelog %changelog
* Wed Jan 04 2017 Jakub Martisko <jamartis@redhat.com> - 4.3-1
- new version 4.3
- Resolves: #1410093
* Tue Feb 09 2016 Petr Stodulka <pstodulk@redhat.com> - 4.2.2-15 * Tue Feb 09 2016 Petr Stodulka <pstodulk@redhat.com> - 4.2.2-15
- provides /bin/sed - provides /bin/sed
@ -135,7 +139,7 @@ rm -rf ${RPM_BUILD_ROOT}
* Wed Jun 13 2012 Martin Briza <mbriza@redhat.com> - 4.2.1-9 * Wed Jun 13 2012 Martin Briza <mbriza@redhat.com> - 4.2.1-9
- Backported commit from upstream to fix treating "x26" as "&" character - Backported commit from upstream to fix treating "x26" as "&" character
- Added virtual provide for gnulib according to http://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries - Added virtual provide for gnulib according to http://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries
Resolves: #812067 #821776 Resolves: #812067 #821776
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2.1-8 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2.1-8
@ -326,7 +330,7 @@ rm -rf ${RPM_BUILD_ROOT}
* Tue Jan 18 2000 Jakub Jelinek <jakub@redhat.com> * Tue Jan 18 2000 Jakub Jelinek <jakub@redhat.com>
- rebuild with glibc 2.1.3 to fix an mmap64 bug in sys/mman.h - rebuild with glibc 2.1.3 to fix an mmap64 bug in sys/mman.h
* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> * Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
- auto rebuild in the new build environment (release 4) - auto rebuild in the new build environment (release 4)
* Tue Aug 18 1998 Jeff Johnson <jbj@redhat.com> * Tue Aug 18 1998 Jeff Johnson <jbj@redhat.com>

View File

@ -1 +1 @@
7ffe1c7cdc3233e1e0c4b502df253974 sed-4.2.2.tar.bz2 SHA512 (sed-4.3.tar.xz) = 4d76a099cf7115763b79b45be5c96338750baa47e34c36075f714e022614397aa9240099d6d009e69aa4d06b6cfc14dcc0f8313442a1465f448b36fb6874a26d