From 07d59d3817bccdb814da0404e7f34b94884080124ef15abbbe039727ad4884f1 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 16 Aug 2010 08:50:08 +0000 Subject: [PATCH] Accepting request 45546 from home:dimstar:branches:Base:System Copy from home:dimstar:branches:Base:System/sed via accept of submit request 45546 revision 3. Request was accepted with message: OBS-URL: https://build.opensuse.org/request/show/45546 OBS-URL: https://build.opensuse.org/package/show/Base:System/sed?expand=0&rev=7 --- sed-4.1.5-fix_warnings.patch | 110 ----------------- sed-4.1.5.tar.bz2 | 3 - sed-4.2.1.tar.bz2 | 3 + sed-follow_symlinks.patch | 224 ----------------------------------- sed.changes | 30 +++++ sed.spec | 122 ++++--------------- 6 files changed, 53 insertions(+), 439 deletions(-) delete mode 100644 sed-4.1.5-fix_warnings.patch delete mode 100644 sed-4.1.5.tar.bz2 create mode 100644 sed-4.2.1.tar.bz2 delete mode 100644 sed-follow_symlinks.patch diff --git a/sed-4.1.5-fix_warnings.patch b/sed-4.1.5-fix_warnings.patch deleted file mode 100644 index ae2817e..0000000 --- a/sed-4.1.5-fix_warnings.patch +++ /dev/null @@ -1,110 +0,0 @@ -Index: sed-4.1.5/lib/utils.c -=================================================================== ---- sed-4.1.5.orig/lib/utils.c -+++ sed-4.1.5/lib/utils.c -@@ -97,7 +97,6 @@ panic(const char *str, ...) - { - if (open_files->temp) - { -- int fd = fileno (open_files->fp); - fclose (open_files->fp); - errno = 0; - unlink (open_files->name); -@@ -250,7 +249,7 @@ ck_getline(text, buflen, stream) - size_t *buflen; - FILE *stream; - { -- int result; -+ int result = -1; - if (!ferror (stream)) - result = getline (text, buflen, stream); - -@@ -312,7 +311,6 @@ void - do_ck_fclose(fp) - FILE *fp; - { -- int fd; - ck_fflush(fp); - clearerr(fp); - -Index: sed-4.1.5/sed/compile.c -=================================================================== ---- sed-4.1.5.orig/sed/compile.c -+++ sed-4.1.5/sed/compile.c -@@ -384,7 +384,6 @@ get_openfile(file_ptrs, mode, fail) - struct buffer *b; - char *file_name; - struct output *p; -- int is_stderr; - - b = read_filename(); - file_name = get_buffer(b); -@@ -457,7 +456,7 @@ snarf_char_class(b, cur_stat) - { - int ch; - int state = 0; -- int delim; -+ int delim = 0; - bool pending_mb = 0; - - ch = inchar(); -@@ -1581,7 +1580,6 @@ compile_file(cur_program, cmdfile) - struct vector *cur_program; - const char *cmdfile; - { -- size_t len; - struct vector *ret; - - prog.file = stdin; -Index: sed-4.1.5/sed/execute.c -=================================================================== ---- sed-4.1.5.orig/sed/execute.c -+++ sed-4.1.5/sed/execute.c -@@ -1062,7 +1062,7 @@ append_replacement (buf, p, regs, repl_m - curr_type &= ~REPL_MODIFIERS; - } - -- if (0 <= i) -+ if (0 <= i) { - if (regs->end[i] == regs->start[i] && p->repl_type & REPL_MODIFIERS) - /* Save this modifier, we shall apply it later. - e.g. in s/()([a-z])/\u\1\2/ -@@ -1073,6 +1073,7 @@ append_replacement (buf, p, regs, repl_m - str_append_modified(buf, line.active + regs->start[i], - CAST(size_t)(regs->end[i] - regs->start[i]), - curr_type); -+ } - } - - return repl_mod; -@@ -1100,7 +1101,7 @@ do_subst(sub) - ®s, sub->max_id + 1)) - return; - -- if (!sub->replacement && sub->numb <= 1) -+ if (!sub->replacement && sub->numb <= 1) { - if (regs.start[0] == 0 && !sub->global) - { - /* We found a match, set the `replaced' flag. */ -@@ -1119,6 +1120,7 @@ do_subst(sub) - line.length = regs.start[0]; - goto post_subst; - } -+ } - - do - { -@@ -1377,11 +1379,12 @@ execute_program(vec, input) - { - char buf[4096]; - int n = fread (buf, sizeof(char), 4096, pipe); -- if (n > 0) -+ if (n > 0) { - if (!cmd_length) - str_append(&s_accum, buf, n); - else - ck_fwrite(buf, 1, n, output_file.fp); -+ } - } - - pclose (pipe); diff --git a/sed-4.1.5.tar.bz2 b/sed-4.1.5.tar.bz2 deleted file mode 100644 index b61448d..0000000 --- a/sed-4.1.5.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9c4ba29b4674984bb534cbef3b9513895940d728a5b623f36d5c7529c71908c2 -size 645997 diff --git a/sed-4.2.1.tar.bz2 b/sed-4.2.1.tar.bz2 new file mode 100644 index 0000000..595470c --- /dev/null +++ b/sed-4.2.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ac3b36ca37bfeb43c4ef4025778cd66d89c77abb843d90552a515a7c9d2948f +size 899091 diff --git a/sed-follow_symlinks.patch b/sed-follow_symlinks.patch deleted file mode 100644 index 1dc535b..0000000 --- a/sed-follow_symlinks.patch +++ /dev/null @@ -1,224 +0,0 @@ -Index: sed-4.1.5/sed/sed.c -=================================================================== ---- sed-4.1.5.orig/sed/sed.c -+++ sed-4.1.5/sed/sed.c -@@ -70,6 +70,11 @@ bool no_default_output = false; - /* If set, reset line counts on every new file. */ - bool separate_files = false; - -+#ifdef ENABLE_FOLLOW_SYMLINKS -+/* If set, follow symlinks when processing in place */ -+bool follow_symlinks = false; -+#endif -+ - /* How do we edit files in-place? (we don't if NULL) */ - char *in_place_extension = NULL; - -@@ -105,6 +110,10 @@ Usage: %s [OPTION]... {script-only-if-no - add the script to the commands to be executed\n")); - fprintf(out, _(" -f script-file, --file=script-file\n\ - add the contents of script-file to the commands to be executed\n")); -+#ifdef ENABLE_FOLLOW_SYMLINKS -+ fprintf(out, _(" --follow-symlinks\n\ -+ follow symlinks when processing in place\n")); -+#endif - fprintf(out, _(" -i[SUFFIX], --in-place[=SUFFIX]\n\ - edit files in place (makes backup if extension supplied)\n")); - fprintf(out, _(" -l N, --line-length=N\n\ -@@ -163,6 +172,9 @@ main(argc, argv) - {"unbuffered", 0, NULL, 'u'}, - {"version", 0, NULL, 'v'}, - {"help", 0, NULL, 'h'}, -+#ifdef ENABLE_FOLLOW_SYMLINKS -+ {"follow-symlinks", 0, NULL, 'F'}, -+#endif - {NULL, 0, NULL, 0} - }; - -@@ -215,6 +227,12 @@ main(argc, argv) - the_program = compile_file(the_program, optarg); - break; - -+#ifdef ENABLE_FOLLOW_SYMLINKS -+ case 'F': -+ follow_symlinks = true; -+ break; -+#endif -+ - case 'i': - separate_files = true; - if (optarg == NULL) -Index: sed-4.1.5/lib/utils.c -=================================================================== ---- sed-4.1.5.orig/lib/utils.c -+++ sed-4.1.5/lib/utils.c -@@ -35,6 +35,13 @@ - # include - #endif /* HAVE_STDLIB_H */ - -+#ifdef ENABLE_FOLLOW_SYMLINKS -+# include -+# include -+# include -+# include -+#endif /* ENABLE_FOLLOW_SYMLINKS */ -+ - #include "utils.h" - - const char *myname; -@@ -315,6 +322,65 @@ do_ck_fclose(fp) - } - - -+#ifdef ENABLE_FOLLOW_SYMLINKS -+static char buf[2048], buf2[2048]; -+static size_t bufsize = sizeof (buf); -+ -+/* Follow symlink and panic if something fails. Returned value is -+ ultimate symlink target, stored in temporary buffer. You need to -+ strdup the return value, if you intend to use it later.*/ -+const char * -+ck_follow_symlink(const char * fname) -+{ -+ static struct stat statbuf; -+ int err; -+ char * dir; -+ -+ if (strlen (fname) >= bufsize) -+ panic("ck_follow_symlink: file name too long"); -+ strcpy (buf, fname); -+ -+ while (1) -+ { -+ err = lstat (buf, &statbuf); -+ -+ if (err != 0) -+ panic("ck_follow_symlink: couldn't lstat %s: %s", buf, strerror(errno)); -+ -+ if ((statbuf.st_mode & S_IFLNK) == S_IFLNK) -+ { -+ err = readlink (buf, buf2, bufsize); -+ -+ if (err < 0) -+ panic("ck_follow_symlink: readlink failed on %s: %s", buf, strerror(errno)); -+ else if (err == bufsize) -+ panic("ck_follow_symlink: pointee name too long"); -+ else -+ buf2 [err] = '\0'; -+ -+ /* need to handle relative paths with care */ -+ if (buf2[0] != '/') -+ { -+ dir = dirname (buf); // dir part of orig path -+ int len = strlen (dir); // orig path len -+ buf[len] = '/'; -+ strncpy (buf+len+1, buf2, bufsize - len - 1); -+ if (buf[bufsize-1] != 0) -+ panic("ck_follow_symlink: pointee name too long"); -+ } -+ else -+ { -+ strcpy (buf, buf2); -+ } -+ } -+ else -+ break; -+ } -+ -+ return buf; -+} -+#endif /* ENABLE_FOLLOW_SYMLINKS */ -+ - /* Panic on failing rename */ - void - ck_rename (from, to, unlink_if_fail) -Index: sed-4.1.5/lib/utils.h -=================================================================== ---- sed-4.1.5.orig/lib/utils.h -+++ sed-4.1.5/lib/utils.h -@@ -27,6 +27,9 @@ void ck_fwrite P_((const VOID *ptr, size - size_t ck_fread P_((VOID *ptr, size_t size, size_t nmemb, FILE *stream)); - void ck_fflush P_((FILE *stream)); - void ck_fclose P_((FILE *stream)); -+#ifdef ENABLE_FOLLOW_SYMLINKS -+const char *ck_follow_symlink P_((const char *path)); -+#endif - size_t ck_getline P_((char **text, size_t *buflen, FILE *stream)); - FILE * ck_mkstemp P_((char **p_filename, char *tmpdir, char *base)); - void ck_rename P_((const char *from, const char *to, const char *unlink_if_fail)); -Index: sed-4.1.5/sed/execute.c -=================================================================== ---- sed-4.1.5.orig/sed/execute.c -+++ sed-4.1.5/sed/execute.c -@@ -711,16 +711,34 @@ closedown(input) - - if (in_place_extension && output_file.fp != NULL) - { -+#ifdef ENABLE_FOLLOW_SYMLINKS -+ char *target_name; -+ -+ if (follow_symlinks) -+ target_name = ck_strdup(ck_follow_symlink(input->in_file_name)); -+ else -+ target_name = ck_strdup(input->in_file_name); -+#else -+ const char *target_name; -+ -+ target_name = input->in_file_name; -+#endif -+ - ck_fclose (output_file.fp); - if (strcmp(in_place_extension, "*") != 0) - { -- char *backup_file_name = get_backup_file_name(input->in_file_name); -- ck_rename (input->in_file_name, backup_file_name, input->out_file_name); -+ char *backup_file_name = get_backup_file_name(target_name); -+ ck_rename (target_name, backup_file_name, input->out_file_name); -+ - free (backup_file_name); - } - -- ck_rename (input->out_file_name, input->in_file_name, input->out_file_name); -+ ck_rename (input->out_file_name, target_name, input->out_file_name); -+ - free (input->out_file_name); -+#ifdef ENABLE_FOLLOW_SYMLINKS -+ free (target_name); -+#endif - } - - input->fp = NULL; -Index: sed-4.1.5/sed/sed.h -=================================================================== ---- sed-4.1.5.orig/sed/sed.h -+++ sed-4.1.5/sed/sed.h -@@ -219,6 +219,11 @@ extern bool no_default_output; - /* If set, reset line counts on every new file. */ - extern bool separate_files; - -+#ifdef ENABLE_FOLLOW_SYMLINKS -+/* If set, follow symlinks when invoked with -i option */ -+extern bool follow_symlinks; -+#endif -+ - /* Do we need to be pedantically POSIX compliant? */ - extern enum posixicity_types posixicity; - -Index: sed-4.1.5/configure.ac -=================================================================== ---- sed-4.1.5.orig/configure.ac -+++ sed-4.1.5/configure.ac -@@ -117,6 +117,13 @@ enable_html=no) - - AM_CONDITIONAL(BUILD_HTML, test "x$enable_html" != xno) - -+# follow symlinks -+AC_CHECK_FUNC(lstat, have_lstat=yes) -+AC_CHECK_FUNC(readlink, have_readlink=yes) -+if test "x$have_lstat" = xyes -a "x$have_readlink" = xyes; then -+ AC_DEFINE(ENABLE_FOLLOW_SYMLINKS, ,[Follow symlinks when processing in place]) -+fi -+ - : ${TEXI2HTML=texi2html -monolithic} - AC_SUBST(TEXI2HTML) - diff --git a/sed.changes b/sed.changes index 2a5fa97..4f32213 100644 --- a/sed.changes +++ b/sed.changes @@ -1,3 +1,33 @@ +------------------------------------------------------------------- +Fri Aug 13 11:10:53 CEST 2010 - dimstar@opensuse.org + +- Update to version 4.2.1: + + fix parsing of s/[[[[[[[[[]// + + security contexts are preserved by -i too under SELinux + + temporary files for sed -i are not made group/world-readable + until they are complete +- Changes from version 4.2: + + now released under GPLv3 + + added a new extension `z` to clear pattern space even in the + presence of invalid multibyte sequences + + a preexisting GNU gettext installation is needed in order to + compile GNU sed with NLS support + + new option --follow-symlinks, available when editing a file + in-place. + + hold-space is reset between different files in -i and -s modes. + + multibyte processing fixed + + fixed bug in 'i\' giving a segmentation violation if given + alone. + + much improved portability + + much faster in UTF-8 locales + + will correctly replace ACLs when using -i + + will now accept NUL bytes for `.' +- Drop upstream included [atches: + + sed-follow_symlinks.patch + + sed-4.1.5-fix_warnings.patch +- Remove --enable-html from configure: the option is no longer + supported and sed.html no longer created. + ------------------------------------------------------------------- Mon Jun 28 06:38:35 UTC 2010 - jengelh@medozas.de diff --git a/sed.spec b/sed.spec index 23467b8..dca9c07 100644 --- a/sed.spec +++ b/sed.spec @@ -1,5 +1,5 @@ # -# spec file for package sed (Version 4.1.5) +# spec file for package sed (Version 4.2.1) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -15,22 +15,18 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild Name: sed -Url: http://www.gnu.org/directory/sed.html -Version: 4.1.5 -Release: 137 -License: GPLv2+ -Group: System/Base +Version: 4.2.1 +Release: 1 +License: GPLv3 Summary: A Stream-Oriented Non-Interactive Text Editor -Provides: base:/bin/sed -PreReq: %install_info_prereq -AutoReqProv: on +Url: http://www.gnu.org/directory/sed.html +Group: System/Base Source: %name-%version.tar.bz2 -Patch0: sed-follow_symlinks.patch -Patch1: sed-4.1.5-fix_warnings.patch +PreReq: %install_info_prereq +Provides: base:/bin/sed BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -39,82 +35,8 @@ outputs the modified text. Sed is typically used for extracting parts of a file using pattern matching or for substituting multiple occurrences of a string within a file. - - -Authors: --------- - Francois Pinard - Tom Lord - David J. MacKenzie - Akiko Matsushita - Alan Magnuson - Alexander Lehmann - Amos Shapira - Andreas Gustafsson - Andreas Schwab - Assar Westerlund - Ben A. Mesander - Bengt Mertensson - Bernhard Daeubler - Bjorn R. Bjornsson - Brendan Kehoe - Erez Zadok - Eric Allman - Eric Backus - Geoff Russell - Greg A. Woods - Hal Peterson - Hoang Uong - Ian Lance Taylor - Jason Merrill - Jim Avera - Jim Kingdon - Jim Meyering - Joel Sherrill - John David Anglin - Joseph E. Sacco - Karl Berry - Karl Vogel - Kaveh R. Ghazi - Kristine Lund - Krste Asanovic - Marion Hakanson - Mark Seiden - Matthias Rabe - Michael Fetterman - Michael L. Welcome - Mike Lijewski - Nick S. Kanakakor - Nicolas Pioch - Noah Friedman - Pete Chown - Pierre Gaumond - Pierre Mathieu - Robert Bernstein - Rene' Seindal - Richard Stallman - Roland H. Pesch - Roland McGrath - Scott Bartram - Simon Leinen - Skip Montanaro - Stephen Perkins - Steve Williamson - Thorsten Ohl - Tom McConnell - Tom Quinn - Tom Tromey - Ulrich Drepper - Vern Paxson - Vivek P. Singhal - Walter Wong - Paolo Bonzini (bonzini@gnu.org) - Philip Hazel (ph10@cam.ac.uk) - %prep %setup -q -%patch0 -p1 -%patch1 -p1 %build %define warn_flags -Wall -Wstrict-prototypes -Wpointer-arith -Wformat-security @@ -122,12 +44,11 @@ Authors: cp /usr/share/gettext/config.rpath config autoreconf --force --install test -f po/Makevars.template && mv po/Makevars.template po/Makevars -export CFLAGS="$RPM_OPT_FLAGS %warn_flags" +export CFLAGS="%{optflags} %warn_flags" ./configure --prefix=/usr \ - --mandir=%_mandir \ - --infodir=%_infodir \ + --mandir=%{_mandir} \ + --infodir=%{_infodir} \ --without-included-regex \ - --enable-html \ %{_target_cpu}-suse-linux %if %do_profiling make %{?_smp_mflags} CFLAGS="$CFLAGS "%cflags_profile_generate @@ -142,26 +63,23 @@ make %{?_smp_mflags} check %install %makeinstall # Move sed to /bin: -mkdir -p $RPM_BUILD_ROOT/bin -mv $RPM_BUILD_ROOT/usr/bin/sed $RPM_BUILD_ROOT/bin -ln -s ../../bin/sed $RPM_BUILD_ROOT/usr/bin/sed -# Remove installed documentation (it is packaged directly in the files section). -# The actual directory depends on the build environment on the different architectures: -rm -f $RPM_BUILD_ROOT/usr/share/doc/sed.html $RPM_BUILD_ROOT/usr/share/doc/sed-4.1.5/sed.html +mkdir -p %{buildroot}/bin +mv %{buildroot}%{_bindir}/sed %{buildroot}/bin +ln -s ../../bin/sed %{buildroot}%{_bindir}/sed %find_lang %name %files -f %name.lang %defattr(-, root, root) /bin/sed -/usr/bin/sed -%doc AUTHORS BUGS COPYING* INSTALL NEWS README* THANKS doc/sed.html -%_infodir/sed.info*.gz -%_mandir/man*/*.gz +%{_bindir}/sed +%doc AUTHORS BUGS COPYING* INSTALL NEWS README* THANKS +%{_infodir}/sed.info*.gz +%{_mandir}/man*/*.gz %post -%install_info --info-dir=%_infodir %_infodir/%name.info.gz +%install_info --info-dir=%{_infodir} %{_infodir}/%name.info.gz %postun -%install_info_delete --info-dir=%_infodir %_infodir/%name.info.gz +%install_info_delete --info-dir=%{_infodir} %{_infodir}/%name.info.gz %changelog