Accepting request 538587 from Base:System

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/538587
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/less?expand=0&rev=52
This commit is contained in:
Dominique Leuenberger 2017-11-10 13:36:28 +00:00 committed by Git OBS Bridge
commit 453a1e5832
2 changed files with 34 additions and 19 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 27 06:03:36 UTC 2017 - werner@suse.de
- Let lessopen.sh also handle UTF-8 for (g)roff input, only apparmor
as breaker of /usr/bin/file re,mains as "file" is not allowed to
read files within the tool lessopen.sh
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Apr 28 11:45:22 UTC 2017 - werner@suse.de Fri Apr 28 11:45:22 UTC 2017 - werner@suse.de

View File

@ -23,10 +23,20 @@ NAME="${SRC##*/}"
[ ! -r "$SRC" ] && exit 1 [ ! -r "$SRC" ] && exit 1
TMPF=$(mktemp /tmp/less.XXXXXX) || exit 1 cleaner() {
TMPF_pre=$(mktemp /tmp/less.XXXXXX) || { rm -f "$TMPF"; exit 1; } test "$TMPF_pre" = "$SRC" -o "$TMPF_pre" = "$TMPF" && return
rm -f "$TMPF_pre"
}
trap 'cleaner' EXIT SIGHUP
TMPF=$(mktemp /tmp/less.XXXXXXXXX) || exit 1
TMPF_pre=$(mktemp /tmp/less.XXXXXXXXX) || exit 1
case $LANG in lang=$LANG
test -n "$LC_CTYPE" && lang="$LC_CTYPE"
case "$lang" in
*.UTF-8|*.UTF8)
GROFF_DEVICE=utf8
;;
ja*) ja*)
GROFF_DEVICE=nippon GROFF_DEVICE=nippon
;; ;;
@ -36,7 +46,7 @@ case $LANG in
esac esac
CMD= CMD=
type=`file -L "$SRC"` type=`/usr/bin/file -L "$SRC"`
case ${type#"$SRC": } in case ${type#"$SRC": } in
*"gzip compressed data"*|\ *"gzip compressed data"*|\
*"compress'd data"*|\ *"compress'd data"*|\
@ -56,20 +66,20 @@ esac
test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
type=`file -L "$TMPF_pre"` type=`/usr/bin/file -L "$TMPF_pre"`
case ${type#"$TMPF_pre": } in case ${type#"$TMPF_pre": } in
*tar\ archive*) *tar\ archive*)
if [ -x "`which tar 2>/dev/null`" ]; then if [ -x "`/usr/bin/which tar 2>/dev/null`" ]; then
tar tvvf "$TMPF_pre" >"$TMPF" 2>/dev/null tar tvvf "$TMPF_pre" >"$TMPF" 2>/dev/null
else echo "tar is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "tar is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*Microsoft\ Cabinet\ *\ data*) *Microsoft\ Cabinet\ *\ data*)
if [ -x "`which cabextract 2>/dev/null`" ]; then if [ -x "`/usr/bin/which cabextract 2>/dev/null`" ]; then
cabextract -l "$TMPF_pre" >"$TMPF" 2>/dev/null cabextract -l "$TMPF_pre" >"$TMPF" 2>/dev/null
else echo "cabextract is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "cabextract is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*RPM*) *RPM*)
if [ -x "`which rpm 2>/dev/null`" ]; then if [ -x "`/usr/bin/which rpm 2>/dev/null`" ]; then
(echo -e "=============================== Information ====================================\n"; (echo -e "=============================== Information ====================================\n";
rpm -qip "\"$TMPF_pre\""; rpm -qip "\"$TMPF_pre\"";
echo -e "\n\n================================= Changelog (head) =============================\n"; echo -e "\n\n================================= Changelog (head) =============================\n";
@ -80,24 +90,24 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
else echo "rpm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "rpm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*DVI*) *DVI*)
if [ -x "`which dvi2tty 2>/dev/null`" ]; then if [ -x "`/usr/bin/which dvi2tty 2>/dev/null`" ]; then
if [ "${TMPF_pre%.dvi}" != "$TMPF_pre" ] ; then if [ "${TMPF_pre%.dvi}" != "$TMPF_pre" ] ; then
dvi2tty -q "$TMPF_pre" >"$TMPF" 2>/dev/null dvi2tty -q "$TMPF_pre" >"$TMPF" 2>/dev/null
else echo "dvi2tty requires an input file name with the suffix .dvi" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre" ; fi else echo "dvi2tty requires an input file name with the suffix .dvi" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre" ; fi
else echo "dvi2tty is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "dvi2tty is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*PDF*) *PDF*)
if [ -x "`which pdftotext 2>/dev/null`" ]; then if [ -x "`/usr/bin/which pdftotext 2>/dev/null`" ]; then
pdftotext "$TMPF_pre" "$TMPF" 2>/dev/null pdftotext "$TMPF_pre" "$TMPF" 2>/dev/null
else echo "pdftotext is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "pdftotext is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*Debian\ binary\ package*) *Debian\ binary\ package*)
if [ -x "`which dpkg-deb 2>/dev/null`" ]; then if [ -x "`/usr/bin/which dpkg-deb 2>/dev/null`" ]; then
dpkg-deb -c "$TMPF_pre" >"$TMPF" 2>/dev/null dpkg-deb -c "$TMPF_pre" >"$TMPF" 2>/dev/null
else echo "dpkg-deb is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "dpkg-deb is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*\ ar\ archive*) *\ ar\ archive*)
if [ -x "`which nm 2>/dev/null`" ]; then if [ -x "`/usr/bin/which nm 2>/dev/null`" ]; then
nm "$TMPF_pre" >"$TMPF" 2>/dev/null nm "$TMPF_pre" >"$TMPF" 2>/dev/null
else echo "nm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "nm is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
@ -130,7 +140,7 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
done done
# if we have -R and colordiff, we can continue # if we have -R and colordiff, we can continue
if [ $R_NOT_SET = false ] && \ if [ $R_NOT_SET = false ] && \
[ -x "`which colordiff 2>/dev/null`" ]; then [ -x "`/usr/bin/which colordiff 2>/dev/null`" ]; then
colordiff < "$TMPF_pre" | cat > "$TMPF" 2>/dev/null colordiff < "$TMPF_pre" | cat > "$TMPF" 2>/dev/null
else rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
@ -138,7 +148,7 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
if [ "$LESS_ADVANCED_PREPROCESSOR" = "yes" ]; then if [ "$LESS_ADVANCED_PREPROCESSOR" = "yes" ]; then
case ${type#"$TMPF_pre": } in case ${type#"$TMPF_pre": } in
*troff*) *troff*)
if [ -x "`which groff 2>/dev/null`" ]; then if [ -x "`/usr/bin/which groff 2>/dev/null`" ]; then
case "$NAME" in case "$NAME" in
*.[1-9nxp]*|*.man|*.[1-9nxp]*.*|*.man.*) *.[1-9nxp]*|*.man|*.[1-9nxp]*.*|*.man.*)
groff -s -p -t -e -T$GROFF_DEVICE -mandoc "$TMPF_pre" >"$TMPF" 2>/dev/null ;; groff -s -p -t -e -T$GROFF_DEVICE -mandoc "$TMPF_pre" >"$TMPF" 2>/dev/null ;;
@ -152,14 +162,14 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
else echo "groff is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "groff is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*PostScript*) *PostScript*)
if [ -x "`which ps2ascii 2>/dev/null`" ]; then if [ -x "`/usr/bin/which ps2ascii 2>/dev/null`" ]; then
ps2ascii "$TMPF_pre" >"$TMPF" 2>/dev/null ps2ascii "$TMPF_pre" >"$TMPF" 2>/dev/null
else echo "ps2ascii is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "ps2ascii is not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
*HTML*) *HTML*)
if [ -x "`which w3m 2>/dev/null`" ]; then if [ -x "`/usr/bin/which w3m 2>/dev/null`" ]; then
w3m -dump -T text/html "$TMPF_pre" >"$TMPF" 2>/dev/null w3m -dump -T text/html "$TMPF_pre" >"$TMPF" 2>/dev/null
elif [ -x "`which lynx 2>/dev/null`" ]; then elif [ -x "`/usr/bin/which lynx 2>/dev/null`" ]; then
lynx -dump -force_html "$TMPF_pre" >"$TMPF" 2>/dev/null lynx -dump -force_html "$TMPF_pre" >"$TMPF" 2>/dev/null
else echo "lynx/w3m not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi else echo "lynx/w3m not available for preprocessing" 1>&2; rm -f "$TMPF"; TMPF="$TMPF_pre"; fi
;; ;;
@ -175,6 +185,4 @@ test -n "$CMD" && $CMD "$SRC" >"$TMPF_pre" 2>/dev/null
;; ;;
esac esac
test "$TMPF_pre" = "$SRC" -o "$TMPF_pre" = "$TMPF" || rm "$TMPF_pre"
test "$TMPF" = "$SRC" || echo "$TMPF" test "$TMPF" = "$SRC" || echo "$TMPF"