rollback of previous regression/not a bug; early handling of 0
This commit is contained in:
parent
632b88cf21
commit
db9a82f2cb
@ -1,12 +0,0 @@
|
||||
diff -up ./filename.c.return-non-zero ./filename.c
|
||||
--- ./filename.c.return-non-zero 2013-04-04 18:55:05.000000000 +0200
|
||||
+++ ./filename.c 2014-06-19 13:10:50.692171380 +0200
|
||||
@@ -915,7 +915,7 @@ open_altfile(filename, pf, pfd)
|
||||
* If only one pipe char, just assume no alt file.
|
||||
*/
|
||||
int status = pclose(fd);
|
||||
- if (returnfd > 1 && status == 0) {
|
||||
+ if (returnfd > 1 && status != 0) {
|
||||
*pfd = NULL;
|
||||
*pf = -1;
|
||||
return (save(FAKE_EMPTYFILE));
|
10
less.spec
10
less.spec
@ -1,7 +1,7 @@
|
||||
Summary: A text file browser similar to more, but better
|
||||
Name: less
|
||||
Version: 458
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/Text
|
||||
Source: http://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz
|
||||
@ -19,7 +19,6 @@ Patch9: less-458-less-filters-man.patch
|
||||
Patch10: less-458-lesskey-usage.patch
|
||||
Patch11: less-458-old-bot-in-help.patch
|
||||
Patch12: less-458-outdated-unicode-data.patch
|
||||
Patch13: less-458-return-non-zero.patch
|
||||
URL: http://www.greenwoodsoftware.com/less/
|
||||
Requires: groff-base
|
||||
BuildRequires: ncurses-devel
|
||||
@ -48,7 +47,6 @@ files, and you'll use it frequently.
|
||||
%patch10 -p1 -b .lesskey-usage
|
||||
%patch11 -p1 -b .old-bot
|
||||
%patch12 -p1 -b .outdated-unicode-data
|
||||
%patch13 -p1 -b .return-non-zero
|
||||
autoreconf
|
||||
|
||||
chmod -R a+w *
|
||||
@ -78,6 +76,12 @@ ls -la $RPM_BUILD_ROOT/etc/profile.d
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%changelog
|
||||
* Mon Jun 23 2014 Jozef Mlich <jmlich@redhat.com> - 458-11
|
||||
- rollback of previous problem. See explanation of upstream.
|
||||
http://greenwoodsoftware.com/less/faq.html#profileout
|
||||
- fixing exit status values (the $? should be used as soon
|
||||
as possible)
|
||||
|
||||
* Thu Jun 19 2014 Jozef Mlich <jmlich@redhat.com> - 458-10
|
||||
- (lesspipe) better handling of exit status
|
||||
fixing regression of #186931 - turns over the lesspipe exit behavior
|
||||
|
54
lesspipe.sh
54
lesspipe.sh
@ -11,25 +11,13 @@
|
||||
# after the first one in the LESSOPEN environment variable:
|
||||
# export LESSOPEN="||/usr/bin/lesspipe.sh %s"
|
||||
|
||||
|
||||
# This function turns over return values.
|
||||
# 0 becomes 1 and anything else becomes 0
|
||||
# This behavior is forced because backward compatiblity
|
||||
# Bug #186931 - less breaks with tcsh's printexitvalue=1
|
||||
function handle_exit_status() {
|
||||
if [ $1 -eq 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ ! -e "$1" ] ; then
|
||||
handle_exit_status 1 $1 # passing exit status and name of not existing file
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$1" ] ; then
|
||||
ls -alF -- "$1"
|
||||
handle_exit_status $?
|
||||
exit $?
|
||||
fi
|
||||
|
||||
exec 2>/dev/null
|
||||
@ -38,7 +26,7 @@ exec 2>/dev/null
|
||||
if [ -x ~/.lessfilter ]; then
|
||||
~/.lessfilter "$1"
|
||||
if [ $? -eq 0 ]; then
|
||||
handle_exit_status 0
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -51,35 +39,35 @@ case "$1" in
|
||||
esac
|
||||
if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then
|
||||
$DECOMPRESSOR -- "$1" | groff -Tascii -mandoc -
|
||||
handle_exit_status $?
|
||||
exit $?
|
||||
fi ;;&
|
||||
*.[1-9n]|*.[1-9]x|*.man)
|
||||
if file "$1" | grep -q troff; then
|
||||
groff -Tascii -mandoc "$1" | cat -s
|
||||
handle_exit_status $?
|
||||
exit $?
|
||||
fi ;;&
|
||||
*.tar) tar tvvf "$1"; handle_exit_status $? ;;
|
||||
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1"; handle_exit_status $? ;;
|
||||
*.tar.xz) tar Jtvvf "$1"; handle_exit_status $? ;;
|
||||
*.xz|*.lzma) xz -dc -- "$1"; handle_exit_status $? ;;
|
||||
*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf -; handle_exit_status $? ;;
|
||||
*.[zZ]|*.gz) gzip -dc -- "$1"; handle_exit_status $? ;;
|
||||
*.bz2) bzip2 -dc -- "$1"; handle_exit_status $? ;;
|
||||
*.zip|*.jar|*.nbm) zipinfo -- "$1"; handle_exit_status $? ;;
|
||||
*.rpm) rpm -qpivl --changelog -- "$1"; handle_exit_status $? ;;
|
||||
*.cpi|*.cpio) cpio -itv < "$1"; handle_exit_status $? ;;
|
||||
*.gpg) gpg -d "$1"; handle_exit_status $? ;;
|
||||
*.tar) tar tvvf "$1"; exit $? ;;
|
||||
*.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1"; exit $? ;;
|
||||
*.tar.xz) tar Jtvvf "$1"; exit $? ;;
|
||||
*.xz|*.lzma) xz -dc -- "$1"; exit $? ;;
|
||||
*.tar.bz2|*.tbz2) bzip2 -dc -- "$1" | tar tvvf -; exit $? ;;
|
||||
*.[zZ]|*.gz) gzip -dc -- "$1"; exit $? ;;
|
||||
*.bz2) bzip2 -dc -- "$1"; exit $? ;;
|
||||
*.zip|*.jar|*.nbm) zipinfo -- "$1"; exit $? ;;
|
||||
*.rpm) rpm -qpivl --changelog -- "$1"; exit $? ;;
|
||||
*.cpi|*.cpio) cpio -itv < "$1"; exit $? ;;
|
||||
*.gpg) gpg -d "$1"; exit $? ;;
|
||||
*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif)
|
||||
if [ -x /usr/bin/identify ]; then
|
||||
identify "$1"
|
||||
handle_exit_status $?
|
||||
exit $?
|
||||
elif [ -x /usr/bin/gm ]; then
|
||||
gm identify "$1"
|
||||
handle_exit_status $?
|
||||
exit $?
|
||||
else
|
||||
echo "No identify available"
|
||||
echo "Install ImageMagick or GraphicsMagick to browse images"
|
||||
handle_exit_status 1
|
||||
exit 1
|
||||
fi ;;
|
||||
*)
|
||||
if [ -x /usr/bin/file ] && [ -x /usr/bin/iconv ] && [ -x /usr/bin/cut ]; then
|
||||
@ -91,9 +79,9 @@ case "$1" in
|
||||
env=`echo $LANG | cut -d. -f2`
|
||||
if [ -n "$env" -a "$conv" != "$env" ]; then
|
||||
iconv -f $conv -t $env "$1"
|
||||
handle_exit_status $?
|
||||
exit $?
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
handle_exit_status 1
|
||||
exit 1
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user