Rebase to 451

This commit is contained in:
Martin Briza 2012-09-11 15:15:06 +02:00
parent a408f5cba5
commit e1aee64c27
4 changed files with 9 additions and 96 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/less-436.tar.gz
/less-443.tar.gz
/less-444.tar.gz
/less-451.tar.gz

View File

@ -1,87 +0,0 @@
diff -rup less-436-orig/filename.c less-436/filename.c
--- less-436-orig/filename.c 2009-07-06 22:52:23.000000000 +0200
+++ less-436/filename.c 2011-02-09 16:36:59.508940154 +0100
@@ -843,6 +843,16 @@ open_altfile(filename, pf, pfd)
#else
lessopen++;
returnfd = 1;
+
+ if (*lessopen == '|') {
+ /*
+ * If there is another vertical bar |, after
+ * the first one, it indicates a "pipe preprocessor"
+ * with correct exit status.
+ */
+ lessopen++;
+ returnfd = 2;
+ }
#endif
}
if (*lessopen == '-') {
@@ -879,17 +888,32 @@ open_altfile(filename, pf, pfd)
*/
f = fileno(fd);
SET_BINARY(f);
+ *pfd = (void *) fd;
+ *pf = f;
if (read(f, &c, 1) != 1)
{
/*
- * Pipe is empty. This means there is no alt file.
+ * Error or pipe is empty. Close it and eventually
+ * check exit status of the pipe process.
*/
- pclose(fd);
+ if (pclose(fd) == 0 && returnfd == 2) {
+ /*
+ * Exit status was zero, so the EOF was correct
+ * empty output. Let the program open /dev/null
+ * instead, as the pipe is already closed.
+ * Set force_open to omit bad_file() check
+ * failure, as it is special 'c' pseudo-device.
+ */
+ *pf = 0;
+ *pfd = NULL;
+ force_open = 1;
+ return (save("/dev/null"));
+ }
+ *pf = 0;
+ *pfd = NULL;
return (NULL);
}
ch_ungetchar(c);
- *pfd = (void *) fd;
- *pf = f;
return (save("-"));
}
#endif
diff -rup less-436-orig/less.nro less-436/less.nro
--- less-436-orig/less.nro 2011-02-09 16:00:12.520936431 +0100
+++ less-436/less.nro 2011-02-09 16:30:33.161235986 +0100
@@ -1147,11 +1147,26 @@ lesspipe.sh:
.br
;;
.br
+ *) exit 1
+.br
+ ;;
+.br
esac
.br
+ exit $?
+.br
.PP
To use this script, put it where it can be executed and set
LESSOPEN="|lesspipe.sh %s".
+.PP
+The script should return zero if the output was valid and non-zero
+otherwise, so less could detect even a valid empty output
+(for example while uncompressing gzipped empty file).
+For backward-compatibility, this is not required by default. To turn
+this functionality there should be another vertical bar (|) straight
+after the first one in the LESSOPEN environment variable, eg.
+LESSOPEN="||lesspipe.sh %s".
+.PP
When an input pipe is used, a LESSCLOSE postprocessor can be used,
but it is usually not necessary since there is no replacement file
to clean up.

View File

@ -1,7 +1,7 @@
Summary: A text file browser similar to more, but better
Name: less
Version: 444
Release: 8%{?dist}
Version: 451
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Text
Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz
@ -13,8 +13,7 @@ Patch2: less-394-search.patch
Patch4: less-394-time.patch
Patch5: less-418-fsync.patch
Patch6: less-436-manpage-add-old-bot-option.patch
Patch8: less-436-help.patch
Patch9: less-436-empty-lessopen-pipe.patch
Patch7: less-436-help.patch
URL: http://www.greenwoodsoftware.com/less/
Requires: groff
BuildRequires: ncurses-devel
@ -37,8 +36,7 @@ files, and you'll use it frequently.
%patch4 -p1 -b .time
%patch5 -p1 -b .fsync
%patch6 -p1 -b .manpage-add-old-bot-option
%patch8 -p1 -b .help
%patch9 -p1 -b .empty-lessopen-pipe
%patch7 -p1 -b .help
autoreconf
chmod -R a+w *
@ -68,8 +66,9 @@ ls -la $RPM_BUILD_ROOT/etc/profile.d
rm -rf $RPM_BUILD_ROOT
%changelog
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 444-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Tue Sep 11 2012 Martin Briza <mbriza@redhat.com> - 451-1
- Rebase to 451 (#835802)
- Removed the empty-lessopen-pipe patch as the issue is now fixed upstream.
* Mon May 14 2012 Vojtech Vitek (V-Teq) <vvitek@redhat.com> - 444-7
- Fix less.sh not to override user-defined LESSOPEN variable (#802757)

View File

@ -1 +1 @@
56f9f76ffe13f70155f47f6b3c87d421 less-444.tar.gz
765f082658002b2b46b86af4a0da1842 less-451.tar.gz