diff options
Diffstat (limited to 'patches')
-rw-r--r-- | patches/packages/less-653-x86_64-1_slack15.0.txt | 11 | ||||
-rw-r--r-- | patches/source/less/007521ac3c95bc76.patch | 73 | ||||
-rwxr-xr-x | patches/source/less/less.SlackBuild | 154 | ||||
-rw-r--r-- | patches/source/less/less.url | 2 | ||||
-rw-r--r-- | patches/source/less/lesspipe.sh | 70 | ||||
-rw-r--r-- | patches/source/less/slack-desc | 19 |
6 files changed, 329 insertions, 0 deletions
diff --git a/patches/packages/less-653-x86_64-1_slack15.0.txt b/patches/packages/less-653-x86_64-1_slack15.0.txt new file mode 100644 index 000000000..f67c58023 --- /dev/null +++ b/patches/packages/less-653-x86_64-1_slack15.0.txt @@ -0,0 +1,11 @@ +less: less (file pager) +less: +less: Less is a paginator similar to more (1), but which allows backward +less: movement in the file as well as forward movement. Also, less does not +less: have to read the entire input file before starting, so with large +less: input files it starts up faster than text editors like vi (1). +less: +less: Less was written by Mark Nudelman. +less: +less: +less: diff --git a/patches/source/less/007521ac3c95bc76.patch b/patches/source/less/007521ac3c95bc76.patch new file mode 100644 index 000000000..663f222c0 --- /dev/null +++ b/patches/source/less/007521ac3c95bc76.patch @@ -0,0 +1,73 @@ +From 007521ac3c95bc76e3d59c6dbfe75d06c8075c33 Mon Sep 17 00:00:00 2001 +From: Mark Nudelman <markn@greenwoodsoftware.com> +Date: Thu, 11 Apr 2024 17:49:48 -0700 +Subject: [PATCH] Fix bug when viewing a file whose name contains a newline. + +--- + filename.c | 31 +++++++++++++++++++++++++------ + 1 file changed, 25 insertions(+), 6 deletions(-) + +diff --git a/filename.c b/filename.c +index f90e0e82..a52c6354 100644 +--- a/filename.c ++++ b/filename.c +@@ -127,11 +127,20 @@ static constant char * metachars(void) + /* + * Is this a shell metacharacter? + */ +-static int metachar(char c) ++static lbool metachar(char c) + { + return (strchr(metachars(), c) != NULL); + } + ++/* ++ * Must use quotes rather than escape char for this metachar? ++ */ ++static lbool 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. + */ +@@ -164,6 +173,9 @@ public char * shell_quoten(constant char *s, size_t slen) + * doesn't support escape chars. Use quotes. + */ + use_quotes = TRUE; ++ } else if (must_quote(*p)) ++ { ++ len += 3; /* open quote + char + close quote */ + } else + { + /* +@@ -194,15 +206,22 @@ public char * shell_quoten(constant char *s, size_t slen) + constant char *es = s + slen; + while (s < es) + { +- if (metachar(*s)) ++ if (!metachar(*s)) + { +- /* +- * Add the escape char. +- */ ++ *np++ = *s++; ++ } else if (must_quote(*s)) ++ { ++ /* Surround the char with quotes. */ ++ *np++ = openquote; ++ *np++ = *s++; ++ *np++ = closequote; ++ } else ++ { ++ /* Insert an escape char before the char. */ + strcpy(np, esc); + np += esclen; ++ *np++ = *s++; + } +- *np++ = *s++; + } + *np = '\0'; + } diff --git a/patches/source/less/less.SlackBuild b/patches/source/less/less.SlackBuild new file mode 100755 index 000000000..c89606cf5 --- /dev/null +++ b/patches/source/less/less.SlackBuild @@ -0,0 +1,154 @@ +#!/bin/bash + +# Copyright 2005-2024 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PKGNAM=less +VERSION=${VERSION:-$(echo less-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-1_slack15.0} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i586 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +# If the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" + exit 0 +fi + +NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +elif [ "$ARCH" = "arm" ]; then + SLKCFLAGS="-O2 -march=armv4 -mtune=xscale" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "armel" ]; then + SLKCFLAGS="-O2 -march=armv4t" + LIBDIRSUFFIX="" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +TMP=${TMP:-/tmp} +PKG=$TMP/package-less +rm -rf $PKG +mkdir -p $TMP $PKG + +cd $TMP +rm -rf less-$VERSION +tar xvf $CWD/less-$VERSION.tar.?z || exit 1 +cd less-$VERSION || exit 1 + +# Fix path in manpage: +if [ -r less.nro ]; then + sed -i "s,/usr/local/etc,/etc,g" less.nro +fi + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \+ -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \+ + +# newline in filenames patch for CVE-2024-32487: +cat $CWD/007521ac3c95bc76.patch | patch -p1 --verbose || exit 1 + +if [ ! -r configure ]; then + if [ -x ./autogen.sh ]; then + NOCONFIGURE=1 ./autogen.sh + else + autoreconf -vif + fi +fi + +# Prep needed if using the git archive: +for file in funcs.h less.nro lesskey.nro lessecho.nro ; do + if [ ! -r $file ]; then + make -f Makefile.aut $file + fi +done + +CFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/man || exit 1 + +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 + +zcat $CWD/lesspipe.sh.gz > $PKG/usr/bin/lesspipe.sh +chmod 755 $PKG/usr/bin/lesspipe.sh + +# Compress and link manpages, if any: +if [ -d $PKG/usr/man ]; then + ( cd $PKG/usr/man + for manpagedir in $(find . -type d -name "man*") ; do + ( cd $manpagedir + for eachpage in $( find . -type l -maxdepth 1 | grep -v '\.gz$') ; do + ln -s $( readlink $eachpage ).gz $eachpage.gz + rm $eachpage + done + gzip -9 *.? + ) + done + ) +fi + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +mkdir -p $PKG/usr/doc/less-$VERSION +cp -a \ + COPYING* LICENSE README NEWS \ + $PKG/usr/doc/less-$VERSION + +mkdir -p $PKG/usr/man/man1 +for page in less.nro lesskey.nro ; do + cat $page | gzip -9c > $PKG/usr/man/man1/`basename $page .nro`.1.gz +done + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +# Build the package: +cd $PKG +/sbin/makepkg -l y -c n $TMP/less-$VERSION-$ARCH-$BUILD.txz + diff --git a/patches/source/less/less.url b/patches/source/less/less.url new file mode 100644 index 000000000..34b36062b --- /dev/null +++ b/patches/source/less/less.url @@ -0,0 +1,2 @@ +#http://www.greenwoodsoftware.com/less/ +https://github.com/gwsw/less diff --git a/patches/source/less/lesspipe.sh b/patches/source/less/lesspipe.sh new file mode 100644 index 000000000..6bc9ff64d --- /dev/null +++ b/patches/source/less/lesspipe.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright 1997, 1998, 1999, 2000 Patrick Volkerding, Moorhead, MN, USA +# Copyright 2001, 2002 Slackware Linux, Inc, Concord, CA, USA +# Copyright 2006, 2009, 2017, 2021 Patrick Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# This is a preprocessor for 'less'. It is used when this environment +# variable is set: LESSOPEN="|lesspipe.sh %s" + +lesspipe() { + case "$1" in + *.tar) tar tvvf "$1" 2>/dev/null ;; + *.tar.lzma ) lzma -dc "$1" 2> /dev/null | tar tvvf - 2> /dev/null ;; + *.tgz | *.tar.gz | *.tar.Z | *.tar.z | *.tar.bz2 | *.tbz ) tar tvvf "$1" 2>/dev/null ;; + *.tlz | *.tar.lz ) lzip -dc "$1" 2> /dev/null | tar tvvf - 2> /dev/null ;; + *.txz | *.tar.xz ) xz -dc "$1" 2> /dev/null | tar tvvf - 2> /dev/null ;; + *.tzst | *.tzz | *.tar.zst | *.tar.zstd ) tar tvvf "$1" 2> /dev/null ;; + *.zip) unzip -l "$1" 2>/dev/null ;; + *.rpm) rpm -qpvl "$1" 2>/dev/null ;; + *.rar) # check if rar is installed first + if which rar 1> /dev/null ; then + `which rar` t "$1" + fi ;; + *.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.man) # *roff src? + if file -L "$1" | grep roff 1> /dev/null ; then + nroff -S -mandoc "$1" + fi ;; + *.1.gz|*.2.gz|*.3.gz|*.4.gz|*.5.gz|*.6.gz|*.7.gz|*.8.gz|*.9.gz|*.n.gz|*.man.gz) # compressed *roff src? + if gzip -dc "$1" | file - | grep roff 1> /dev/null ; then + gzip -dc "$1" | nroff -S -mandoc - + else gzip -dc "$1" 2>/dev/null + fi ;; + *.1.bz2|*.2.bz2|*.3.bz2|*.4.bz2|*.5.bz2|*.6.bz2|*.7.bz2|*.8.bz2|*.9.bz2|*.n.bz2|*.man.bz2) # compressed *roff src? + if bzip2 -dc "$1" | file - | grep roff 1> /dev/null ; then + bzip2 -dc "$1" | nroff -S -mandoc - + fi ;; + *.gz) gzip -dc "$1" 2>/dev/null ;; + *.bz2) bzip2 -dc "$1" 2>/dev/null ;; + *.lzma) lzma -dc "$1" 2>/dev/null ;; + *.xz) xz -dc "$1" 2>/dev/null ;; +# *) FILE=`file -L "$1"` ; # Check to see if binary, if so -- view with 'strings' +# FILE1=`echo $FILE | cut -d ' ' -f 2` +# FILE2=`echo $FILE | cut -d ' ' -f 3` +# if [ "$FILE1" = "Linux/i386" -o "$FILE2" = "Linux/i386" \ +# -o "$FILE1" = "ELF" -o "$FILE2" = "ELF" ]; then +# strings "$1" +# fi ;; + esac +} + +lesspipe "$1" diff --git a/patches/source/less/slack-desc b/patches/source/less/slack-desc new file mode 100644 index 000000000..209f19c0a --- /dev/null +++ b/patches/source/less/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +less: less (file pager) +less: +less: Less is a paginator similar to more (1), but which allows backward +less: movement in the file as well as forward movement. Also, less does not +less: have to read the entire input file before starting, so with large +less: input files it starts up faster than text editors like vi (1). +less: +less: Less was written by Mark Nudelman. +less: +less: +less: |