* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2019-02-16 19:11 Lars Wendler
0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2019-02-16 19:11 UTC (permalink / raw
To: gentoo-commits
commit: f78dc4749aa8c49ea035be184b705477939899c8
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 16 19:07:05 2019 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sat Feb 16 19:09:13 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f78dc474
sys-apps/less: Revbump to fix mouse issue.
Bug: https://bugs.gentoo.org/678102
Package-Manager: Portage-2.3.60, Repoman-2.3.12
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
sys-apps/less/files/less-549-mouse_fix.patch | 51 ++++++++++++++++++++++
.../less/{less-549.ebuild => less-549-r1.ebuild} | 4 ++
2 files changed, 55 insertions(+)
diff --git a/sys-apps/less/files/less-549-mouse_fix.patch b/sys-apps/less/files/less-549-mouse_fix.patch
new file mode 100644
index 00000000000..495073a32a4
--- /dev/null
+++ b/sys-apps/less/files/less-549-mouse_fix.patch
@@ -0,0 +1,51 @@
+From d5015d29f79e70fb70489616c0f2d0ff32e52898 Mon Sep 17 00:00:00 2001
+From: Mark Nudelman <markn@greenwoodsoftware.com>
+Date: Sat, 16 Feb 2019 07:20:42 -0800
+Subject: [PATCH] Don't emit mouse controls if --mouse is not set.
+
+---
+ screen.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/screen.c b/screen.c
+index 9a32685..b58fe26 100644
+--- a/screen.c
++++ b/screen.c
+@@ -1549,6 +1549,8 @@ win32_deinit_term(VOID_PARAM)
+ public void
+ init_mouse(VOID_PARAM)
+ {
++ if (!mousecap)
++ return;
+ #if !MSDOS_COMPILER
+ tputs(sc_s_mousecap, sc_height, putchr);
+ #else
+@@ -1565,6 +1567,8 @@ init_mouse(VOID_PARAM)
+ public void
+ deinit_mouse(VOID_PARAM)
+ {
++ if (!mousecap)
++ return;
+ #if !MSDOS_COMPILER
+ tputs(sc_e_mousecap, sc_height, putchr);
+ #else
+@@ -1587,8 +1591,7 @@ init(VOID_PARAM)
+ tputs(sc_init, sc_height, putchr);
+ if (!no_keypad)
+ tputs(sc_s_keypad, sc_height, putchr);
+- if (mousecap)
+- init_mouse();
++ init_mouse();
+ }
+ if (top_scroll)
+ {
+@@ -1626,8 +1629,7 @@ deinit(VOID_PARAM)
+ #if !MSDOS_COMPILER
+ if (!(quit_if_one_screen && one_screen))
+ {
+- if (mousecap)
+- deinit_mouse();
++ deinit_mouse();
+ if (!no_keypad)
+ tputs(sc_e_keypad, sc_height, putchr);
+ if (!no_init)
diff --git a/sys-apps/less/less-549.ebuild b/sys-apps/less/less-549-r1.ebuild
similarity index 96%
rename from sys-apps/less/less-549.ebuild
rename to sys-apps/less/less-549-r1.ebuild
index f04887b62ff..8eff7a5d6ea 100644
--- a/sys-apps/less/less-549.ebuild
+++ b/sys-apps/less/less-549-r1.ebuild
@@ -17,6 +17,10 @@ DEPEND=">=app-misc/editor-wrapper-3
pcre? ( dev-libs/libpcre2 )"
RDEPEND="${DEPEND}"
+PATCHES=(
+ "${FILESDIR}"/${P}-mouse_fix.patch #678102
+)
+
src_configure() {
export ac_cv_lib_ncursesw_initscr=$(usex unicode)
export ac_cv_lib_ncurses_initscr=$(usex !unicode)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2020-11-18 8:15 Lars Wendler
0 siblings, 0 replies; 8+ messages in thread
From: Lars Wendler @ 2020-11-18 8:15 UTC (permalink / raw
To: gentoo-commits
commit: 32f69258df5a9c85852af26eb06a295285c26ac0
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 18 08:15:10 2020 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Nov 18 08:15:10 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=32f69258
sys-apps/less: Removed old
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
sys-apps/less/Manifest | 2 -
sys-apps/less/files/lesspipe.sh | 284 ----------------------------------------
sys-apps/less/less-551.ebuild | 44 -------
sys-apps/less/less-562.ebuild | 44 -------
sys-apps/less/less-563.ebuild | 44 -------
5 files changed, 418 deletions(-)
diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest
index fc83249eab9..8d4ff9d762b 100644
--- a/sys-apps/less/Manifest
+++ b/sys-apps/less/Manifest
@@ -1,3 +1 @@
-DIST less-551.tar.gz 347007 BLAKE2B 033a043340f888616c8342703597b9232ae1c8e62775d3ee0187599c3d9d9824fdbc7543ca90cdc535b2077a8bcbefe322887ad29289620191d8cf6ff86ddd04 SHA512 ef5296b9ebd72f83c05cad8a0f7a5eec2290e9b358ee725e09e8541bd95f94c0e14ea22aa04b287a0654079338eaeae813f2235b8e9f819fbbc9040dd65a9585
-DIST less-562.tar.gz 335444 BLAKE2B 4830673d17594aea7424ee88b82bc2e073275a77ed39c067c032a0b79b0d15f8c0d97f98381a57192e985054cd04b3a824ef6c3e6ef796885a9677681a4cb109 SHA512 c9a0f43da0fcdb515e5d4f56a666fa7c8b12d52fd5a1cd4f6cc5f79133376400b0ef24a206c0cf5fd3558fba9a8055f219038bad8c3dadf0504ea96c419c4573
DIST less-563.tar.gz 335508 BLAKE2B 813e54b9a115600e4f20009ccad3708efc64ab4ee940aa3624e968045557bbfef6ace49b791f4b9efff86bf43df9fe2a04a160e76718396e0dae17f0bdaa62fb SHA512 79384ff3faa33aeb86da6027c8b264df78f9f8c799af43dc5340e2ca3d86053c9be168140bfa05734a4217e65ef9939652b004d6a536f64b2e0ef3b74b07f535
diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh
deleted file mode 100644
index a393de07ec7..00000000000
--- a/sys-apps/less/files/lesspipe.sh
+++ /dev/null
@@ -1,284 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Preprocessor for 'less'. Used when this environment variable is set:
-# LESSOPEN="|lesspipe %s"
-
-# TODO: handle compressed files better
-
-[[ -n ${LESSDEBUG+set} ]] && set -x
-
-trap 'exit 0' PIPE
-
-guesscompress() {
- case "$1" in
- *.gz|*.z) echo "gunzip -c" ;;
- *.bz2|*.bz) echo "bunzip2 -c" ;;
- *.lz) echo "lzip -dc" ;;
- *.lzma) echo "unlzma -c" ;;
- *.lzo) echo "lzop -dc" ;;
- *.xz) echo "xzdec" ;;
- *) echo "cat" ;;
- esac
-}
-
-lesspipe_file() {
- local out=$(file -L -- "$1")
- local suffix
- case ${out} in
- *" 7-zip archive"*) suffix="7z";;
- *" ar archive"*) suffix="a";;
- *" CAB-Installer"*) suffix="cab";;
- *" cpio archive"*) suffix="cpio";;
- *" ELF "*) suffix="elf";;
- *" LHa"*archive*) suffix="lha";;
- *" troff "*) suffix="man";;
- *" script text"*) suffix="sh";;
- *" shared object"*) suffix="so";;
- *" tar archive"*) suffix="tar";;
- *" Zip archive"*) suffix="zip";;
- *": data") hexdump -C -- "$1"; return 0;;
- *) return 1;;
- esac
- lesspipe "$1" ".${suffix}"
- return 0
-}
-
-lesspipe() {
- local match=$2
- [[ -z ${match} ]] && match=$1
-
- local DECOMPRESSOR=$(guesscompress "${match}")
-
- # User filters
- if [[ -x ~/.lessfilter ]] ; then
- ~/.lessfilter "$1" && exit 0
- fi
-
- local ignore
- for ignore in ${LESSIGNORE} ; do
- [[ ${match} == *.${ignore} ]] && exit 0
- done
-
- # Handle non-regular file types.
- if [[ -d $1 ]] ; then
- ls -alF -- "$1"
- return
- elif [[ ! -f $1 ]] ; then
- # Only return if the stat passes. This is needed to handle pseudo
- # arguments like URIs.
- stat -- "$1" && return
- fi
-
- case "${match}" in
-
- ### Doc files ###
- *.[0-9n]|*.man|\
- *.[0-9n].bz2|*.man.bz2|\
- *.[0-9n].gz|*.man.gz|\
- *.[0-9n].lzma|*.man.lzma|\
- *.[0-9n].xz|*.man.xz|\
- *.[0-9][a-z].gz|*.[0-9][a-z].gz)
- local out=$(${DECOMPRESSOR} -- "$1" | file -)
- case ${out} in
- *troff*)
- # Need to make sure we pass path to man or it will try
- # to locate "$1" in the man search paths
- if [[ $1 == /* ]] ; then
- man -- "$1"
- else
- man -- "./$1"
- fi
- ;;
- *text*)
- ${DECOMPRESSOR} -- "$1"
- ;;
- *)
- # We could have matched a library (libc.so.6), so let
- # `file` figure out what the hell this thing is
- lesspipe_file "$1"
- ;;
- esac
- ;;
- *.dvi) dvi2tty "$1" ;;
- *.ps) ps2ascii "$1" || pstotext "$1" ;;
- *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;;
- *.doc) antiword "$1" || catdoc "$1" ;;
- *.rtf) unrtf --nopict --text "$1" ;;
- *.conf|*.txt|*.log) ;; # force less to work on these directly #150256
- *.json) python -mjson.tool "$1" ;;
-
- ### URLs ###
- ftp://*|http://*|https://|*.htm|*.html)
- for b in elinks links2 links lynx ; do
- ${b} -dump "$1" && exit 0
- done
- html2text -style pretty "$1"
- ;;
-
- ### Tar files ###
- *.tar|\
- *.tar.bz2|*.tar.bz|*.tar.gz|*.tar.z|\
- *.tar.lz|*.tar.tlz|\
- *.tar.lzma|*.tar.xz)
- ${DECOMPRESSOR} -- "$1" | tar tvvf -;;
- *.tbz2|*.tbz|*.tgz|*.tlz|*.txz)
- lesspipe "$1" "$1.tar.${1##*.t}" ;;
-
- ### Misc archives ###
- *.bz2|\
- *.gz|*.z|\
- *.lz|\
- *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;;
- *.rpm) rpm -qpivl --changelog -- "$1" || rpm2tar -O "$1" | tar tvvf -;;
- *.cpi|*.cpio) cpio -itv < "$1" ;;
- *.ace) unace l "$1" ;;
- *.arc) arc v "$1" ;;
- *.arj) arj l -- "$1" || unarj l "$1" ;;
- *.cab) cabextract -l -- "$1" ;;
- *.lha|*.lzh) lha v "$1" ;;
- *.zoo) zoo -list "$1" || unzoo -l "$1" ;;
- *.7z|*.exe) 7z l -- "$1" || 7za l -- "$1" || 7zr l -- "$1" ;;
- *.a) ar tv "$1" ;;
- *.elf) readelf -a -W -- "$1" ;;
- *.so) readelf -h -d -s -W -- "$1" ;;
- *.mo|*.gmo) msgunfmt -- "$1" ;;
-
- *.rar|.r[0-9][0-9]) unrar l -- "$1" ;;
-
- *.jar|*.war|*.ear|*.xpi|*.zip)
- unzip -v "$1" || miniunzip -l "$1" || miniunz -l "$1" || zipinfo -v "$1"
- ;;
-
- *.deb|*.udeb)
- if type -P dpkg > /dev/null ; then
- dpkg --info "$1"
- dpkg --contents "$1"
- else
- ar tv "$1"
- ar p "$1" data.tar.gz | tar tzvvf -
- fi
- ;;
-
- ### Filesystems ###
- *.squashfs) unsquashfs -s "$1" && unsquashfs -ll "$1" ;;
-
- ### Media ###
- *.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp)
- identify -verbose -- "$1" || file -L -- "$1"
- ;;
- *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
- midentify "$1" || file -L -- "$1"
- ;;
- *.mp3) mp3info "$1" || id3info "$1" ;;
- *.ogg) ogginfo "$1" ;;
- *.flac) metaflac --list "$1" ;;
- *.torrent) torrentinfo "$1" || torrentinfo-console "$1" || ctorrent -x "$1" ;;
- *.bin|*.cue|*.raw)
- # not all .bin/.raw files are cd images #285507
- # fall back to lesspipe_file if .cue doesn't exist, or if
- # cd-info failed to parse things sanely
- [[ -e ${1%.*}.cue ]] \
- && cd-info --no-header --no-device-info "$1" \
- || lesspipe_file "$1"
- ;;
- *.iso)
- iso_info=$(isoinfo -d -i "$1")
- echo "${iso_info}"
- # Joliet output overrides Rock Ridge, so prefer the better Rock
- case ${iso_info} in
- *$'\n'"Rock Ridge"*) iso_opts="-R";;
- *$'\n'"Joliet"*) iso_opts="-J";;
- *) iso_opts="";;
- esac
- isoinfo -l ${iso_opts} -i "$1"
- ;;
-
- ### Encryption stuff ###
- *.crl) openssl crl -hash -text -noout -in "$1" ;;
- *.csr) openssl req -text -noout -in "$1" ;;
- *.crt|*.pem) openssl x509 -hash -text -noout -in "$1" ;;
-
-# May not be such a good idea :)
-# ### Device nodes ###
-# /dev/[hs]d[a-z]*)
-# fdisk -l "${1:0:8}"
-# [[ $1 == *hd* ]] && hdparm -I "${1:0:8}"
-# ;;
-
- ### Everything else ###
- *)
- case $(( recur++ )) in
- # Maybe we didn't match due to case issues ...
- 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;;
-
- # Maybe we didn't match because the file is named weird ...
- 1) lesspipe_file "$1" ;;
- esac
-
- # So no matches from above ... finally fall back to an external
- # coloring package. No matching here so we don't have to worry
- # about keeping in sync with random packages. Any coloring tool
- # you use should not output errors about unsupported files to
- # stdout. If it does, it's your problem.
-
- # Allow people to flip color off if they dont want it
- case ${LESSCOLOR} in
- always) LESSCOLOR=2;;
- [yY][eE][sS]|[yY]|1|true) LESSCOLOR=1;;
- [nN][oO]|[nN]|0|false) LESSCOLOR=0;;
- *) LESSCOLOR=0;; # default to no color #188835
- esac
- if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=code2color} ]] ; then
- # 2: Only colorize if user forces it ...
- # 1: ... or we know less will handle raw codes -- this will
- # not detect -seiRM, so set LESSCOLORIZER yourself
- if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then
- LESSQUIET=true ${LESSCOLORIZER} "$1"
- fi
- fi
-
- # Nothing left to do but let less deal
- exit 0
- ;;
- esac
-}
-
-if [[ $# -eq 0 ]] ; then
- echo "Usage: lesspipe <file>"
-elif [[ $1 == "-V" || $1 == "--version" ]] ; then
- cat <<-EOF
- lesspipe (git)
- Copyright 1999-2019 Gentoo Authors
- Mike Frysinger <vapier@gentoo.org>
- (with plenty of ideas stolen from other projects/distros)
-
- EOF
- less -V
-elif [[ $1 == "-h" || $1 == "--help" ]] ; then
- cat <<-EOF
- lesspipe: preprocess files before sending them to less
-
- Usage: lesspipe <file>
-
- lesspipe specific settings:
- LESSCOLOR env - toggle colorizing of output (no/yes/always; default: no)
- LESSCOLORIZER env - program used to colorize output (default: code2color)
- LESSIGNORE - list of extensions to ignore (don't do anything fancy)
-
- You can create per-user filters as well by creating the executable file:
- ~/.lessfilter
- One argument is passed to it: the file to display. The script should exit 0
- to indicate it handled the file, or non-zero to tell lesspipe to handle it.
-
- To use lesspipe, simply add to your environment:
- export LESSOPEN="|lesspipe %s"
-
- Run 'less --help' or 'man less' for more info.
- EOF
-else
- recur=0
- [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null
- lesspipe "$1"
-fi
diff --git a/sys-apps/less/less-551.ebuild b/sys-apps/less/less-551.ebuild
deleted file mode 100644
index cfc0e10bf5e..00000000000
--- a/sys-apps/less/less-551.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Excellent text file viewer"
-HOMEPAGE="http://www.greenwoodsoftware.com/less/"
-SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz"
-
-LICENSE="|| ( GPL-3 BSD-2 )"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="pcre unicode"
-
-DEPEND=">=app-misc/editor-wrapper-3
- >=sys-libs/ncurses-5.2:0=
- pcre? ( dev-libs/libpcre2 )"
-RDEPEND="${DEPEND}"
-
-src_configure() {
- export ac_cv_lib_ncursesw_initscr=$(usex unicode)
- export ac_cv_lib_ncurses_initscr=$(usex !unicode)
- local myeconfargs=(
- --with-regex=$(usex pcre pcre2 posix)
- --with-editor="${EPREFIX}"/usr/libexec/editor
- )
- econf "${myeconfargs[@]}"
-}
-
-src_install() {
- default
-
- newbin "${FILESDIR}"/lesspipe.sh lesspipe
- newenvd "${FILESDIR}"/less.envd 70less
-}
-
-pkg_preinst() {
- if has_version "<${CATEGORY}/${PN}-483-r1" ; then
- elog "The lesspipe.sh symlink has been dropped. If you are still setting"
- elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
- elog "Colorization support has been dropped. If you want that, check out"
- elog "the new app-text/lesspipe package."
- fi
-}
diff --git a/sys-apps/less/less-562.ebuild b/sys-apps/less/less-562.ebuild
deleted file mode 100644
index 375e2585ca5..00000000000
--- a/sys-apps/less/less-562.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Excellent text file viewer"
-HOMEPAGE="http://www.greenwoodsoftware.com/less/"
-SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz"
-
-LICENSE="|| ( GPL-3 BSD-2 )"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="pcre unicode"
-
-DEPEND=">=app-misc/editor-wrapper-3
- >=sys-libs/ncurses-5.2:0=
- pcre? ( dev-libs/libpcre2 )"
-RDEPEND="${DEPEND}"
-
-src_configure() {
- export ac_cv_lib_ncursesw_initscr=$(usex unicode)
- export ac_cv_lib_ncurses_initscr=$(usex !unicode)
- local myeconfargs=(
- --with-regex=$(usex pcre pcre2 posix)
- --with-editor="${EPREFIX}"/usr/libexec/editor
- )
- econf "${myeconfargs[@]}"
-}
-
-src_install() {
- default
-
- newbin "${FILESDIR}"/lesspipe.sh lesspipe
- newenvd "${FILESDIR}"/less.envd 70less
-}
-
-pkg_preinst() {
- if has_version "<${CATEGORY}/${PN}-483-r1" ; then
- elog "The lesspipe.sh symlink has been dropped. If you are still setting"
- elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
- elog "Colorization support has been dropped. If you want that, check out"
- elog "the new app-text/lesspipe package."
- fi
-}
diff --git a/sys-apps/less/less-563.ebuild b/sys-apps/less/less-563.ebuild
deleted file mode 100644
index 375e2585ca5..00000000000
--- a/sys-apps/less/less-563.ebuild
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Excellent text file viewer"
-HOMEPAGE="http://www.greenwoodsoftware.com/less/"
-SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz"
-
-LICENSE="|| ( GPL-3 BSD-2 )"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="pcre unicode"
-
-DEPEND=">=app-misc/editor-wrapper-3
- >=sys-libs/ncurses-5.2:0=
- pcre? ( dev-libs/libpcre2 )"
-RDEPEND="${DEPEND}"
-
-src_configure() {
- export ac_cv_lib_ncursesw_initscr=$(usex unicode)
- export ac_cv_lib_ncurses_initscr=$(usex !unicode)
- local myeconfargs=(
- --with-regex=$(usex pcre pcre2 posix)
- --with-editor="${EPREFIX}"/usr/libexec/editor
- )
- econf "${myeconfargs[@]}"
-}
-
-src_install() {
- default
-
- newbin "${FILESDIR}"/lesspipe.sh lesspipe
- newenvd "${FILESDIR}"/less.envd 70less
-}
-
-pkg_preinst() {
- if has_version "<${CATEGORY}/${PN}-483-r1" ; then
- elog "The lesspipe.sh symlink has been dropped. If you are still setting"
- elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
- elog "Colorization support has been dropped. If you want that, check out"
- elog "the new app-text/lesspipe package."
- fi
-}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2022-11-24 16:53 Mike Gilbert
0 siblings, 0 replies; 8+ messages in thread
From: Mike Gilbert @ 2022-11-24 16:53 UTC (permalink / raw
To: gentoo-commits
commit: 075e0f7ae4782eb7d25140455d30af48cc32c253
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 24 16:41:42 2022 +0000
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Nov 24 16:53:02 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=075e0f7a
sys-apps/less: backport procfs fix to 608
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
sys-apps/less/files/less-608-procfs.patch | 45 ++++++++++++++++++++++
.../less/{less-608.ebuild => less-608-r1.ebuild} | 12 ++++++
2 files changed, 57 insertions(+)
diff --git a/sys-apps/less/files/less-608-procfs.patch b/sys-apps/less/files/less-608-procfs.patch
new file mode 100644
index 000000000000..4f66322b8123
--- /dev/null
+++ b/sys-apps/less/files/less-608-procfs.patch
@@ -0,0 +1,45 @@
+From 03f011f219a6d6068c4ccd07dbd8dcd50641ff10 Mon Sep 17 00:00:00 2001
+From: Mark Nudelman <markn@greenwoodsoftware.com>
+Date: Tue, 20 Sep 2022 12:32:30 -0700
+Subject: [PATCH] Fix reading procfs files on Linux: bad detection of
+ HAVE_PROCFS.
+
+diff --git a/ch.c b/ch.c
+index bfad09c7..fcf136b9 100644
+--- a/ch.c
++++ b/ch.c
+@@ -28,6 +28,9 @@ extern ino_t curr_ino;
+
+ #if HAVE_PROCFS
+ #include <sys/statfs.h>
++#if HAVE_LINUX_MAGIC_H
++#include <linux/magic.h>
++#endif
+ #endif
+
+ typedef POSITION BLOCKNUM;
+diff --git a/configure.ac b/configure.ac
+index f7c64814..b10adce9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -37,7 +37,7 @@ AC_SEARCH_LIBS([regcmp], [gen intl PW])
+
+ # Checks for header files.
+ AC_HEADER_STDC
+-AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h wctype.h])
++AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h linux/magic.h sys/ioctl.h sys/stream.h wctype.h])
+
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_HEADER_STAT
+@@ -271,7 +271,10 @@ AC_TRY_COMPILE([#include <sys/types.h>
+ [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;],
+ [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)])
+ AC_MSG_CHECKING(for procfs)
+-AC_TRY_COMPILE([#include <sys/statfs.h>],
++AC_TRY_COMPILE([#include <sys/statfs.h>
++#if HAVE_LINUX_MAGIC_H
++#include <linux/magic.h>
++#endif],
+ [struct statfs s; s.f_type = PROC_SUPER_MAGIC; (void) fstatfs(0,&s); ],
+ [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PROCFS)], [AC_MSG_RESULT(no)])
+
diff --git a/sys-apps/less/less-608.ebuild b/sys-apps/less/less-608-r1.ebuild
similarity index 89%
rename from sys-apps/less/less-608.ebuild
rename to sys-apps/less/less-608-r1.ebuild
index a10cea4792b3..0c48837e70b3 100644
--- a/sys-apps/less/less-608.ebuild
+++ b/sys-apps/less/less-608-r1.ebuild
@@ -2,6 +2,10 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=7
+WANT_AUTOMAKE=none
+WANT_LIBTOOL=none
+
+inherit autotools
DESCRIPTION="Excellent text file viewer"
HOMEPAGE="http://www.greenwoodsoftware.com/less/"
@@ -17,6 +21,14 @@ DEPEND=">=app-misc/editor-wrapper-3
pcre? ( dev-libs/libpcre2 )"
RDEPEND="${DEPEND}"
+src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}/less-608-procfs.patch"
+ )
+ default
+ eautoreconf
+}
+
src_configure() {
export ac_cv_lib_ncursesw_initscr=$(usex unicode)
export ac_cv_lib_ncurses_initscr=$(usex !unicode)
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2023-02-09 3:54 Sam James
0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2023-02-09 3:54 UTC (permalink / raw
To: gentoo-commits
commit: 91641abac0747b8c2b701acb7acfc6d7e3f82c37
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 9 03:45:58 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb 9 03:54:09 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91641aba
sys-apps/less: patch CVE-2022-46663
Bug: https://bugs.gentoo.org/893530
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/less/files/less-608-CVE-2022-46663.patch | 22 +++++++++
sys-apps/less/less-608-r2.ebuild | 60 +++++++++++++++++++++++
2 files changed, 82 insertions(+)
diff --git a/sys-apps/less/files/less-608-CVE-2022-46663.patch b/sys-apps/less/files/less-608-CVE-2022-46663.patch
new file mode 100644
index 000000000000..a358dd6f1a77
--- /dev/null
+++ b/sys-apps/less/files/less-608-CVE-2022-46663.patch
@@ -0,0 +1,22 @@
+https://bugs.gentoo.org/893530
+https://github.com/gwsw/less/commit/a78e1351113cef564d790a730d657a321624d79c
+
+From a78e1351113cef564d790a730d657a321624d79c Mon Sep 17 00:00:00 2001
+From: Mark Nudelman <markn@greenwoodsoftware.com>
+Date: Fri, 7 Oct 2022 19:25:46 -0700
+Subject: [PATCH] End OSC8 hyperlink on invalid embedded escape sequence.
+
+--- a/line.c
++++ b/line.c
+@@ -633,8 +633,8 @@ ansi_step(pansi, ch)
+ /* Hyperlink ends with \7 or ESC-backslash. */
+ if (ch == '\7')
+ return ANSI_END;
+- if (pansi->prev_esc && ch == '\\')
+- return ANSI_END;
++ if (pansi->prev_esc)
++ return (ch == '\\') ? ANSI_END : ANSI_ERR;
+ pansi->prev_esc = (ch == ESC);
+ return ANSI_MID;
+ }
+
diff --git a/sys-apps/less/less-608-r2.ebuild b/sys-apps/less/less-608-r2.ebuild
new file mode 100644
index 000000000000..29f94fcfdae4
--- /dev/null
+++ b/sys-apps/less/less-608-r2.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+WANT_AUTOMAKE=none
+WANT_LIBTOOL=none
+inherit autotools
+
+DESCRIPTION="Excellent text file viewer"
+HOMEPAGE="http://www.greenwoodsoftware.com/less/"
+SRC_URI="http://www.greenwoodsoftware.com/less/${P}.tar.gz"
+
+LICENSE="|| ( GPL-3 BSD-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="pcre unicode"
+
+DEPEND=">=app-misc/editor-wrapper-3
+ >=sys-libs/ncurses-5.2:0=
+ pcre? ( dev-libs/libpcre2 )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}/less-608-procfs.patch"
+ "${FILESDIR}/less-608-CVE-2022-46663.patch"
+ )
+
+ default
+ # Upstream uses unpatched autoconf-2.69, which breaks with clang-16.
+ # https://bugs.gentoo.org/870412
+ eautoreconf
+}
+
+src_configure() {
+ export ac_cv_lib_ncursesw_initscr=$(usex unicode)
+ export ac_cv_lib_ncurses_initscr=$(usex !unicode)
+ local myeconfargs=(
+ --with-regex=$(usex pcre pcre2 posix)
+ --with-editor="${EPREFIX}"/usr/libexec/editor
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_install() {
+ default
+
+ newbin "${FILESDIR}"/lesspipe-r1.sh lesspipe
+ newenvd "${FILESDIR}"/less.envd 70less
+}
+
+pkg_preinst() {
+ if has_version "<${CATEGORY}/${PN}-483-r1" ; then
+ elog "The lesspipe.sh symlink has been dropped. If you are still setting"
+ elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
+ elog "Colorization support has been dropped. If you want that, check out"
+ elog "the new app-text/lesspipe package."
+ fi
+}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2023-06-23 21:59 Sam James
0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2023-06-23 21:59 UTC (permalink / raw
To: gentoo-commits
commit: 023b7de83186fbb6e97ea09ded7c6bfdadd4f1da
Author: Alan Swanson <reiver <AT> improbability <DOT> net>
AuthorDate: Fri Jun 23 13:26:06 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 23 21:57:31 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=023b7de8
sys-apps/less: reenable colourisation by default using pygmentize
Previously disabled due to old bug #188835 where code2color consumed
excess memory compared to source file being colourised.
Update LESSCOLORIZER to use pygmentize instead if available. This is
installed with dev-python/pygments which is a common dependency.
Program code2color can still be installed with app-text/lesspipe.
Bug: https://bugs.gentoo.org/188835
Signed-off-by: Alan Swanson <reiver <AT> improbability.net>
Closes: https://github.com/gentoo/gentoo/pull/31584
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/less/files/lesspipe-r2.sh | 291 +++++++++++++++++++++
.../less/{less-9999.ebuild => less-633-r1.ebuild} | 8 +-
sys-apps/less/less-9999.ebuild | 8 +-
3 files changed, 299 insertions(+), 8 deletions(-)
diff --git a/sys-apps/less/files/lesspipe-r2.sh b/sys-apps/less/files/lesspipe-r2.sh
new file mode 100644
index 000000000000..fc54d5b21306
--- /dev/null
+++ b/sys-apps/less/files/lesspipe-r2.sh
@@ -0,0 +1,291 @@
+#!/bin/bash
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Preprocessor for 'less'. Used when this environment variable is set:
+# LESSOPEN="|lesspipe %s"
+
+# TODO: handle compressed files better
+
+[[ -n ${LESSDEBUG+set} ]] && set -x
+
+trap 'exit 0' PIPE
+
+guesscompress() {
+ case "$1" in
+ *.gz|*.z) echo "gunzip -c" ;;
+ *.bz2|*.bz) echo "bunzip2 -c" ;;
+ *.lz) echo "lzip -dc" ;;
+ *.lzma) echo "unlzma -c" ;;
+ *.lzo) echo "lzop -dc" ;;
+ *.xz) echo "xzdec" ;;
+ *.zst) echo "zstdcat" ;;
+ *) echo "cat" ;;
+ esac
+}
+
+lesspipe_file() {
+ local out=$(file -L -- "$1")
+ local suffix
+ case ${out} in
+ *" 7-zip archive"*) suffix="7z";;
+ *" ar archive"*) suffix="a";;
+ *" CAB-Installer"*) suffix="cab";;
+ *" cpio archive"*) suffix="cpio";;
+ *" ELF "*) suffix="elf";;
+ *" LHa"*archive*) suffix="lha";;
+ *" troff "*) suffix="man";;
+ *" script text"*) suffix="sh";;
+ *" shared object"*) suffix="so";;
+ *" tar archive"*) suffix="tar";;
+ *" Zip archive"*) suffix="zip";;
+ *": data") hexdump -C -- "$1"; return 0;;
+ *) return 1;;
+ esac
+ lesspipe "$1" ".${suffix}"
+ return 0
+}
+
+lesspipe() {
+ local match=$2
+ [[ -z ${match} ]] && match=$1
+
+ local DECOMPRESSOR=$(guesscompress "${match}")
+
+ # User filters
+ if [[ -x ~/.lessfilter ]] ; then
+ ~/.lessfilter "$1" && exit 0
+ fi
+
+ local ignore
+ for ignore in ${LESSIGNORE} ; do
+ [[ ${match} == *.${ignore} ]] && exit 0
+ done
+
+ # Handle non-regular file types.
+ if [[ -d $1 ]] ; then
+ ls -alF -- "$1"
+ return
+ elif [[ ! -f $1 ]] ; then
+ # Only return if the stat passes. This is needed to handle pseudo
+ # arguments like URIs.
+ stat -- "$1" && return
+ fi
+
+ case "${match}" in
+
+ ### Doc files ###
+ *.[0-9n]|*.man|\
+ *.[0-9n].bz2|*.man.bz2|\
+ *.[0-9n].gz|*.man.gz|\
+ *.[0-9n].lzma|*.man.lzma|\
+ *.[0-9n].xz|*.man.xz|\
+ *.[0-9n].zst|*.man.zst|\
+ *.[0-9][a-z].gz|*.[0-9][a-z].gz)
+ local out=$(${DECOMPRESSOR} -- "$1" | file -)
+ case ${out} in
+ *troff*)
+ # Need to make sure we pass path to man or it will try
+ # to locate "$1" in the man search paths
+ if [[ $1 == /* ]] ; then
+ man -- "$1"
+ else
+ man -- "./$1"
+ fi
+ ;;
+ *text*)
+ ${DECOMPRESSOR} -- "$1"
+ ;;
+ *)
+ # We could have matched a library (libc.so.6), so let
+ # `file` figure out what the hell this thing is
+ lesspipe_file "$1"
+ ;;
+ esac
+ ;;
+ *.dvi) dvi2tty "$1" ;;
+ *.ps) ps2ascii "$1" || pstotext "$1" ;;
+ *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;;
+ *.doc) antiword "$1" || catdoc "$1" ;;
+ *.rtf) unrtf --nopict --text "$1" ;;
+ *.conf|*.txt|*.log) ;; # force less to work on these directly #150256
+ *.json) python -mjson.tool "$1" ;;
+
+ ### URLs ###
+ ftp://*|http://*|https://|*.htm|*.html)
+ for b in elinks links2 links lynx ; do
+ ${b} -dump "$1" && exit 0
+ done
+ html2text -style pretty "$1"
+ ;;
+
+ ### Tar files ###
+ *.tar|\
+ *.tar.bz2|*.tar.bz|*.tar.gz|*.tar.z|*.tar.zst|\
+ *.tar.lz|*.tar.tlz|\
+ *.tar.lzma|*.tar.xz)
+ ${DECOMPRESSOR} -- "$1" | tar tvvf -;;
+ *.tbz2|*.tbz|*.tgz|*.tlz|*.txz)
+ lesspipe "$1" "$1.tar.${1##*.t}" ;;
+
+ ### Misc archives ###
+ *.bz2|\
+ *.gz|*.z|\
+ *.zst|\
+ *.lz|\
+ *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;;
+ *.rpm) rpm -qpivl --changelog -- "$1" || rpm2tar -O "$1" | tar tvvf -;;
+ *.cpi|*.cpio) cpio -itv < "$1" ;;
+ *.ace) unace l "$1" ;;
+ *.arc) arc v "$1" ;;
+ *.arj) arj l -- "$1" || unarj l "$1" ;;
+ *.cab) cabextract -l -- "$1" ;;
+ *.lha|*.lzh) lha v "$1" ;;
+ *.zoo) zoo -list "$1" || unzoo -l "$1" ;;
+ *.7z|*.exe) 7z l -- "$1" || 7za l -- "$1" || 7zr l -- "$1" ;;
+ *.a) ar tv "$1" ;;
+ *.elf) readelf -a -W -- "$1" ;;
+ *.so) readelf -h -d -s -W -- "$1" ;;
+ *.mo|*.gmo) msgunfmt -- "$1" ;;
+
+ *.rar|.r[0-9][0-9]) unrar l -- "$1" ;;
+
+ *.jar|*.war|*.ear|*.xpi|*.zip)
+ unzip -v "$1" || miniunzip -l "$1" || miniunz -l "$1" || zipinfo -v "$1"
+ ;;
+
+ *.deb|*.udeb)
+ if type -P dpkg > /dev/null ; then
+ dpkg --info "$1"
+ dpkg --contents "$1"
+ else
+ ar tv "$1"
+ ar p "$1" data.tar.gz | tar tzvvf -
+ fi
+ ;;
+
+ ### Filesystems ###
+ *.squashfs) unsquashfs -s "$1" && unsquashfs -ll "$1" ;;
+
+ ### Media ###
+ *.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp)
+ identify -verbose -- "$1" || file -L -- "$1"
+ ;;
+ *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
+ midentify "$1" || file -L -- "$1"
+ ;;
+ *.mp3) mp3info "$1" || id3info "$1" ;;
+ *.ogg) ogginfo "$1" ;;
+ *.flac) metaflac --list "$1" ;;
+ *.torrent) torrentinfo "$1" || torrentinfo-console "$1" || ctorrent -x "$1" ;;
+ *.bin|*.cue|*.raw)
+ # not all .bin/.raw files are cd images #285507
+ # fall back to lesspipe_file if .cue doesn't exist, or if
+ # cd-info failed to parse things sanely
+ [[ -e ${1%.*}.cue ]] \
+ && cd-info --no-header --no-device-info "$1" \
+ || lesspipe_file "$1"
+ ;;
+ *.iso)
+ iso_info=$(isoinfo -d -i "$1")
+ echo "${iso_info}"
+ # Joliet output overrides Rock Ridge, so prefer the better Rock
+ case ${iso_info} in
+ *$'\n'"Rock Ridge"*) iso_opts="-R";;
+ *$'\n'"Joliet"*) iso_opts="-J";;
+ *) iso_opts="";;
+ esac
+ isoinfo -l ${iso_opts} -i "$1"
+ ;;
+
+ ### Encryption stuff ###
+ *.crl) openssl crl -hash -text -noout -in "$1" ;;
+ *.csr) openssl req -text -noout -in "$1" ;;
+ *.crt|*.pem) openssl x509 -hash -text -noout -in "$1" ;;
+
+# May not be such a good idea :)
+# ### Device nodes ###
+# /dev/[hs]d[a-z]*)
+# fdisk -l "${1:0:8}"
+# [[ $1 == *hd* ]] && hdparm -I "${1:0:8}"
+# ;;
+
+ ### Everything else ###
+ *)
+ case $(( recur++ )) in
+ # Maybe we didn't match due to case issues ...
+ 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;;
+
+ # Maybe we didn't match because the file is named weird ...
+ 1) lesspipe_file "$1" ;;
+ esac
+
+ # So no matches from above ... finally fall back to an external
+ # coloring package. No matching here so we don't have to worry
+ # about keeping in sync with random packages. Any coloring tool
+ # you use should not output errors about unsupported files to
+ # stdout. If it does, it's your problem.
+
+ # Allow people to flip color off if they dont want it
+ case ${LESSCOLOR} in
+ always) LESSCOLOR=2;;
+ [yY][eE][sS]|[yY]|1|true) LESSCOLOR=1;;
+ [nN][oO]|[nN]|0|false) LESSCOLOR=0;;
+ *) LESSCOLOR=1;;
+ esac
+ if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=pygmentize} ]] ; then
+ # 2: Only colorize if user forces it ...
+ # 1: ... or we know less will handle raw codes -- this will
+ # not detect -seiRM, so set LESSCOLORIZER yourself
+ if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then
+ LESSQUIET=true ${LESSCOLORIZER} "$1"
+ fi
+ fi
+
+ # Nothing left to do but let less deal
+ exit 0
+ ;;
+ esac
+}
+
+if [[ $# -eq 0 ]] ; then
+ echo "Usage: lesspipe <file>"
+elif [[ $1 == "-V" || $1 == "--version" ]] ; then
+ cat <<-EOF
+ lesspipe (git)
+ Copyright 1999-2019 Gentoo Authors
+ Mike Frysinger <vapier@gentoo.org>
+ (with plenty of ideas stolen from other projects/distros)
+
+ EOF
+ less -V
+elif [[ $1 == "-h" || $1 == "--help" ]] ; then
+ cat <<-EOF
+ lesspipe: preprocess files before sending them to less
+
+ Usage: lesspipe <file>
+
+ lesspipe specific settings:
+ LESSCOLOR env - toggle colorizing of output (no/yes/always; default: no)
+ LESSCOLORIZER env - program used to colorize output (default: pygmentize)
+ LESSIGNORE - list of extensions to ignore (don't do anything fancy)
+
+ You can create per-user filters as well by creating the executable file:
+ ~/.lessfilter
+ One argument is passed to it: the file to display. The script should exit 0
+ to indicate it handled the file, or non-zero to tell lesspipe to handle it.
+
+ To use lesspipe, simply add to your environment:
+ export LESSOPEN="|lesspipe %s"
+
+ For colorization, install dev-python/pygments for the pygmentize program. Note,
+ if using alternative code2color from sys app-text/lesspipe you may run out of
+ memory due to #188835.
+
+ Run 'less --help' or 'man less' for more info.
+ EOF
+else
+ recur=0
+ [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null
+ lesspipe "$1"
+fi
diff --git a/sys-apps/less/less-9999.ebuild b/sys-apps/less/less-633-r1.ebuild
similarity index 91%
copy from sys-apps/less/less-9999.ebuild
copy to sys-apps/less/less-633-r1.ebuild
index 40f831510273..c6edffba45d8 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-633-r1.ebuild
@@ -11,7 +11,7 @@ if [[ ${PV} == 9999 ]]; then
inherit git-r3
fi
-inherit autotools
+inherit autotools optfeature
# Releases are usually first a beta then promoted to stable if no
# issues were found. Upstream explicitly ask "to not generally distribute"
@@ -66,15 +66,15 @@ src_test() {
src_install() {
default
- newbin "${FILESDIR}"/lesspipe-r1.sh lesspipe
+ newbin "${FILESDIR}"/lesspipe-r2.sh lesspipe
newenvd "${FILESDIR}"/less.envd 70less
}
pkg_preinst() {
+ optfeature "Colorized output supprt" dev-python/pygments
+
if has_version "<${CATEGORY}/${PN}-483-r1" ; then
elog "The lesspipe.sh symlink has been dropped. If you are still setting"
elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
- elog "Colorization support has been dropped. If you want that, check out"
- elog "the new app-text/lesspipe package."
fi
}
diff --git a/sys-apps/less/less-9999.ebuild b/sys-apps/less/less-9999.ebuild
index 40f831510273..c6edffba45d8 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-9999.ebuild
@@ -11,7 +11,7 @@ if [[ ${PV} == 9999 ]]; then
inherit git-r3
fi
-inherit autotools
+inherit autotools optfeature
# Releases are usually first a beta then promoted to stable if no
# issues were found. Upstream explicitly ask "to not generally distribute"
@@ -66,15 +66,15 @@ src_test() {
src_install() {
default
- newbin "${FILESDIR}"/lesspipe-r1.sh lesspipe
+ newbin "${FILESDIR}"/lesspipe-r2.sh lesspipe
newenvd "${FILESDIR}"/less.envd 70less
}
pkg_preinst() {
+ optfeature "Colorized output supprt" dev-python/pygments
+
if has_version "<${CATEGORY}/${PN}-483-r1" ; then
elog "The lesspipe.sh symlink has been dropped. If you are still setting"
elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
- elog "Colorization support has been dropped. If you want that, check out"
- elog "the new app-text/lesspipe package."
fi
}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2023-07-17 22:04 Sam James
0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2023-07-17 22:04 UTC (permalink / raw
To: gentoo-commits
commit: 4835fedb1257d15d871c885e19b8fecfff78abfd
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 17 22:02:52 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 17 22:03:32 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4835fedb
sys-apps/less: fix tinfo linkage, add LFS
Thanks to ionen and kerframil for doing the hard work here wrt tinfo, just
doing the then-obvious patch as a result.
Also, while at it, enable large file support.
Closes: https://bugs.gentoo.org/896316
Closes: https://bugs.gentoo.org/910430
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/less/files/less-633-tinfow.patch | 52 ++++++++++++++++++++++
.../less/{less-9999.ebuild => less-633-r2.ebuild} | 8 +++-
sys-apps/less/less-9999.ebuild | 8 +++-
3 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/sys-apps/less/files/less-633-tinfow.patch b/sys-apps/less/files/less-633-tinfow.patch
new file mode 100644
index 000000000000..82ea458cd008
--- /dev/null
+++ b/sys-apps/less/files/less-633-tinfow.patch
@@ -0,0 +1,52 @@
+https://github.com/gwsw/less/pull/403
+
+From 23000c286773af153a5743bc923465707b87613b Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Mon, 17 Jul 2023 22:58:27 +0100
+Subject: [PATCH] configure.ac: Check for tinfow before tinfo
+
+We currently check for ncursesw > ncurses and then tinfo > tinfow. This means
+we can get a mismatch of ncursesw + tinfo, instead of the correct ncursesw + tinfow.
+
+Swap the order so we check for ncursesw first (before other ncurses variants)
+and then tinfow first (before other tinfo variants).
+
+This is needed anyway for correctness, but also needed for certain terminfos
+to work correctly with recent ncurses.
+
+A better fix would be to use pkg-config first which handles this correctly
+and would include the appropriate -ltinfo* in the libraries list for -lncurses*,
+but not doing that for now.
+
+Bug: https://bugs.gentoo.org/910430
+--- a/configure.ac
++++ b/configure.ac
+@@ -63,10 +63,10 @@ fi
+
+ if test $curses_broken = 0; then
+
+-# -- Try tinfo.
++# -- Try tinfow.
+ if test "x$TERMLIBS" = x; then
+- if test $have_tinfo = yes; then
+- TERMLIBS="-ltinfo"
++ if test $have_tinfow = yes; then
++ TERMLIBS="-ltinfow"
+ SAVE_LIBS=$LIBS
+ LIBS="$LIBS $TERMLIBS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
+@@ -75,10 +75,10 @@ if test "x$TERMLIBS" = x; then
+ fi
+ fi
+
+-# -- Try tinfow.
++# -- Try tinfo.
+ if test "x$TERMLIBS" = x; then
+- if test $have_tinfow = yes; then
+- TERMLIBS="-ltinfow"
++ if test $have_tinfo = yes; then
++ TERMLIBS="-ltinfo"
+ SAVE_LIBS=$LIBS
+ LIBS="$LIBS $TERMLIBS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$include_termcap_h]], [[tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);]])],[termok=yes],[termok=no])
+
diff --git a/sys-apps/less/less-9999.ebuild b/sys-apps/less/less-633-r2.ebuild
similarity index 94%
copy from sys-apps/less/less-9999.ebuild
copy to sys-apps/less/less-633-r2.ebuild
index c6edffba45d8..5d22949f4f80 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-633-r2.ebuild
@@ -11,7 +11,7 @@ if [[ ${PV} == 9999 ]]; then
inherit git-r3
fi
-inherit autotools optfeature
+inherit autotools flag-o-matic optfeature
# Releases are usually first a beta then promoted to stable if no
# issues were found. Upstream explicitly ask "to not generally distribute"
@@ -42,6 +42,10 @@ DEPEND="
"
RDEPEND="${DEPEND}"
+PATCHES=(
+ "${FILESDIR}"/${PN}-633-tinfow.patch
+)
+
src_prepare() {
default
# Per upstream README to prepare live build
@@ -52,6 +56,8 @@ src_prepare() {
}
src_configure() {
+ append-lfs-flags # bug #896316
+
local myeconfargs=(
--with-regex=$(usex pcre pcre2 posix)
--with-editor="${EPREFIX}"/usr/libexec/editor
diff --git a/sys-apps/less/less-9999.ebuild b/sys-apps/less/less-9999.ebuild
index c6edffba45d8..5d22949f4f80 100644
--- a/sys-apps/less/less-9999.ebuild
+++ b/sys-apps/less/less-9999.ebuild
@@ -11,7 +11,7 @@ if [[ ${PV} == 9999 ]]; then
inherit git-r3
fi
-inherit autotools optfeature
+inherit autotools flag-o-matic optfeature
# Releases are usually first a beta then promoted to stable if no
# issues were found. Upstream explicitly ask "to not generally distribute"
@@ -42,6 +42,10 @@ DEPEND="
"
RDEPEND="${DEPEND}"
+PATCHES=(
+ "${FILESDIR}"/${PN}-633-tinfow.patch
+)
+
src_prepare() {
default
# Per upstream README to prepare live build
@@ -52,6 +56,8 @@ src_prepare() {
}
src_configure() {
+ append-lfs-flags # bug #896316
+
local myeconfargs=(
--with-regex=$(usex pcre pcre2 posix)
--with-editor="${EPREFIX}"/usr/libexec/editor
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2023-12-04 8:37 Sam James
0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2023-12-04 8:37 UTC (permalink / raw
To: gentoo-commits
commit: 656bf3658b141aac1895255e11725737ac8c9ca5
Author: Victor Payno <vpayno+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Nov 29 04:08:38 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 4 08:34:22 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=656bf365
sys-apps/less: add 643-r1 (add certtool filters and system filter support)
1. Use certtool instead of openssl when appropriate
- openssl only shows you the first certificate/entry it encounters
and ignores the rest. Using certtool will correctly display all
the entries in a single file. The view is also more readable with
certtool.
- Since openssl is still used as a fallback, not forcing a runtime
dependency on `net-libs/gnutls[tools]`.
- Java keystore filters were missing, so add them (jks/legacy and
pfx/p12).
- Also added a p12 file filter.
2. Add support for system filters
- Looking for a way to add custom, system wide, filters to an image
from other ebuilds (so the lessfilter is installed only when that
package is installed).
Signed-off-by: Victor Payno <vpayno+gentoo <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/34053
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/less/files/lesspipe-r3.sh | 339 +++++++++++++++++++++++++++++++++++++
sys-apps/less/less-643-r1.ebuild | 96 +++++++++++
2 files changed, 435 insertions(+)
diff --git a/sys-apps/less/files/lesspipe-r3.sh b/sys-apps/less/files/lesspipe-r3.sh
new file mode 100644
index 000000000000..baec90dc0e75
--- /dev/null
+++ b/sys-apps/less/files/lesspipe-r3.sh
@@ -0,0 +1,339 @@
+#!/bin/bash
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Preprocessor for 'less'. Used when this environment variable is set:
+# LESSOPEN="|lesspipe %s"
+
+# TODO: handle compressed files better
+
+[[ -n ${LESSDEBUG+set} ]] && set -x
+
+trap 'exit 0' PIPE
+
+guesscompress() {
+ case "$1" in
+ *.gz|*.z) echo "gunzip -c" ;;
+ *.bz2|*.bz) echo "bunzip2 -c" ;;
+ *.lz) echo "lzip -dc" ;;
+ *.lzma) echo "unlzma -c" ;;
+ *.lzo) echo "lzop -dc" ;;
+ *.xz) echo "xzdec" ;;
+ *.zst) echo "zstdcat" ;;
+ *) echo "cat" ;;
+ esac
+}
+
+crl_filter() {
+ if command -v certtool &>/dev/null; then
+ certtool --crl-info --text --infile "$1"
+ else
+ openssl crl -hash -text -noout -in "$1"
+ fi
+}
+
+csr_filter() {
+ if command -v certtool &>/dev/null; then
+ certtool --crq-info --text --infile "$1"
+ else
+ openssl req -text -noout -in "$1"
+ fi
+}
+
+crt_filter() {
+ if command -v certtool &>/dev/null; then
+ certtool --certificate-info --text --infile "$1"
+ else
+ openssl x509 -hash -text -noout -in "$1"
+ fi
+}
+
+jks_filter() {
+ if command -v keytool &>/dev/null; then
+ keytool -list -keystore "$1"
+ else
+ cat "$1"
+ fi
+}
+
+p12_filter() {
+ openssl pkcs12 -nokeys -info -in "$1"
+}
+
+lesspipe_file() {
+ local out=$(file -L -- "$1")
+ local suffix
+ case ${out} in
+ *" 7-zip archive"*) suffix="7z";;
+ *" ar archive"*) suffix="a";;
+ *" CAB-Installer"*) suffix="cab";;
+ *" cpio archive"*) suffix="cpio";;
+ *" ELF "*) suffix="elf";;
+ *" LHa"*archive*) suffix="lha";;
+ *" troff "*) suffix="man";;
+ *" script text"*) suffix="sh";;
+ *" shared object"*) suffix="so";;
+ *" tar archive"*) suffix="tar";;
+ *" Zip archive"*) suffix="zip";;
+ *": data") hexdump -C -- "$1"; return 0;;
+ *) return 1;;
+ esac
+ lesspipe "$1" ".${suffix}"
+ return 0
+}
+
+lesspipe() {
+ local match=$2
+ [[ -z ${match} ]] && match=$1
+
+ local DECOMPRESSOR=$(guesscompress "${match}")
+
+ # User filters
+ if [[ -x ~/.lessfilter ]] ; then
+ ~/.lessfilter "$1" && exit 0
+ fi
+
+ # System filters
+ shopt -s nullglob
+ local f
+ for f in "${XDG_CONFIG_HOME:-~/.config}"/lessfilter.d/* /etc/lessfilter.d/* /usr/lib/lessfilter.d/*; do
+ if [[ -x ${f} ]]; then
+ "${f}" "$1" && exit 0
+ fi
+ done
+ shopt -u nullglob
+
+ local ignore
+ for ignore in ${LESSIGNORE} ; do
+ [[ ${match} == *.${ignore} ]] && exit 0
+ done
+
+ # Handle non-regular file types.
+ if [[ -d $1 ]] ; then
+ ls -alF -- "$1"
+ return
+ elif [[ ! -f $1 ]] ; then
+ # Only return if the stat passes. This is needed to handle pseudo
+ # arguments like URIs.
+ stat -- "$1" && return
+ fi
+
+ case "${match}" in
+
+ ### Doc files ###
+ *.[0-9n]|*.man|\
+ *.[0-9n].bz2|*.man.bz2|\
+ *.[0-9n].gz|*.man.gz|\
+ *.[0-9n].lzma|*.man.lzma|\
+ *.[0-9n].xz|*.man.xz|\
+ *.[0-9n].zst|*.man.zst|\
+ *.[0-9][a-z].gz|*.[0-9][a-z].gz)
+ local out=$(${DECOMPRESSOR} -- "$1" | file -)
+ case ${out} in
+ *troff*)
+ # Need to make sure we pass path to man or it will try
+ # to locate "$1" in the man search paths
+ if [[ $1 == /* ]] ; then
+ man -- "$1"
+ else
+ man -- "./$1"
+ fi
+ ;;
+ *text*)
+ ${DECOMPRESSOR} -- "$1"
+ ;;
+ *)
+ # We could have matched a library (libc.so.6), so let
+ # `file` figure out what the hell this thing is
+ lesspipe_file "$1"
+ ;;
+ esac
+ ;;
+ *.dvi) dvi2tty "$1" ;;
+ *.ps) ps2ascii "$1" || pstotext "$1" ;;
+ *.pdf) pdftotext "$1" - || ps2ascii "$1" || pstotext "$1" ;;
+ *.doc) antiword "$1" || catdoc "$1" ;;
+ *.rtf) unrtf --nopict --text "$1" ;;
+ *.conf|*.txt|*.log) ;; # force less to work on these directly #150256
+ *.json) python -mjson.tool "$1" ;;
+
+ ### URLs ###
+ ftp://*|http://*|https://|*.htm|*.html)
+ for b in elinks links2 links lynx ; do
+ ${b} -dump "$1" && exit 0
+ done
+ html2text -style pretty "$1"
+ ;;
+
+ ### Tar files ###
+ *.tar|\
+ *.tar.bz2|*.tar.bz|*.tar.gz|*.tar.z|*.tar.zst|\
+ *.tar.lz|*.tar.tlz|\
+ *.tar.lzma|*.tar.xz)
+ ${DECOMPRESSOR} -- "$1" | tar tvvf -;;
+ *.tbz2|*.tbz|*.tgz|*.tlz|*.txz)
+ lesspipe "$1" "$1.tar.${1##*.t}" ;;
+
+ ### Misc archives ###
+ *.bz2|\
+ *.gz|*.z|\
+ *.zst|\
+ *.lz|\
+ *.lzma|*.xz) ${DECOMPRESSOR} -- "$1" ;;
+ *.rpm) rpm -qpivl --changelog -- "$1" || rpm2tar -O "$1" | tar tvvf -;;
+ *.cpi|*.cpio) cpio -itv < "$1" ;;
+ *.ace) unace l "$1" ;;
+ *.arc) arc v "$1" ;;
+ *.arj) arj l -- "$1" || unarj l "$1" ;;
+ *.cab) cabextract -l -- "$1" ;;
+ *.lha|*.lzh) lha v "$1" ;;
+ *.zoo) zoo -list "$1" || unzoo -l "$1" ;;
+ *.7z|*.exe) 7z l -- "$1" || 7za l -- "$1" || 7zr l -- "$1" ;;
+ *.a) ar tv "$1" ;;
+ *.elf) readelf -a -W -- "$1" ;;
+ *.so) readelf -h -d -s -W -- "$1" ;;
+ *.mo|*.gmo) msgunfmt -- "$1" ;;
+
+ *.rar|.r[0-9][0-9]) unrar l -- "$1" ;;
+
+ *.jar|*.war|*.ear|*.xpi|*.zip)
+ unzip -v "$1" || miniunzip -l "$1" || miniunz -l "$1" || zipinfo -v "$1"
+ ;;
+
+ *.deb|*.udeb)
+ if type -P dpkg > /dev/null ; then
+ dpkg --info "$1"
+ dpkg --contents "$1"
+ else
+ ar tv "$1"
+ ar p "$1" data.tar.gz | tar tzvvf -
+ fi
+ ;;
+
+ ### Filesystems ###
+ *.squashfs) unsquashfs -s "$1" && unsquashfs -ll "$1" ;;
+
+ ### Media ###
+ *.bmp|*.gif|*.jpeg|*.jpg|*.ico|*.pcd|*.pcx|*.png|*.ppm|*.tga|*.tiff|*.tif|*.webp)
+ identify -verbose -- "$1" || file -L -- "$1"
+ ;;
+ *.asf|*.avi|*.flv|*.mkv|*.mov|*.mp4|*.mpeg|*.mpg|*.qt|*.ram|*.rm|*.webm|*.wmv)
+ midentify "$1" || file -L -- "$1"
+ ;;
+ *.mp3) mp3info "$1" || id3info "$1" ;;
+ *.ogg) ogginfo "$1" ;;
+ *.flac) metaflac --list "$1" ;;
+ *.torrent) torrentinfo "$1" || torrentinfo-console "$1" || ctorrent -x "$1" ;;
+ *.bin|*.cue|*.raw)
+ # not all .bin/.raw files are cd images #285507
+ # fall back to lesspipe_file if .cue doesn't exist, or if
+ # cd-info failed to parse things sanely
+ [[ -e ${1%.*}.cue ]] \
+ && cd-info --no-header --no-device-info "$1" \
+ || lesspipe_file "$1"
+ ;;
+ *.iso)
+ iso_info=$(isoinfo -d -i "$1")
+ echo "${iso_info}"
+ # Joliet output overrides Rock Ridge, so prefer the better Rock
+ case ${iso_info} in
+ *$'\n'"Rock Ridge"*) iso_opts="-R";;
+ *$'\n'"Joliet"*) iso_opts="-J";;
+ *) iso_opts="";;
+ esac
+ isoinfo -l ${iso_opts} -i "$1"
+ ;;
+
+ ### Encryption stuff ###
+ *.crl) crl_filter "$1" ;;
+ *.csr) csr_filter "$1" ;;
+ *.crt|*.pem) crt_filter "$1" ;;
+ *.jks) jks_filter "$1" ;;
+ *.p12|*.pfx) p12_filter "$1" ;;
+
+# May not be such a good idea :)
+# ### Device nodes ###
+# /dev/[hs]d[a-z]*)
+# fdisk -l "${1:0:8}"
+# [[ $1 == *hd* ]] && hdparm -I "${1:0:8}"
+# ;;
+
+ ### Everything else ###
+ *)
+ case $(( recur++ )) in
+ # Maybe we didn't match due to case issues ...
+ 0) lesspipe "$1" "$(echo "$1" | LC_ALL=C tr '[:upper:]' '[:lower:]')" ;;
+
+ # Maybe we didn't match because the file is named weird ...
+ 1) lesspipe_file "$1" ;;
+ esac
+
+ # So no matches from above ... finally fall back to an external
+ # coloring package. No matching here so we don't have to worry
+ # about keeping in sync with random packages. Any coloring tool
+ # you use should not output errors about unsupported files to
+ # stdout. If it does, it's your problem.
+
+ # Allow people to flip color off if they dont want it
+ case ${LESSCOLOR} in
+ always) LESSCOLOR=2;;
+ [yY][eE][sS]|[yY]|1|true) LESSCOLOR=1;;
+ [nN][oO]|[nN]|0|false) LESSCOLOR=0;;
+ *) LESSCOLOR=1;;
+ esac
+ if [[ ${LESSCOLOR} != "0" ]] && [[ -n ${LESSCOLORIZER=pygmentize} ]] ; then
+ # 2: Only colorize if user forces it ...
+ # 1: ... or we know less will handle raw codes -- this will
+ # not detect -seiRM, so set LESSCOLORIZER yourself
+ if [[ ${LESSCOLOR} == "2" ]] || [[ " ${LESS} " == *" -"[rR]" "* ]] ; then
+ LESSQUIET=true ${LESSCOLORIZER} "$1"
+ fi
+ fi
+
+ # Nothing left to do but let less deal
+ exit 0
+ ;;
+ esac
+}
+
+if [[ $# -eq 0 ]] ; then
+ echo "Usage: lesspipe <file>"
+elif [[ $1 == "-V" || $1 == "--version" ]] ; then
+ cat <<-EOF
+ lesspipe (git)
+ Copyright 1999-2023 Gentoo Authors
+ Mike Frysinger <vapier@gentoo.org>
+ (with plenty of ideas stolen from other projects/distros)
+
+ EOF
+ less -V
+elif [[ $1 == "-h" || $1 == "--help" ]] ; then
+ cat <<-EOF
+ lesspipe: preprocess files before sending them to less
+
+ Usage: lesspipe <file>
+
+ lesspipe specific settings:
+ LESSCOLOR env - toggle colorizing of output (no/yes/always; default: no)
+ LESSCOLORIZER env - program used to colorize output (default: pygmentize)
+ LESSIGNORE - list of extensions to ignore (don't do anything fancy)
+
+ You can create per-user filters as well by creating the executable file:
+ ~/.lessfilter
+ One argument is passed to it: the file to display. The script should exit 0
+ to indicate it handled the file, or non-zero to tell lesspipe to handle it.
+
+ To use lesspipe, simply add to your environment:
+ export LESSOPEN="|lesspipe %s"
+
+ For colorization, install dev-python/pygments for the pygmentize program. Note,
+ if using alternative code2color from sys app-text/lesspipe you may run out of
+ memory due to #188835.
+
+ Run 'less --help' or 'man less' for more info.
+ EOF
+else
+ recur=0
+ [[ -z ${LESSDEBUG+set} ]] && exec 2>/dev/null
+ lesspipe "$1"
+fi
diff --git a/sys-apps/less/less-643-r1.ebuild b/sys-apps/less/less-643-r1.ebuild
new file mode 100644
index 000000000000..186eda3b6814
--- /dev/null
+++ b/sys-apps/less/less-643-r1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Releases are usually first a beta then promoted to stable if no
+# issues were found. Upstream explicitly ask "to not generally distribute"
+# the beta versions. It's okay to keyword beta versions if they fix
+# a serious bug, but otherwise try to avoid it.
+
+WANT_AUTOMAKE=none
+WANT_LIBTOOL=none
+inherit autotools flag-o-matic optfeature toolchain-funcs
+
+DESCRIPTION="Excellent text file viewer"
+HOMEPAGE="https://www.greenwoodsoftware.com/less/"
+
+MY_PV=${PV/_beta/-beta}
+MY_P=${PN}-${MY_PV}
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://github.com/gwsw/less"
+ inherit git-r3
+else
+ SRC_URI="https://www.greenwoodsoftware.com/less/${MY_P}.tar.gz"
+
+ if [[ ${PV} != *_beta* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+ fi
+fi
+
+S="${WORKDIR}"/${MY_P/?beta}
+
+LICENSE="|| ( GPL-3 BSD-2 )"
+SLOT="0"
+IUSE="pcre test"
+# chinese1, utf8-2
+RESTRICT="test !test? ( test )"
+
+DEPEND="
+ >=app-misc/editor-wrapper-3
+ >=sys-libs/ncurses-5.2:=
+ pcre? ( dev-libs/libpcre2 )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="test? ( virtual/pkgconfig )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-643-lesstest-pkg-config.patch
+)
+
+src_prepare() {
+ default
+ # Per upstream README to prepare live build
+ [[ ${PV} == 9999 ]] && emake -f Makefile.aut distfiles
+ # Upstream uses unpatched autoconf-2.69, which breaks with clang-16.
+ # https://bugs.gentoo.org/870412
+ eautoreconf
+}
+
+src_configure() {
+ append-lfs-flags # bug #896316
+
+ local myeconfargs=(
+ --with-regex=$(usex pcre pcre2 posix)
+ --with-editor="${EPREFIX}"/usr/libexec/editor
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_test() {
+ emake check VERBOSE=1 CC="$(tc-getCC)" PKG_CONFIG="$(tc-getPKG_CONFIG)"
+}
+
+src_install() {
+ default
+
+ keepdir /usr/lib/lessfilter.d
+ keepdir /etc/lessfilter.d
+
+ newbin "${FILESDIR}"/lesspipe-r3.sh lesspipe
+ newenvd "${FILESDIR}"/less.envd 70less
+}
+
+pkg_preinst() {
+ optfeature "Colorized output supprt" dev-python/pygments
+
+ if has_version "<${CATEGORY}/${PN}-483-r1" ; then
+ elog "The lesspipe.sh symlink has been dropped. If you are still setting"
+ elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
+ fi
+
+ if has_version "<${CATEGORY}/${PN}-643" ; then
+ elog "less now colorizes by default. To disable this, set LESSCOLOR=no."
+ fi
+}
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/
@ 2024-04-14 0:49 Sam James
0 siblings, 0 replies; 8+ messages in thread
From: Sam James @ 2024-04-14 0:49 UTC (permalink / raw
To: gentoo-commits
commit: e9856cc39c2e0ee09e32358b23a120d855e4953c
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 14 00:47:11 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 14 00:49:11 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9856cc3
sys-apps/less: fix LESSOPEN escape vulnerability
Special thanks to the less upstream maintainer, Mark Nudelman, for providing
us with a backport to 643.
Bug: https://bugs.gentoo.org/929210
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-apps/less/files/less-643-LESSOPEN-escape.patch | 61 ++++++++++++++
sys-apps/less/less-643-r2.ebuild | 97 ++++++++++++++++++++++
2 files changed, 158 insertions(+)
diff --git a/sys-apps/less/files/less-643-LESSOPEN-escape.patch b/sys-apps/less/files/less-643-LESSOPEN-escape.patch
new file mode 100644
index 000000000000..f3fe50fcfaa2
--- /dev/null
+++ b/sys-apps/less/files/less-643-LESSOPEN-escape.patch
@@ -0,0 +1,61 @@
+https://openwall.com/lists/oss-security/2024/04/12/5
+https://bugs.gentoo.org/929210
+https://github.com/gwsw/less/commit/007521ac3c95bc76e3d59c6dbfe75d06c8075c33
+
+Upstream provided this version via email as a backport to 643.
+--- a/filename.c
++++ b/filename.c
+@@ -134,6 +134,15 @@
+ }
+
+ /*
++ * Must use quotes rather than escape char for this metachar?
++ */
++static int must_quote(char c)
++{
++ /* {{ Maybe the set of must_quote chars should be configurable? }} */
++ return (c == '\n');
++}
++
++/*
+ * Insert a backslash before each metacharacter in a string.
+ */
+ public char * shell_quote(char *s)
+@@ -164,6 +173,9 @@
+ * doesn't support escape chars. Use quotes.
+ */
+ use_quotes = 1;
++ } else if (must_quote(*p))
++ {
++ len += 3; /* open quote + char + close quote */
+ } else
+ {
+ /*
+@@ -193,15 +205,22 @@
+ {
+ while (*s != '\0')
+ {
+- if (metachar(*s))
++ if (!metachar(*s))
+ {
+- /*
+- * Add the escape char.
+- */
++ *p++ = *s++;
++ } else if (must_quote(*s))
++ {
++ /* Surround the char with quotes. */
++ *p++ = openquote;
++ *p++ = *s++;
++ *p++ = closequote;
++ } else
++ {
++ /* Insert an escape char before the char. */
+ strcpy(p, esc);
+ p += esclen;
++ *p++ = *s++;
+ }
+- *p++ = *s++;
+ }
+ *p = '\0';
+ }
diff --git a/sys-apps/less/less-643-r2.ebuild b/sys-apps/less/less-643-r2.ebuild
new file mode 100644
index 000000000000..a8159dc3fa9f
--- /dev/null
+++ b/sys-apps/less/less-643-r2.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Releases are usually first a beta then promoted to stable if no
+# issues were found. Upstream explicitly ask "to not generally distribute"
+# the beta versions. It's okay to keyword beta versions if they fix
+# a serious bug, but otherwise try to avoid it.
+
+WANT_AUTOMAKE=none
+WANT_LIBTOOL=none
+inherit autotools flag-o-matic optfeature toolchain-funcs
+
+DESCRIPTION="Excellent text file viewer"
+HOMEPAGE="https://www.greenwoodsoftware.com/less/"
+
+MY_PV=${PV/_beta/-beta}
+MY_P=${PN}-${MY_PV}
+
+if [[ ${PV} == 9999 ]]; then
+ EGIT_REPO_URI="https://github.com/gwsw/less"
+ inherit git-r3
+else
+ SRC_URI="https://www.greenwoodsoftware.com/less/${MY_P}.tar.gz"
+
+ if [[ ${PV} != *_beta* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+ fi
+fi
+
+S="${WORKDIR}"/${MY_P/?beta}
+
+LICENSE="|| ( GPL-3 BSD-2 )"
+SLOT="0"
+IUSE="pcre test"
+# chinese1, utf8-2
+RESTRICT="test !test? ( test )"
+
+DEPEND="
+ >=app-misc/editor-wrapper-3
+ >=sys-libs/ncurses-5.2:=
+ pcre? ( dev-libs/libpcre2 )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="test? ( virtual/pkgconfig )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-643-lesstest-pkg-config.patch
+ "${FILESDIR}"/${PN}-643-LESSOPEN-escape.patch
+)
+
+src_prepare() {
+ default
+ # Per upstream README to prepare live build
+ [[ ${PV} == 9999 ]] && emake -f Makefile.aut distfiles
+ # Upstream uses unpatched autoconf-2.69, which breaks with clang-16.
+ # https://bugs.gentoo.org/870412
+ eautoreconf
+}
+
+src_configure() {
+ append-lfs-flags # bug #896316
+
+ local myeconfargs=(
+ --with-regex=$(usex pcre pcre2 posix)
+ --with-editor="${EPREFIX}"/usr/libexec/editor
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_test() {
+ emake check VERBOSE=1 CC="$(tc-getCC)" PKG_CONFIG="$(tc-getPKG_CONFIG)"
+}
+
+src_install() {
+ default
+
+ keepdir /usr/lib/lessfilter.d
+ keepdir /etc/lessfilter.d
+
+ newbin "${FILESDIR}"/lesspipe-r3.sh lesspipe
+ newenvd "${FILESDIR}"/less.envd 70less
+}
+
+pkg_preinst() {
+ optfeature "Colorized output support" dev-python/pygments
+
+ if has_version "<${CATEGORY}/${PN}-483-r1" ; then
+ elog "The lesspipe.sh symlink has been dropped. If you are still setting"
+ elog "LESSOPEN to that, you will need to update it to '|lesspipe %s'."
+ fi
+
+ if has_version "<${CATEGORY}/${PN}-643" ; then
+ elog "less now colorizes by default. To disable this, set LESSCOLOR=no."
+ fi
+}
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-04-14 0:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-04 8:37 [gentoo-commits] repo/gentoo:master commit in: sys-apps/less/files/, sys-apps/less/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2024-04-14 0:49 Sam James
2023-07-17 22:04 Sam James
2023-06-23 21:59 Sam James
2023-02-09 3:54 Sam James
2022-11-24 16:53 Mike Gilbert
2020-11-18 8:15 Lars Wendler
2019-02-16 19:11 Lars Wendler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox