diff --git a/libedit-3.0-sigwinch.patch b/libedit-3.0-sigwinch.patch new file mode 100644 index 0000000..c9e63c2 --- /dev/null +++ b/libedit-3.0-sigwinch.patch @@ -0,0 +1,12 @@ +--- libedit-20090923-3.0/src/read.c.sigwinch 2009-09-23 22:04:26.000000000 +0100 ++++ libedit-20090923-3.0/src/read.c 2010-03-19 20:47:46.000000000 +0000 +@@ -301,6 +301,9 @@ read_char(EditLine *el, char *cp) + sig_set(el); + el_set(el, EL_REFRESH); + goto again; ++ } else if (el->el_signal->sig_no == SIGWINCH) { ++ sig_set(el); ++ goto again; + } + if (!tried && read__fixio(el->el_infd, errno) == 0) + tried = 1; diff --git a/libedit-3.0-warnings.patch b/libedit-3.0-warnings.patch new file mode 100644 index 0000000..c9e23a0 --- /dev/null +++ b/libedit-3.0-warnings.patch @@ -0,0 +1,91 @@ + examples/fileman.c | 3 ++- + src/readline.c | 6 ++++-- + src/vi.c | 18 +++++++++++------- + 3 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/examples/fileman.c b/examples/fileman.c +index f1d81af..026a4f4 100644 +--- a/examples/fileman.c ++++ b/examples/fileman.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + /* GNU readline + #include +@@ -275,7 +276,7 @@ command_generator (text, state) + + /* Return the next name which partially matches from the + command list. */ +- while (name = commands[list_index].name) ++ while ((name = commands[list_index].name)) + { + list_index++; + +diff --git a/src/readline.c b/src/readline.c +index 842ab44..b692e3f 100644 +--- a/src/readline.c ++++ b/src/readline.c +@@ -1270,8 +1270,10 @@ history_truncate_file (const char *filename, int nlines) + } + } + fflush(fp); +- if((off = ftello(fp)) > 0) +- (void)ftruncate(fileno(fp), off); ++ if((off = ftello(fp)) > 0) { ++ int sink = ftruncate(fileno(fp), off); ++ (void) sink; ++ } + out3: + fclose(tp); + out2: +diff --git a/src/vi.c b/src/vi.c +index 438aad4..a8e5e85 100644 +--- a/src/vi.c ++++ b/src/vi.c +@@ -1004,6 +1004,7 @@ vi_histedit(EditLine *el, int c) + int status; + char tempfile[] = "/tmp/histedit.XXXXXXXXXX"; + char *cp; ++ el_action_t rv = CC_ERROR; + + if (el->el_state.doingarg) { + if (vi_to_history_line(el, 0) == CC_ERROR) +@@ -1014,14 +1015,15 @@ vi_histedit(EditLine *el, int c) + if (fd < 0) + return CC_ERROR; + cp = el->el_line.buffer; +- write(fd, cp, (size_t)(el->el_line.lastchar - cp)); +- write(fd, "\n", 1); ++ if (write(fd, cp, (size_t)(el->el_line.lastchar - cp)) < 0 ++ || write(fd, "\n", 1) < 0) ++ /* FIXME: handle EAGAIN somehow? */ ++ goto fail; ++ + pid = fork(); + switch (pid) { + case -1: +- close(fd); +- unlink(tempfile); +- return CC_ERROR; ++ goto fail; + case 0: + close(fd); + execlp("vi", "vi", tempfile, (char *)NULL); +@@ -1039,10 +1041,12 @@ vi_histedit(EditLine *el, int c) + break; + } + ++ /* return CC_REFRESH; */ ++ rv = ed_newline(el, 0); ++fail: + close(fd); + unlink(tempfile); +- /* return CC_REFRESH; */ +- return ed_newline(el, 0); ++ return rv; + } + + /* vi_history_word(): diff --git a/libedit.spec b/libedit.spec index 8779f30..0d2f7dd 100644 --- a/libedit.spec +++ b/libedit.spec @@ -3,16 +3,22 @@ Summary: The NetBSD Editline library Name: libedit Version: 3.0 -Release: 1.%{snap}cvs%{?dist} +Release: 2.%{snap}cvs%{?dist} License: BSD Group: System Environment/Libraries URL: http://www.thrysoee.dk/editline/ Source0: http://www.thrysoee.dk/editline/%{name}-%{snap}-%{version}.tar.gz +# eliminate compile-time warnings +Patch0: libedit-3.0-warnings.patch + +# bz #575383 +Patch1: libedit-3.0-sigwinch.patch + BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -BuildRequires: gawk -BuildRequires: ncurses-devel +BuildRequires: gawk +BuildRequires: ncurses-devel %description Libedit is an autotool- and libtoolized port of the NetBSD Editline library. @@ -32,6 +38,8 @@ This package contains development files for %{name}. %prep %setup -q -n %{name}-%{snap}-%{version} +%patch0 -p1 +%patch1 -p1 # Suppress rpmlint error. iconv --from-code ISO8859-1 --to-code UTF-8 ./ChangeLog \ @@ -76,6 +84,11 @@ rm -rf $RPM_BUILD_ROOT %{_includedir}/editline/readline.h %changelog +* Tue Mar 30 2010 Kamil Dudka 3.0-2.20090923cvs +- eliminated compile-time warnings +- fix to not break the read loop on SIGWINCH, patch contributed + by Edward Sheldrake (#575383) + * Tue Nov 27 2009 Tom "spot" Callaway 3.0-1.20090923cvs - Update to 3.0 (20090923 snap)