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.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
--- sed-4.2.2/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
diff -urN sed-4.3/sed/execute.c sed-4.3.new00/sed/execute.c
--- sed-4.3/sed/execute.c 2012-03-16 10:13:31.000000000 +0100
+++ sed-4.3.new00/sed/execute.c 2014-02-10 14:40:25.603629422 +0100
@@ -703,11 +703,13 @@
if (strcmp(in_place_extension, "*") != 0)
{
char *backup_file_name = get_backup_file_name(target_name);
- ck_rename (target_name, backup_file_name, input->out_file_name);
+ (copy_instead_of_rename?ck_fccopy:ck_rename)
- ck_rename (target_name, backup_file_name, input->out_file_name);
+ (copy_instead_of_rename?ck_fccopy:ck_rename)
+ (target_name, backup_file_name, input->out_file_name);
free (backup_file_name);
}
}
- ck_rename (input->out_file_name, target_name, input->out_file_name);
+ (copy_instead_of_rename?ck_fcmove:ck_rename)
+ (input->out_file_name, target_name, input->out_file_name);
cancel_cleanup ();
free (input->out_file_name);
}
else
diff -urN sed-4.2.2/sed/sed.c sed-4.2.2.new00/sed/sed.c
--- sed-4.2.2/sed/sed.c 2012-03-16 10:13:31.000000000 +0100
+++ sed-4.2.2.new00/sed/sed.c 2014-02-10 17:37:19.381273509 +0100
diff -urN sed-4.3/sed/sed.c sed-4.3.new00/sed/sed.c
--- sed-4.3/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
@@ -56,6 +56,10 @@
/* How do we edit files in-place? (we don't if 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).*/
+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". */
char *read_mode = "r";
char *write_mode = "w";
@@ -117,10 +121,17 @@
#endif
char const *read_mode = "r";
char const *write_mode = "w";
@@ -117,11 +121,16 @@
fprintf(out, _(" -i[SUFFIX], --in-place[=SUFFIX]\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\
- 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\
+ use copy instead of rename when shuffling files in -i mode\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\
non-option argument is taken as the sed script to interpret. All\n\
@@ -158,9 +171,9 @@
char **argv;
main (int argc, char **argv)
{
#ifdef REG_PERL
-#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::"
#endif
static struct option longopts[] = {
enum { SANDBOX_OPTION = CHAR_MAX+1 };
@@ -172,6 +185,7 @@
{"expression", 1, NULL, 'e'},
{"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'},
{"zero-terminated", 0, NULL, 'z'},
@@ -246,6 +260,10 @@
follow_symlinks = true;
break;
+ case 'c':
+ copy_instead_of_rename = true;
+ break;
follow_symlinks = true;
break;
+ case 'c':
+ copy_instead_of_rename = true;
+ break;
+
case 'i':
separate_files = true;
if (optarg == NULL)
case 'i':
separate_files = true;
if (optarg == NULL)
@@ -272,9 +290,11 @@
posixicity = POSIXLY_BASIC;
break;
posixicity = POSIXLY_BASIC;
break;
- case 'b':
+ case 'b':
+ case 'b':
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(MSDOS) || defined(__EMX__)
read_mode = "rb";
write_mode = "wb";
read_mode = "rb";
write_mode = "wb";
+#endif
break;
/* Undocumented, for compatibility with BSD sed. */
break;
case 'E':
@@ -314,6 +334,12 @@
}
}
}
+ if (copy_instead_of_rename && in_place_extension == NULL)
+ {
+ 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 (optind < argc)
diff -urN sed-4.2.2/sed/sed.h sed-4.2.2.new00/sed/sed.h
--- sed-4.2.2/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
diff -urN sed-4.3/sed/sed.h sed-4.3.new00/sed/sed.h
--- sed-4.3/sed/sed.h 2012-07-25 12:33:09.000000000 +0200
+++ sed-4.3.new00/sed/sed.h 2014-02-10 14:40:25.602629419 +0100
@@ -230,6 +230,10 @@
/* How do we edit files in-place? (we don't if NULL) */
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;
+
/* The mode to use to read and write files, either "rt"/"w" or "rb"/"wb". */
extern char *read_mode;
extern char *write_mode;
diff -urN sed-4.2.2/sed/utils.c sed-4.2.2.new00/sed/utils.c
--- sed-4.2.2/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
extern char const *read_mode;
extern char const *write_mode;
diff -urN sed-4.3/sed/utils.c sed-4.3.new00/sed/utils.c
--- sed-4.3/sed/utils.c 2012-03-16 10:13:31.000000000 +0100
+++ sed-4.3.new00/sed/utils.c 2014-02-10 14:40:25.603629422 +0100
@@ -27,6 +27,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <limits.h>
+#include <fcntl.h>
#include "unlocked-io.h"
#include "utils.h"
#include "pathmax.h"
@@ -410,33 +411,109 @@
return fname;
@@ -363,31 +364,106 @@
#endif /* ENABLE_FOLLOW_SYMLINKS */
}
+
-/* Panic on failing rename */
+/* Panic on failing unlink */
void
-ck_rename (from, to, unlink_if_fail)
- const char *from, *to;
- const char *unlink_if_fail;
+ck_unlink (name)
+ const char *name;
-ck_rename (const char *from, const char *to, const char *unlink_if_fail)
+ck_unlink (const char *name)
{
- int rd = rename (from, to);
- 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;
- 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)
- panic (_("cannot remove %s: %s"), unlink_if_fail, strerror (errno));
+ 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_out;
+ if (bytes_in == 0)
+ {
+ if (ferror (infile))
+ retval = -1;
+ break;
+ }
+ {
+ if (ferror (infile))
+ retval = -1;
+ break;
+ }
+
+ bytes_out = fwrite (buf, 1, bytes_in, outfile);
+ if (bytes_out != bytes_in)
+ {
+ retval = -1;
+ break;
+ }
+ {
+ retval = -1;
+ break;
+ }
}
+ 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
--- sed-4.2.2/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
diff -urN sed-4.3/sed/utils.h sed-4.3.new00/sed/utils.h
--- sed-4.3/sed/utils.h 2012-03-16 10:13:31.000000000 +0100
+++ sed-4.3.new00/sed/utils.h 2014-02-10 14:40:25.603629422 +0100
@@ -33,6 +33,8 @@
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_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);

View File

@ -2,12 +2,12 @@
Summary: A GNU stream text editor
Name: sed
Version: 4.2.2
Release: 15%{?dist}
Version: 4.3
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Text
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
Patch0: sed-4.2.2-binary_copy_args.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -73,6 +73,10 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man*/*
%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
- 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
- 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
* 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>
- 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)
* 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