summaryrefslogtreecommitdiff
path: root/sys-apps/less
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/less')
-rw-r--r--sys-apps/less/Manifest2
-rw-r--r--sys-apps/less/files/less-643-LESSOPEN-escape.patch61
-rw-r--r--sys-apps/less/less-643-r2.ebuild97
3 files changed, 160 insertions, 0 deletions
diff --git a/sys-apps/less/Manifest b/sys-apps/less/Manifest
index ac94eeb8b60d..0e97530af584 100644
--- a/sys-apps/less/Manifest
+++ b/sys-apps/less/Manifest
@@ -1,3 +1,4 @@
+AUX less-643-LESSOPEN-escape.patch 1296 BLAKE2B 8e2522e56235b84f413a0f43ec4096a7a21cb9b04ede9fa04483ed940f11df2a7662ce5517db1878f04321df218ad7bda36f50aa70744cc7629e24d5ffcb3172 SHA512 52bda4a8dca4574eefc68dab31782e857a6a788c2016bfa8c1c4fd95c1dbfa22acc7f04cfdba5b06b226f1243e67f316a694625fa6d935c6ed09d9665721aa05
AUX less-643-lesstest-pkg-config.patch 1483 BLAKE2B 2c0fb65721c2b1c5af74a4fd516d9255059e9aeba7eb91de8aff9d6b35fe708fe275bdde9df6047b6bf4c79534c8410cb946be436a35fe21ce254c87235c6908 SHA512 b6d9911efb20da00f28ceebd922c7f97f7957f964ccb2c50187a52019b35dffaa1e2a7a76cf846ca9f76100af5b2fa38468fb5d49bab9a6b6b02747da2c8f76b
AUX less.envd 47 BLAKE2B 4ebc9242c96918c6942b05f67a9be541c6c535c23072e89e36c376e690cb7df9528e1734514092a6afdd3d4f47db45c6186a8cce5d9eb18ca7c73a01800f35fc SHA512 261b25887b08b3255e412b36130d014fc37ffc7de75dce3b5ba2521d94a1b0be4c584808b9698c30a8dafea70c62fae2cd0642d0983f96cdb418c3c501433674
AUX lesspipe-r1.sh 8135 BLAKE2B f11727136a5235f07ad86c1811c5ef8489a48fc3d032b8840bc67eda70e1800f03505a534870a0ba73aa62e4df4315444c76fe8aa89ab47c8b2f1e08fab5b6e2 SHA512 e7820d0c925da4d217214e093c671d6c2da51da00dcec98bed80fe3e6d664cfd3baf1b850eb711e9ccf9a1d09f943e2fc2efc3e8061bbfa45724c5b623dafe94
@@ -6,5 +7,6 @@ DIST less-633.tar.gz 375733 BLAKE2B e9df180794af365f86734c6b8fde766c1bba42b11171
DIST less-643.tar.gz 592291 BLAKE2B 6dc60dc2e8db05afdae466877a1d26a3008ff5378bbbf2fbdf9efc4f87c0fcfde5703d44a24d4355c98d3a5f438bdb51173150f2a69f801d9c8e4a7401d71b53 SHA512 6a324ac54e22429ac652dc303bc1fe48933555d1cbf8ad7ecf345940910c014fef9551a3219743cfb7115e356b5841ae97d6ce62e7a1ba1e3300d243efca34d9
EBUILD less-633.ebuild 2188 BLAKE2B 3157e4c5b111b0f1b8e1ef9a9a437474f5380af2b6bbc7e1011d102b6d6cefd788fe2c60bb7d272f0fcdf69db0fd1692c66a42bb47b648f94dfe3281ecdebdc6 SHA512 299d40de3ac0c4d3a9321dca6efbc44aad50066fabe324c0e0cea407469adf374b26887cd4ca1347cec99eb6c2037d3fff2e8cbc764d44ee509759b27f588b1e
EBUILD less-643-r1.ebuild 2448 BLAKE2B 5b6c29a76f576163a2138b16f46fab51d4a4e8cdd84a14faf6e8f438078c11f6223af5f2bb8b34208775f449b961e9c41b251c705b22c26d28d2157ae5766e51 SHA512 f3e10bc7760f7ce1cd3b9e1177b8a6f6398384208667cc701c72b6c77fbb9d9124f160de9bcccc707acbf826f622a6c691ce27adee700843aaff034e43699fe7
+EBUILD less-643-r2.ebuild 2498 BLAKE2B 9a596baa4300c19026dd159c72483d2cea425fbeade67a3f9f6c81783a2e153f8c3817d130be4e2839db8a33ea00c404154b1c2f4ed482ba5f5a32bde8007d29 SHA512 843b5fa24d64b7e4bd032dcce4dc1c10f807ef497652161ef2db7a400095f30727fd81530856232bce1bd9f591a0f6d91e561826b5d80a4702d58687f2bf27b4
EBUILD less-9999.ebuild 2455 BLAKE2B 56d96673aec2ef08bb61b3215dcf8473ca7c4bec84df7ac74475c37b332a369f15d2ddbe7fb93b5bcd0eba048e67767b6ef9b5a17ebdcf97eb7e165c6bcc629b SHA512 d71d25aa70fa1c7b334b302f7d94d49bbc9de16f50854a8749f1650bbbc63f91e416c2aa817ea81fcd7248814b511425427bbb7c5f3f76744493f75e4be61bc4
MISC metadata.xml 384 BLAKE2B ab69cbf4d7813bc4c96dc1c18ca35454dc9e9202bc95e3ff3b638c79b6cff4f9914fba1e7a35908aa305567a3874d3ead3a78f5faa83c9fbd3027afe12767eac SHA512 d799332d42f1c3115132216b3ba98a39f662d583aecb06fa2590e3da4c03b0ec07bab1eb0bbd397ef8249a5916ca9b457992c226899f66d4f4bef8bf1a20074f
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..0b846ece797a
--- /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
+}