From 3fdb6d6ce7f8a98806faf9243e5d5bbcd885a5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Mu=C5=BEila?= Date: Tue, 5 Sep 2023 13:15:40 +0200 Subject: [PATCH 01/21] Update to new upstream release Resolves: #2231663 --- .gitignore | 1 + less.spec | 8 ++++++-- sources | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index de5c14c..75b23d7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /less-590.tar.gz /less-608.tar.gz /less-633.tar.gz +/less-643.tar.gz diff --git a/less.spec b/less.spec index f664226..e54ae5c 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less -Version: 633 -Release: 2%{?dist} +Version: 643 +Release: 1%{?dist} License: GPLv3+ or BSD Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -61,6 +61,10 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Tue Sep 05 2023 Matej Mužila - 643-1 +- Update to new upstream release +- Resolves: #2231663 + * Thu Jul 20 2023 Fedora Release Engineering - 633-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/sources b/sources index eb34862..28fa119 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (less-633.tar.gz) = a29aaf72abca07fb29d12f218bbd422a39e3898b3d53e8dbd5265ae47ecf68b88c3381aa3a9bf7caa8db1e2d8e2c138b333f0d69fddd4cf014e39118c53f7fb1 +SHA512 (less-643.tar.gz) = 6a324ac54e22429ac652dc303bc1fe48933555d1cbf8ad7ecf345940910c014fef9551a3219743cfb7115e356b5841ae97d6ce62e7a1ba1e3300d243efca34d9 From e48998a8581b0eb43a2e30dd5a4a540565f101d1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 21 Jan 2024 03:23:36 +0000 Subject: [PATCH 02/21] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- less.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/less.spec b/less.spec index e54ae5c..dba07e6 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 643 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ or BSD Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -61,6 +61,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Sun Jan 21 2024 Fedora Release Engineering - 643-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Tue Sep 05 2023 Matej Mužila - 643-1 - Update to new upstream release - Resolves: #2231663 From a93b01df0c8a72435ba80bf34b54bfcfccc8e019 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 25 Jan 2024 01:21:08 +0000 Subject: [PATCH 03/21] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- less.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/less.spec b/less.spec index dba07e6..a57928c 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 643 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ or BSD Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -61,6 +61,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Thu Jan 25 2024 Fedora Release Engineering - 643-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sun Jan 21 2024 Fedora Release Engineering - 643-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 49993f9ad0826abbd79272181070978ffb54c52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Mu=C5=BEila?= Date: Tue, 6 Feb 2024 13:26:02 +0100 Subject: [PATCH 04/21] migrated to SPDX license --- less.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/less.spec b/less.spec index a57928c..8a564df 100644 --- a/less.spec +++ b/less.spec @@ -1,8 +1,8 @@ Summary: A text file browser similar to more, but better Name: less Version: 643 -Release: 3%{?dist} -License: GPLv3+ or BSD +Release: 4%{?dist} +License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh Source2: less.sh @@ -61,6 +61,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Tue Feb 06 2024 Matej Mužila - 643-4 +- migrated to SPDX license + * Thu Jan 25 2024 Fedora Release Engineering - 643-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 5a32833f079cb3842b82501dd78c50423aa310c0 Mon Sep 17 00:00:00 2001 From: Software Management Team Date: Thu, 30 May 2024 12:46:47 +0200 Subject: [PATCH 05/21] Eliminate use of obsolete %patchN syntax (#2283636) --- less.spec | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/less.spec b/less.spec index 8a564df..4998430 100644 --- a/less.spec +++ b/less.spec @@ -31,13 +31,13 @@ files, and you'll use it frequently. %prep %setup -q -%patch4 -p1 -b .time -%patch5 -p1 -b .fsync -%patch6 -p1 -b .manpage-add-old-bot-option -%patch8 -p1 -b .lessecho-usage -%patch9 -p1 -b .less-filters-man -%patch10 -p1 -b .lesskey-usage -%patch11 -p1 -b .old-bot +%patch -P4 -p1 -b .time +%patch -P5 -p1 -b .fsync +%patch -P6 -p1 -b .manpage-add-old-bot-option +%patch -P8 -p1 -b .lessecho-usage +%patch -P9 -p1 -b .less-filters-man +%patch -P10 -p1 -b .lesskey-usage +%patch -P11 -p1 -b .old-bot %build From 7ad5b17f792de419b469c3425a518f4003d2958a Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Mon, 15 Jul 2024 23:32:29 +0200 Subject: [PATCH 06/21] do not use bashisms in lesspipe.sh --- lesspipe.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lesspipe.sh b/lesspipe.sh index f2df6a1..71b75c7 100755 --- a/lesspipe.sh +++ b/lesspipe.sh @@ -63,12 +63,16 @@ case "$1" in if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then $DECOMPRESSOR -- "$1" | manfilter - exit $? - fi ;;& + fi +esac +case "$1" in *.[1-9n]|*.[1-9]x|*.man) if file "$1" | grep -q troff; then manfilter "$1" exit $? - fi ;;& + fi +esac +case "$1" in *.tar) tar tvvf "$1"; exit $? ;; *.tgz|*.tar.gz|*.tar.[zZ]) tar tzvvf "$1"; exit $? ;; *.tar.xz) tar Jtvvf "$1"; exit $? ;; From b6fa70c48517d9c1a57a140db3103fd009709c93 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 18 Jul 2024 13:07:58 +0000 Subject: [PATCH 07/21] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- less.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/less.spec b/less.spec index 4998430..b0f8b8d 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 643 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -61,6 +61,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Thu Jul 18 2024 Fedora Release Engineering - 643-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Tue Feb 06 2024 Matej Mužila - 643-4 - migrated to SPDX license From 06e3b4dae1f44479254e9bcad123e6e60f0ed94c Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Fri, 26 Jul 2024 22:45:46 +0200 Subject: [PATCH 08/21] updated to 661(2294840) --- .gitignore | 1 + less.spec | 7 +++++-- sources | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 75b23d7..d98e5ac 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /less-608.tar.gz /less-633.tar.gz /less-643.tar.gz +/less-661.tar.gz diff --git a/less.spec b/less.spec index b0f8b8d..ac992f7 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less -Version: 643 -Release: 5%{?dist} +Version: 661 +Release: 1%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -61,6 +61,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Fri Jul 26 2024 Michal Hlavinka - 661-1 +- updated to 661(2294840) + * Thu Jul 18 2024 Fedora Release Engineering - 643-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/sources b/sources index 28fa119..b958d5f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (less-643.tar.gz) = 6a324ac54e22429ac652dc303bc1fe48933555d1cbf8ad7ecf345940910c014fef9551a3219743cfb7115e356b5841ae97d6ce62e7a1ba1e3300d243efca34d9 +SHA512 (less-661.tar.gz) = 49d81ff9e79d43ce0271490e3bffd590b4aed5fcb387bc8eb3128de99e5b5a5ede2e2818b546f6e3a140fa6261f1de3dfba1231f7ff7ef18502bb7030eaea1b5 From be07c7dab7069e31cf97c1d1274ee85e1bce150c Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Sun, 28 Jul 2024 23:14:11 +0200 Subject: [PATCH 09/21] fix CVE-2024-32487 - less with LESSOPEN mishandles \n in paths (#2274981) --- less-633-cve2024_32487prereq.patch | 17 +++++++ less-654-cve2024_32487fix.patch | 75 +++++++++++++++++++++++++++++ less-654-cve2024_32487regrfix.patch | 73 ++++++++++++++++++++++++++++ less.spec | 12 ++++- 4 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 less-633-cve2024_32487prereq.patch create mode 100644 less-654-cve2024_32487fix.patch create mode 100644 less-654-cve2024_32487regrfix.patch diff --git a/less-633-cve2024_32487prereq.patch b/less-633-cve2024_32487prereq.patch new file mode 100644 index 0000000..c0b2a8a --- /dev/null +++ b/less-633-cve2024_32487prereq.patch @@ -0,0 +1,17 @@ +diff -up less-633/prompt.c.cve_prereq less-633/prompt.c +--- less-633/prompt.c.cve_prereq 2024-07-27 00:44:40.347267609 +0200 ++++ less-633/prompt.c 2024-07-27 00:45:26.575783719 +0200 +@@ -36,6 +36,13 @@ extern char *editor; + extern char *editproto; + #endif + ++typedef enum lbool { LFALSE, LTRUE } lbool; ++ ++#undef TRUE ++#define TRUE LTRUE ++#undef FALSE ++#define FALSE LFALSE ++ + /* + * Prototypes for the three flavors of prompts. + * These strings are expanded by pr_expand(). diff --git a/less-654-cve2024_32487fix.patch b/less-654-cve2024_32487fix.patch new file mode 100644 index 0000000..b7412ca --- /dev/null +++ b/less-654-cve2024_32487fix.patch @@ -0,0 +1,75 @@ +diff -up less-633/output.c.cve2024_32487fix less-633/output.c +--- less-633/output.c.cve2024_32487fix 2023-05-03 20:43:01.000000000 +0200 ++++ less-633/output.c 2024-07-27 00:28:05.420820950 +0200 +@@ -31,6 +31,7 @@ extern int so_s_width, so_e_width; + extern int screen_trashed; + extern int is_tty; + extern int oldbot; ++extern int utf_mode; + extern char intr_char; + + #if MSDOS_COMPILER==WIN32C || MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC +@@ -537,6 +538,7 @@ IPRINT_FUNC(iprint_linenum, LINENUM, lin + public int less_printf(char *fmt, PARG *parg) + { + char *s; ++ constant char *es; + int col; + + col = 0; +@@ -553,11 +555,17 @@ public int less_printf(char *fmt, PARG * + { + case 's': + s = parg->p_string; ++ es = s + strlen(s); + parg++; + while (*s != '\0') + { +- putchr(*s++); +- col++; ++ LWCHAR ch = step_char(&s, +1, es); ++ constant char *ps = utf_mode ? prutfchar(ch) : prchar(ch); ++ while (*ps != '\0') ++ { ++ putchr(*ps++); ++ col++; ++ } + } + break; + case 'd': +diff -up less-633/prompt.c.cve2024_32487fix less-633/prompt.c +--- less-633/prompt.c.cve2024_32487fix 2024-07-27 00:26:13.217361006 +0200 ++++ less-633/prompt.c 2024-07-27 00:31:37.965586499 +0200 +@@ -30,6 +30,7 @@ extern int sc_height; + extern int jump_sline; + extern int less_is_more; + extern int header_lines; ++extern int utf_mode; + extern IFILE curr_ifile; + #if EDITOR + extern char *editor; +@@ -81,13 +82,17 @@ public void init_prompt(void) + */ + static void ap_str(char *s) + { +- int len; +- +- len = (int) strlen(s); +- if (mp + len >= message + PROMPT_SIZE) +- len = (int) (message + PROMPT_SIZE - mp - 1); +- strncpy(mp, s, len); +- mp += len; ++ constant char *es = s + strlen(s); ++ while (*s != '\0') ++ { ++ LWCHAR ch = step_char(&s, +1, es); ++ constant char *ps = utf_mode ? prutfchar(ch) : prchar(ch); ++ size_t plen = strlen(ps); ++ if (mp + plen >= message + PROMPT_SIZE) ++ break; ++ strcpy(mp, ps); ++ mp += plen; ++ } + *mp = '\0'; + } + diff --git a/less-654-cve2024_32487regrfix.patch b/less-654-cve2024_32487regrfix.patch new file mode 100644 index 0000000..d0c7fec --- /dev/null +++ b/less-654-cve2024_32487regrfix.patch @@ -0,0 +1,73 @@ +diff -up less-633/prompt.c.cve2024_32487regrfix less-633/prompt.c +--- less-633/prompt.c.cve2024_32487regrfix 2024-07-27 00:32:28.945249829 +0200 ++++ less-633/prompt.c 2024-07-27 00:34:36.456908956 +0200 +@@ -79,23 +79,44 @@ public void init_prompt(void) + + /* + * Append a string to the end of the message. +- */ +-static void ap_str(char *s) +-{ +- constant char *es = s + strlen(s); +- while (*s != '\0') +- { +- LWCHAR ch = step_char(&s, +1, es); +- constant char *ps = utf_mode ? prutfchar(ch) : prchar(ch); +- size_t plen = strlen(ps); +- if (mp + plen >= message + PROMPT_SIZE) +- break; +- strcpy(mp, ps); ++ * nprt means the character *may* be nonprintable ++ * and should be converted to printable form. ++ */ ++static void ap_estr(char *s, lbool nprt) ++ { ++ constant char *es = s + strlen(s); ++ while (*s != '\0') ++ { ++ LWCHAR ch = step_char(&s, +1, es); ++ constant char *ps; ++ char ubuf[MAX_UTF_CHAR_LEN+1]; ++ size_t plen; ++ ++ if (nprt) ++ { ++ ps = utf_mode ? prutfchar(ch) : prchar(ch); ++ } else ++ { ++ char *up = ubuf; ++ put_wchar(&up, ch); ++ *up = '\0'; ++ ps = ubuf; ++ } ++ plen = strlen(ps); ++ if (mp + plen >= message + PROMPT_SIZE) ++ break; ++ strcpy(mp, ps); + mp += plen; + } + *mp = '\0'; + } + ++static void ap_str(char *s) ++{ ++ ap_estr(s, FALSE); ++} ++ ++ + /* + * Append a character to the end of the message. + */ +@@ -289,10 +310,10 @@ static void protochar(int c, int where, + break; + #endif + case 'f': /* File name */ +- ap_str(get_filename(curr_ifile)); ++ ap_estr(get_filename(curr_ifile), TRUE); + break; + case 'F': /* Last component of file name */ +- ap_str(last_component(get_filename(curr_ifile))); ++ ap_estr(last_component(get_filename(curr_ifile)), TRUE); + break; + case 'g': /* Shell-escaped file name */ + s = shell_quote(get_filename(curr_ifile)); diff --git a/less.spec b/less.spec index f664226..9ed9619 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 633 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ or BSD Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -14,6 +14,10 @@ Patch8: less-458-lessecho-usage.patch Patch9: less-458-less-filters-man.patch Patch10: less-458-lesskey-usage.patch Patch11: less-458-old-bot-in-help.patch +# 3x from upstream, for less < 654, rhbz#2274980 +Patch12: less-633-cve2024_32487prereq.patch +Patch13: less-654-cve2024_32487fix.patch +Patch14: less-654-cve2024_32487regrfix.patch URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool @@ -38,6 +42,9 @@ files, and you'll use it frequently. %patch9 -p1 -b .less-filters-man %patch10 -p1 -b .lesskey-usage %patch11 -p1 -b .old-bot +%patch -P 12 -p1 -b .cve2024_32487prereq +%patch -P 13 -p1 -b .cve2024_32487fix +%patch -P 14 -p1 -b .cve2024_32487regrfix %build @@ -61,6 +68,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Sun Jul 28 2024 Michal Hlavinka - 633-3 +- fix CVE-2024-32487 - less with LESSOPEN mishandles \n in paths (#2274981) + * Thu Jul 20 2023 Fedora Release Engineering - 633-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 1bd33326d9dc2802401df2acb0ea106249e0a84e Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Mon, 12 Aug 2024 17:27:16 +0200 Subject: [PATCH 10/21] fix post-v590 regression causing reading only part of pipe when stdin is null (upstream#558) --- less-436-help.patch | 24 ++++++++++++++++++++++++ less-661-pipefix.patch | 20 ++++++++++++++++++++ less.spec | 25 +++++++++++++++++-------- 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 less-436-help.patch create mode 100644 less-661-pipefix.patch diff --git a/less-436-help.patch b/less-436-help.patch new file mode 100644 index 0000000..d58498b --- /dev/null +++ b/less-436-help.patch @@ -0,0 +1,24 @@ +diff -up less-661/help.c.help less-661/help.c +--- less-661/help.c.help 2024-08-05 21:40:34.531327397 +0200 ++++ less-661/help.c 2024-08-05 21:40:34.533327418 +0200 +@@ -137,7 +137,7 @@ constant char helpdata[] = { + ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n', + ' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n', + ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','a','u','t','o','m','a','t','i','c','a','l','l','y',' ','a','l','l','o','c','a','t','e',' ','b','u','f','f','e','r','s',' ','f','o','r',' ','p','i','p','e','s','.','\n', +-' ',' ','-','c',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n','\n', ++' ',' ','-','c',' ',' ','-','C',' ',' ','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n',' ','-','-','C','L','E','A','R','-','S','C','R','E','E','N','\n', + ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','c','l','e','a','r','i','n','g',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','s','c','r','o','l','l','i','n','g','.','\n', + ' ',' ','-','d',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','d','u','m','b','\n', + ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','u','m','b',' ','t','e','r','m','i','n','a','l','.','\n', +diff -up less-661/less.hlp.help less-661/less.hlp +--- less-661/less.hlp.help 2024-08-05 21:40:34.532327408 +0200 ++++ less-661/less.hlp 2024-08-05 21:40:34.533327418 +0200 +@@ -134,7 +134,7 @@ + Number of buffers. + -B ........ --auto-buffers + Don't automatically allocate buffers for pipes. +- -c ........ --clear-screen ++ -c -C .... --clear-screen --CLEAR-SCREEN + Repaint by clearing rather than scrolling. + -d ........ --dumb + Dumb terminal. diff --git a/less-661-pipefix.patch b/less-661-pipefix.patch new file mode 100644 index 0000000..e82d2e1 --- /dev/null +++ b/less-661-pipefix.patch @@ -0,0 +1,20 @@ +diff -up less-661/os.c.pipefix less-661/os.c +--- less-661/os.c.pipefix 2024-06-29 19:16:08.000000000 +0200 ++++ less-661/os.c 2024-08-10 08:06:14.762224766 +0200 +@@ -80,6 +80,7 @@ extern int exit_F_on_close; + extern int follow_mode; + extern int scanning_eof; + extern char intr_char; ++extern int is_tty; + #if !MSDOS_COMPILER + extern int tty; + #endif +@@ -237,7 +238,7 @@ start: + } + #endif + #if USE_POLL +- if (fd != tty && use_poll) ++ if (is_tty && fd != tty && use_poll) + { + int ret = check_poll(fd, tty); + if (ret != 0) diff --git a/less.spec b/less.spec index ac992f7..7e39c87 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 661 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -14,6 +14,10 @@ Patch8: less-458-lessecho-usage.patch Patch9: less-458-less-filters-man.patch Patch10: less-458-lesskey-usage.patch Patch11: less-458-old-bot-in-help.patch +# from upstream, for <=661, fixes regression in file-types sanity chack post v590 +# https://github.com/gwsw/less/commit/ed454a217da417dc052723ea70da8efde0f2e66c +Patch12: less-661-pipefix.patch +Patch13: less-436-help.patch URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool @@ -31,13 +35,15 @@ files, and you'll use it frequently. %prep %setup -q -%patch -P4 -p1 -b .time -%patch -P5 -p1 -b .fsync -%patch -P6 -p1 -b .manpage-add-old-bot-option -%patch -P8 -p1 -b .lessecho-usage -%patch -P9 -p1 -b .less-filters-man -%patch -P10 -p1 -b .lesskey-usage -%patch -P11 -p1 -b .old-bot +%patch -P 4 -p1 -b .time +%patch -P 5 -p1 -b .fsync +%patch -P 6 -p1 -b .manpage-add-old-bot-option +%patch -P 8 -p1 -b .lessecho-usage +%patch -P 9 -p1 -b .less-filters-man +%patch -P 10 -p1 -b .lesskey-usage +%patch -P 11 -p1 -b .old-bot +%patch -P 12 -p1 -b .pipefix +%patch -P 13 -p1 -b .help %build @@ -61,6 +67,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Mon Aug 12 2024 Michal Hlavinka - 661-2 +- fix post-v590 regression causing reading only part of pipe when stdin is null (upstream#558) + * Fri Jul 26 2024 Michal Hlavinka - 661-1 - updated to 661(2294840) From a41a75ae08d970ab1bc5ad005f2903a7538617a9 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 21 Aug 2024 08:33:05 +0200 Subject: [PATCH 11/21] correct the previous fix --- less-590-CVE-2024-32487.patch | 57 +++++++++++++++++++ ...633-control-char-in-filename-regrfix.patch | 0 ...-654-control-char-in-filename-prereq.patch | 0 ...=> less-654-control-char-in-filename.patch | 0 less.spec | 39 +++++++------ 5 files changed, 79 insertions(+), 17 deletions(-) create mode 100644 less-590-CVE-2024-32487.patch rename less-654-cve2024_32487regrfix.patch => less-633-control-char-in-filename-regrfix.patch (100%) rename less-633-cve2024_32487prereq.patch => less-654-control-char-in-filename-prereq.patch (100%) rename less-654-cve2024_32487fix.patch => less-654-control-char-in-filename.patch (100%) diff --git a/less-590-CVE-2024-32487.patch b/less-590-CVE-2024-32487.patch new file mode 100644 index 0000000..61bbd0e --- /dev/null +++ b/less-590-CVE-2024-32487.patch @@ -0,0 +1,57 @@ +diff -up less-643/filename.c.CVE-2024-32487 less-643/filename.c +--- less-643/filename.c.CVE-2024-32487 2023-07-21 00:43:14.000000000 +0200 ++++ less-643/filename.c 2024-08-21 08:10:28.949475521 +0200 +@@ -134,6 +134,15 @@ static int metachar(char c) + } + + /* ++ * 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 @@ public char * shell_quote(char *s) + * 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 @@ public char * shell_quote(char *s) + { + 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/less-654-cve2024_32487regrfix.patch b/less-633-control-char-in-filename-regrfix.patch similarity index 100% rename from less-654-cve2024_32487regrfix.patch rename to less-633-control-char-in-filename-regrfix.patch diff --git a/less-633-cve2024_32487prereq.patch b/less-654-control-char-in-filename-prereq.patch similarity index 100% rename from less-633-cve2024_32487prereq.patch rename to less-654-control-char-in-filename-prereq.patch diff --git a/less-654-cve2024_32487fix.patch b/less-654-control-char-in-filename.patch similarity index 100% rename from less-654-cve2024_32487fix.patch rename to less-654-control-char-in-filename.patch diff --git a/less.spec b/less.spec index 9ed9619..dc79be6 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 633 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv3+ or BSD Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -14,10 +14,12 @@ Patch8: less-458-lessecho-usage.patch Patch9: less-458-less-filters-man.patch Patch10: less-458-lesskey-usage.patch Patch11: less-458-old-bot-in-help.patch -# 3x from upstream, for less < 654, rhbz#2274980 -Patch12: less-633-cve2024_32487prereq.patch -Patch13: less-654-cve2024_32487fix.patch -Patch14: less-654-cve2024_32487regrfix.patch +# 3x from upstream, for less < 654, fix for filenames containing control chars +Patch12: less-654-control-char-in-filename-prereq.patch +Patch13: less-654-control-char-in-filename.patch +Patch14: less-633-control-char-in-filename-regrfix.patch +# from upstream, for less < 654, rhbz#2274980 +Patch15: less-590-CVE-2024-32487.patch URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool @@ -35,17 +37,17 @@ files, and you'll use it frequently. %prep %setup -q -%patch4 -p1 -b .time -%patch5 -p1 -b .fsync -%patch6 -p1 -b .manpage-add-old-bot-option -%patch8 -p1 -b .lessecho-usage -%patch9 -p1 -b .less-filters-man -%patch10 -p1 -b .lesskey-usage -%patch11 -p1 -b .old-bot -%patch -P 12 -p1 -b .cve2024_32487prereq -%patch -P 13 -p1 -b .cve2024_32487fix -%patch -P 14 -p1 -b .cve2024_32487regrfix - +%patch -P 4 -p1 -b .time +%patch -P 5 -p1 -b .fsync +%patch -P 6 -p1 -b .manpage-add-old-bot-option +%patch -P 8 -p1 -b .lessecho-usage +%patch -P 9 -p1 -b .less-filters-man +%patch -P 10 -p1 -b .lesskey-usage +%patch -P 11 -p1 -b .old-bot +%patch -P 12 -p1 -b .ctrl-char-fname-prereq +%patch -P 13 -p1 -b .ctrl-char-fname +%patch -P 14 -p1 -b .ctrl-char-fname-regrfix +%patch -P 15 -p1 -b .CVE-2024-32487 %build rm -f ./configure @@ -68,9 +70,12 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog -* Sun Jul 28 2024 Michal Hlavinka - 633-3 +* Wed Aug 21 2024 Michal Hlavinka - 643-6 - fix CVE-2024-32487 - less with LESSOPEN mishandles \n in paths (#2274981) +* Sun Jul 28 2024 Michal Hlavinka - 633-3 +- fix incorrect display when filename contains control chars + * Thu Jul 20 2023 Fedora Release Engineering - 633-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 7d8844fa52297ce6bcdd934e232c1a135bf79d19 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Fri, 18 Oct 2024 11:19:24 +0200 Subject: [PATCH 12/21] updated to 668 (#2319532) --- .gitignore | 1 + less-661-pipefix.patch | 20 -------------------- less.spec | 11 +++++------ sources | 2 +- 4 files changed, 7 insertions(+), 27 deletions(-) delete mode 100644 less-661-pipefix.patch diff --git a/.gitignore b/.gitignore index d98e5ac..6fe5e3c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /less-633.tar.gz /less-643.tar.gz /less-661.tar.gz +/less-668.tar.gz diff --git a/less-661-pipefix.patch b/less-661-pipefix.patch deleted file mode 100644 index e82d2e1..0000000 --- a/less-661-pipefix.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -up less-661/os.c.pipefix less-661/os.c ---- less-661/os.c.pipefix 2024-06-29 19:16:08.000000000 +0200 -+++ less-661/os.c 2024-08-10 08:06:14.762224766 +0200 -@@ -80,6 +80,7 @@ extern int exit_F_on_close; - extern int follow_mode; - extern int scanning_eof; - extern char intr_char; -+extern int is_tty; - #if !MSDOS_COMPILER - extern int tty; - #endif -@@ -237,7 +238,7 @@ start: - } - #endif - #if USE_POLL -- if (fd != tty && use_poll) -+ if (is_tty && fd != tty && use_poll) - { - int ret = check_poll(fd, tty); - if (ret != 0) diff --git a/less.spec b/less.spec index 7e39c87..561ef67 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less -Version: 661 -Release: 2%{?dist} +Version: 668 +Release: 1%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -14,9 +14,6 @@ Patch8: less-458-lessecho-usage.patch Patch9: less-458-less-filters-man.patch Patch10: less-458-lesskey-usage.patch Patch11: less-458-old-bot-in-help.patch -# from upstream, for <=661, fixes regression in file-types sanity chack post v590 -# https://github.com/gwsw/less/commit/ed454a217da417dc052723ea70da8efde0f2e66c -Patch12: less-661-pipefix.patch Patch13: less-436-help.patch URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel @@ -42,7 +39,6 @@ files, and you'll use it frequently. %patch -P 9 -p1 -b .less-filters-man %patch -P 10 -p1 -b .lesskey-usage %patch -P 11 -p1 -b .old-bot -%patch -P 12 -p1 -b .pipefix %patch -P 13 -p1 -b .help @@ -67,6 +63,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Fri Oct 18 2024 Michal Hlavinka - 668-1 +- updated to 668 (#2319532) + * Mon Aug 12 2024 Michal Hlavinka - 661-2 - fix post-v590 regression causing reading only part of pipe when stdin is null (upstream#558) diff --git a/sources b/sources index b958d5f..55219e6 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (less-661.tar.gz) = 49d81ff9e79d43ce0271490e3bffd590b4aed5fcb387bc8eb3128de99e5b5a5ede2e2818b546f6e3a140fa6261f1de3dfba1231f7ff7ef18502bb7030eaea1b5 +SHA512 (less-668.tar.gz) = 6527741a609849ec27b6ab35de46f2c5c2b2771391e3efe263207bee28915946f44331a42f832a7cb42231a19b135cbadc15ae02cd997b83a13cdfbc7213fc27 From a40e1355e533cc4e56f5be4218e8b98aec8ca31c Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 17 Jan 2025 10:21:57 +0000 Subject: [PATCH 13/21] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- less.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/less.spec b/less.spec index 561ef67..e337f1b 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 668 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -63,6 +63,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Fri Jan 17 2025 Fedora Release Engineering - 668-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Fri Oct 18 2024 Michal Hlavinka - 668-1 - updated to 668 (#2319532) From cb1e3aa69899156be7220d76c1833faed673561e Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Thu, 22 May 2025 18:15:58 +0200 Subject: [PATCH 14/21] updated to 678 (#2367012) --- .gitignore | 1 + less-475-fsync.patch | 22 +++++++--------------- less.spec | 9 ++++++--- sources | 2 +- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 6fe5e3c..7f41a6a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ /less-643.tar.gz /less-661.tar.gz /less-668.tar.gz +/less-678.tar.gz diff --git a/less-475-fsync.patch b/less-475-fsync.patch index c964b31..7f7a189 100644 --- a/less-475-fsync.patch +++ b/less-475-fsync.patch @@ -1,15 +1,7 @@ -From 5396b6b77d0248678f716038dc747d6898acb0b3 Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Fri, 22 Jan 2021 09:49:13 -0500 -Subject: [PATCH] Test for fsync on tty - -Signed-off-by: Stephen Gallagher - -Modified for less 581.2 Filip Januš -diff -ur less-581.2/configure.ac less_fsync/configure.ac ---- less-581.2/configure.ac 2021-04-28 17:00:08.000000000 +0200 -+++ less_fsync/configure.ac 2021-05-06 10:59:07.560062397 +0200 -@@ -221,6 +221,8 @@ +diff -up less-678-build/less-678/configure.ac.fsync less-678-build/less-678/configure.ac +--- less-678-build/less-678/configure.ac.fsync 2025-05-01 22:42:03.000000000 +0200 ++++ less-678-build/less-678/configure.ac 2025-05-22 18:10:23.572796329 +0200 +@@ -210,6 +210,8 @@ AH_TEMPLATE([HAVE_TIME_T], [Define HAVE_TIME_T if your system supports the "time_t" type.]) AH_TEMPLATE([HAVE_STRERROR], [Define HAVE_STRERROR if you have the strerror() function.]) @@ -18,16 +10,16 @@ diff -ur less-581.2/configure.ac less_fsync/configure.ac AH_TEMPLATE([HAVE_FILENO], [Define HAVE_FILENO if you have the fileno() macro.]) AH_TEMPLATE([HAVE_ERRNO], -@@ -274,7 +276,7 @@ +@@ -259,7 +261,7 @@ AC_MSG_CHECKING(for ANSI function protot AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int f(int a) { return a; }]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_ANSI_PROTOS)],[AC_MSG_RESULT(no)]) # Checks for library functions. -AC_CHECK_FUNCS([fchmod fsync nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat strsignal system ttyname usleep]) +AC_CHECK_FUNCS([fchmod nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat strsignal system ttyname usleep]) + AC_CHECK_DECL(sigsetjmp, [AC_DEFINE(HAVE_SIGSETJMP)], [], [#include ]) # AC_CHECK_FUNCS may not work for inline functions, so test these separately. - AC_MSG_CHECKING(for memcpy) -@@ -321,6 +323,16 @@ +@@ -302,6 +304,16 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include #endif]], [[static char *x; x = strerror(0);]])],[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)],[AC_MSG_RESULT(no)]) diff --git a/less.spec b/less.spec index e337f1b..6fe66f3 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less -Version: 668 -Release: 2%{?dist} +Version: 678 +Release: 1%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -33,7 +33,7 @@ files, and you'll use it frequently. %prep %setup -q %patch -P 4 -p1 -b .time -%patch -P 5 -p1 -b .fsync +%patch -P 5 -p2 -b .fsync %patch -P 6 -p1 -b .manpage-add-old-bot-option %patch -P 8 -p1 -b .lessecho-usage %patch -P 9 -p1 -b .less-filters-man @@ -63,6 +63,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Thu May 22 2025 Michal Hlavinka - 678-1 +- updated to 678 (#2367012) + * Fri Jan 17 2025 Fedora Release Engineering - 668-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/sources b/sources index 55219e6..67d953c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (less-668.tar.gz) = 6527741a609849ec27b6ab35de46f2c5c2b2771391e3efe263207bee28915946f44331a42f832a7cb42231a19b135cbadc15ae02cd997b83a13cdfbc7213fc27 +SHA512 (less-678.tar.gz) = ad1983229bfb5a30c6139db60012d3a12b613011f044acb4c0ec5c0fc809b8dc9be40255bf420f65d51425152c4cfc943076ccd2ee63b196165d6ab1426ea187 From e17c98717a328cc34e77da0065b9da7b7a14a8c1 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Mon, 23 Jun 2025 23:54:38 +0200 Subject: [PATCH 15/21] updated to 679 --- .gitignore | 1 + less.spec | 5 ++++- sources | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7f41a6a..0a5a605 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /less-661.tar.gz /less-668.tar.gz /less-678.tar.gz +/less-679.tar.gz diff --git a/less.spec b/less.spec index 6fe66f3..1d24c43 100644 --- a/less.spec +++ b/less.spec @@ -1,6 +1,6 @@ Summary: A text file browser similar to more, but better Name: less -Version: 678 +Version: 679 Release: 1%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz @@ -63,6 +63,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Mon Jun 23 2025 Michal Hlavinka - 679-1 +- updated to 679 + * Thu May 22 2025 Michal Hlavinka - 678-1 - updated to 678 (#2367012) diff --git a/sources b/sources index 67d953c..a8e25fa 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (less-678.tar.gz) = ad1983229bfb5a30c6139db60012d3a12b613011f044acb4c0ec5c0fc809b8dc9be40255bf420f65d51425152c4cfc943076ccd2ee63b196165d6ab1426ea187 +SHA512 (less-679.tar.gz) = f04e37dc4b2839b416a195e107d21328800e75080054788002c109b3b113a6a898b953391912e7538fb9843ef530b1991efc76dbf6fb5960e5530f3ff83421f6 From bc38a316fce82d8798d83c6b2d54de9a34aae176 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 24 Jul 2025 19:14:12 +0000 Subject: [PATCH 16/21] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- less.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/less.spec b/less.spec index 1d24c43..82c9fc8 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less Version: 679 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -63,6 +63,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 679-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Mon Jun 23 2025 Michal Hlavinka - 679-1 - updated to 679 From ce4a4f56bc68737ba9d954ca027a835bc3cfed96 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Tue, 2 Sep 2025 11:30:08 +0200 Subject: [PATCH 17/21] add man page for lesspipe.sh (rhbz#2376159) --- less.spec | 7 +++++- lesspipe.sh.1 | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 lesspipe.sh.1 diff --git a/less.spec b/less.spec index 82c9fc8..9e50a68 100644 --- a/less.spec +++ b/less.spec @@ -1,12 +1,13 @@ Summary: A text file browser similar to more, but better Name: less Version: 679 -Release: 2%{?dist} +Release: 4%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh Source2: less.sh Source3: less.csh +Source4: lesspipe.sh.1 Patch4: less-394-time.patch Patch5: less-475-fsync.patch Patch6: less-436-manpage-add-old-bot-option.patch @@ -54,6 +55,7 @@ mkdir -p $RPM_BUILD_ROOT/etc/profile.d install -p %{SOURCE1} $RPM_BUILD_ROOT%{_bindir} install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d +install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mandir}/man1/lesspipe.sh.1 %files %doc README NEWS INSTALL @@ -63,6 +65,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d %{_mandir}/man1/* %changelog +* Tue Sep 02 2025 Michal Hlavinka - 679-4 +- add man page for lesspipe.sh (rhbz#2376159) + * Thu Jul 24 2025 Fedora Release Engineering - 679-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/lesspipe.sh.1 b/lesspipe.sh.1 new file mode 100644 index 0000000..b79e329 --- /dev/null +++ b/lesspipe.sh.1 @@ -0,0 +1,60 @@ +.TH LESSPIPE.SH "1" "August 2025" "lesspipe.sh" "User Commands" +.SH NAME +lesspipe.sh \- a preprocessor for less +.SH SYNOPSIS +.B lesspipe.sh +[\fIFILE\fR] +.SH DESCRIPTION +.PP +The purpose of \fBlesspipe.sh\fP is to enhance the output of \fBless\fP. +.PP +With this preprocessor filter \fBless\fP +will be able to display contents of compressed files. For files +containing archives and directories, a table of contents will be displayed. +These filters can be applied recursively. +.SH FILTER ACTIVATION +For \fBlesspipe.sh\fP to be used by \fBless\fP the environment variable +\fBLESSOPEN\fP must be set properly. For bash like shells the command is: + +.EX +.I LESSOPEN="||lesspipe.sh %s"; export LESSOPEN +.EE + +Use absolute path, if \fBlesspipe.sh\fP is not in the search path. +.PP +Having set the environment variable as described above, \fBless\fP +will then display textual information for a wide range of file formats. +.SH USER DEFINED FILTERING +The \fBlesspipe.sh\fP preprocessing can be replaced or enhanced by a user defined +filter specified in \fB~/.lessfilter\fP This file should have an execute bit +set and accept only one parameter, which represents a filename. If the +user defined filter processes the file, zero should be returned. Otherwise +\fBlesspipe.sh\fP will try to handle the file. +.PP +This can be used not only to add filtering for new formats, but also to block +filtering for certain files types or files. An example ~/.lessfilter + +.RS +.EX +#!/usr/bin/sh + +if [[ "$1" = *.raw ]]; then + # do not process 'raw' files + cat "$1" + exit 0 +elif [[ "$1" = *.txt ]]; then + if [ $(wc -l <"$1") = 1 ]; then + # decorate oneliners with cowsay + cowsay <"$1" + exit 0; + fi +fi +# default, not handled by .lessfilter +exit 1 +.EE +.RE +.SH AUTHOR +Michal Hlavinka +.SH "SEE ALSO" +less(1) + From af51b9c7dd46e13b62400626d4a9e4682aef9bf0 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 22 Oct 2025 11:09:28 +0200 Subject: [PATCH 18/21] updated to 685 (#2404089) --- .gitignore | 1 + less-458-less-filters-man.patch | 2 +- less.spec | 7 +++++-- sources | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0a5a605..911cf13 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ /less-668.tar.gz /less-678.tar.gz /less-679.tar.gz +/less-685.tar.gz diff --git a/less-458-less-filters-man.patch b/less-458-less-filters-man.patch index 7de4415..90e7207 100644 --- a/less-458-less-filters-man.patch +++ b/less-458-less-filters-man.patch @@ -20,5 +20,5 @@ diff -up less-466/less.nro.filters-man less-466/less.nro +~/.lessfilter tries to handle the file. + .SH "NATIONAL CHARACTER SETS" - There are three types of characters in the input file: + There are five types of characters in the input file: .IP "normal characters" diff --git a/less.spec b/less.spec index 9e50a68..84d8ba6 100644 --- a/less.spec +++ b/less.spec @@ -1,7 +1,7 @@ Summary: A text file browser similar to more, but better Name: less -Version: 679 -Release: 4%{?dist} +Version: 685 +Release: 1%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz Source1: lesspipe.sh @@ -65,6 +65,9 @@ install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mandir}/man1/lesspipe.sh.1 %{_mandir}/man1/* %changelog +* Wed Oct 22 2025 Michal Hlavinka - 685-1 +- updated to 685 (#2404089) + * Tue Sep 02 2025 Michal Hlavinka - 679-4 - add man page for lesspipe.sh (rhbz#2376159) diff --git a/sources b/sources index a8e25fa..fd21d4b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (less-679.tar.gz) = f04e37dc4b2839b416a195e107d21328800e75080054788002c109b3b113a6a898b953391912e7538fb9843ef530b1991efc76dbf6fb5960e5530f3ff83421f6 +SHA512 (less-685.tar.gz) = aff745f1816e0f996fbdbc33ecae0726cf0d842efc227937ff8c32e734c8b5be4c611ffbb27e5e038b4d95280c95ca60c53af1a47cf419cb06e5fab543c231f3 From 7063e7b7725595fb7269d8d477ac246ac4d0453b Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 12 Nov 2025 12:10:33 +0100 Subject: [PATCH 19/21] use more feature rich lesspipe filter (#2308285) --- .gitignore | 1 + less.spec | 36 +++++++++++++++++++++++++++++++----- sources | 1 + 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 911cf13..f6cddbb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /less-678.tar.gz /less-679.tar.gz /less-685.tar.gz +/lesspipe-2.20.tar.gz diff --git a/less.spec b/less.spec index 84d8ba6..9f92f35 100644 --- a/less.spec +++ b/less.spec @@ -1,10 +1,11 @@ Summary: A text file browser similar to more, but better Name: less Version: 685 -Release: 1%{?dist} +Release: 4%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz -Source1: lesspipe.sh +%global lesspipe_version 2.20 +Source1: https://github.com/wofr06/lesspipe/archive/refs/tags/v%{lesspipe_version}.tar.gz#/lesspipe-%{lesspipe_version}.tar.gz Source2: less.sh Source3: less.csh Source4: lesspipe.sh.1 @@ -20,6 +21,12 @@ URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool BuildRequires: make +# for lesspipe make test +BuildRequires: perl-Archive-Tar +# for lesspipe +Recommends: unzip +Recommends: html2text +Recommends: 7zip %description The less utility is a text file browser that resembles more, but has @@ -32,7 +39,7 @@ You should install less because it is a basic utility for viewing text files, and you'll use it frequently. %prep -%setup -q +%setup -q -a 1 %patch -P 4 -p1 -b .time %patch -P 5 -p2 -b .fsync %patch -P 6 -p1 -b .manpage-add-old-bot-option @@ -49,13 +56,29 @@ autoreconf -fiv %configure %make_build CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" +pushd lesspipe-%{lesspipe_version} +#fix shebangs +sed -i "s|^#!/usr/bin/env bash|^#!/usr/bin/bash|" lesspipe.sh + +./configure --prefix=%{_prefix} +%make_build +popd + %install %make_install mkdir -p $RPM_BUILD_ROOT/etc/profile.d -install -p %{SOURCE1} $RPM_BUILD_ROOT%{_bindir} install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d -install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mandir}/man1/lesspipe.sh.1 + +pushd lesspipe-%{lesspipe_version} +%make_install +rm -f $RPM_BUILD_ROOT/usr/share/bash-completion/less_completion +popd + +%check +pushd lesspipe-%{lesspipe_version} +make test ||: +popd %files %doc README NEWS INSTALL @@ -65,6 +88,9 @@ install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mandir}/man1/lesspipe.sh.1 %{_mandir}/man1/* %changelog +* Wed Nov 12 2025 Michal Hlavinka - 685-4 +- use more feature rich lesspipe filter (#2308285) + * Wed Oct 22 2025 Michal Hlavinka - 685-1 - updated to 685 (#2404089) diff --git a/sources b/sources index fd21d4b..703a9df 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (less-685.tar.gz) = aff745f1816e0f996fbdbc33ecae0726cf0d842efc227937ff8c32e734c8b5be4c611ffbb27e5e038b4d95280c95ca60c53af1a47cf419cb06e5fab543c231f3 +SHA512 (lesspipe-2.20.tar.gz) = bfeba1b921959e8cde8ce8bcc75765598cefd2cc705aa5b6417592fdbdb0c43bd3efb0d4379a0514f0da86806988ee95219539974c7af3319595d9b03aac550e From d54f2ef570e0a50af22448705bd006e5d762b015 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 14 Nov 2025 08:21:06 -0800 Subject: [PATCH 20/21] Revert "use more feature rich lesspipe filter (#2308285)" This reverts commit 7063e7b7725595fb7269d8d477ac246ac4d0453b. It causes less to have a hard dependency on perl, which is not at all desirable and breaks all atomic desktop builds. See: https://bugzilla.redhat.com/show_bug.cgi?id=2308285#c3 --- .gitignore | 1 - less.spec | 36 ++++++++---------------------------- sources | 1 - 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index f6cddbb..911cf13 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,3 @@ /less-678.tar.gz /less-679.tar.gz /less-685.tar.gz -/lesspipe-2.20.tar.gz diff --git a/less.spec b/less.spec index 9f92f35..20e127b 100644 --- a/less.spec +++ b/less.spec @@ -1,11 +1,10 @@ Summary: A text file browser similar to more, but better Name: less Version: 685 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz -%global lesspipe_version 2.20 -Source1: https://github.com/wofr06/lesspipe/archive/refs/tags/v%{lesspipe_version}.tar.gz#/lesspipe-%{lesspipe_version}.tar.gz +Source1: lesspipe.sh Source2: less.sh Source3: less.csh Source4: lesspipe.sh.1 @@ -21,12 +20,6 @@ URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool BuildRequires: make -# for lesspipe make test -BuildRequires: perl-Archive-Tar -# for lesspipe -Recommends: unzip -Recommends: html2text -Recommends: 7zip %description The less utility is a text file browser that resembles more, but has @@ -39,7 +32,7 @@ You should install less because it is a basic utility for viewing text files, and you'll use it frequently. %prep -%setup -q -a 1 +%setup -q %patch -P 4 -p1 -b .time %patch -P 5 -p2 -b .fsync %patch -P 6 -p1 -b .manpage-add-old-bot-option @@ -56,29 +49,13 @@ autoreconf -fiv %configure %make_build CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" -pushd lesspipe-%{lesspipe_version} -#fix shebangs -sed -i "s|^#!/usr/bin/env bash|^#!/usr/bin/bash|" lesspipe.sh - -./configure --prefix=%{_prefix} -%make_build -popd - %install %make_install mkdir -p $RPM_BUILD_ROOT/etc/profile.d +install -p %{SOURCE1} $RPM_BUILD_ROOT%{_bindir} install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d - -pushd lesspipe-%{lesspipe_version} -%make_install -rm -f $RPM_BUILD_ROOT/usr/share/bash-completion/less_completion -popd - -%check -pushd lesspipe-%{lesspipe_version} -make test ||: -popd +install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mandir}/man1/lesspipe.sh.1 %files %doc README NEWS INSTALL @@ -88,6 +65,9 @@ popd %{_mandir}/man1/* %changelog +* Fri Nov 14 2025 Adam Williamson - 685-5 +- Revert new lesspipe filter due to hard perl dependency + * Wed Nov 12 2025 Michal Hlavinka - 685-4 - use more feature rich lesspipe filter (#2308285) diff --git a/sources b/sources index 703a9df..fd21d4b 100644 --- a/sources +++ b/sources @@ -1,2 +1 @@ SHA512 (less-685.tar.gz) = aff745f1816e0f996fbdbc33ecae0726cf0d842efc227937ff8c32e734c8b5be4c611ffbb27e5e038b4d95280c95ca60c53af1a47cf419cb06e5fab543c231f3 -SHA512 (lesspipe-2.20.tar.gz) = bfeba1b921959e8cde8ce8bcc75765598cefd2cc705aa5b6417592fdbdb0c43bd3efb0d4379a0514f0da86806988ee95219539974c7af3319595d9b03aac550e From e113e6d59a455fef631b97baec4d0a9d6745e273 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Mon, 24 Nov 2025 21:41:52 +0100 Subject: [PATCH 21/21] reintroduce use more feature rich lesspipe filter, but separate perl dependent colorizer into subpackage, credits Yaakov Selkowitz --- .gitignore | 1 + less.spec | 62 +++++++++++++++++++++--- lesspipe.sh | 132 -------------------------------------------------- lesspipe.sh.1 | 60 ----------------------- sources | 1 + 5 files changed, 57 insertions(+), 199 deletions(-) delete mode 100755 lesspipe.sh delete mode 100644 lesspipe.sh.1 diff --git a/.gitignore b/.gitignore index 911cf13..f6cddbb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /less-678.tar.gz /less-679.tar.gz /less-685.tar.gz +/lesspipe-2.20.tar.gz diff --git a/less.spec b/less.spec index 20e127b..51d2494 100644 --- a/less.spec +++ b/less.spec @@ -1,13 +1,13 @@ Summary: A text file browser similar to more, but better Name: less Version: 685 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL-3.0-only and BSD-2-Clause Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz -Source1: lesspipe.sh +%global lesspipe_version 2.20 +Source1: https://github.com/wofr06/lesspipe/archive/refs/tags/v%{lesspipe_version}.tar.gz#/lesspipe-%{lesspipe_version}.tar.gz Source2: less.sh Source3: less.csh -Source4: lesspipe.sh.1 Patch4: less-394-time.patch Patch5: less-475-fsync.patch Patch6: less-436-manpage-add-old-bot-option.patch @@ -20,6 +20,13 @@ URL: https://www.greenwoodsoftware.com/less/ BuildRequires: ncurses-devel BuildRequires: autoconf automake libtool BuildRequires: make +# for lesspipe make test +BuildRequires: perl-Archive-Tar +# for lesspipe +Recommends: (less-color = %{version}-%{release} if perl-interpreter) +Recommends: unzip +Recommends: html2text +Recommends: 7zip %description The less utility is a text file browser that resembles more, but has @@ -31,8 +38,17 @@ example, vi). You should install less because it is a basic utility for viewing text files, and you'll use it frequently. +%package color +Summary: Colorizers for less +Requires: %{name} = %{version}-%{release} +Conflicts: less < 685-5 + +%description color +Syntax highlighting modes for the less pager. + + %prep -%setup -q +%setup -q -a 1 %patch -P 4 -p1 -b .time %patch -P 5 -p2 -b .fsync %patch -P 6 -p1 -b .manpage-add-old-bot-option @@ -49,22 +65,54 @@ autoreconf -fiv %configure %make_build CFLAGS="%{optflags} -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" +pushd lesspipe-%{lesspipe_version} +#fix shebangs +sed -i "s|^#!/usr/bin/env bash|^#!/usr/bin/bash|" lesspipe.sh + +./configure --prefix=%{_prefix} +%make_build +popd + %install %make_install mkdir -p $RPM_BUILD_ROOT/etc/profile.d -install -p %{SOURCE1} $RPM_BUILD_ROOT%{_bindir} install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/profile.d install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d -install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_mandir}/man1/lesspipe.sh.1 + +pushd lesspipe-%{lesspipe_version} +%make_install +rm -f $RPM_BUILD_ROOT/usr/share/bash-completion/less_completion +popd + +%check +pushd lesspipe-%{lesspipe_version} +# we dont have all required components to pass full test, but it is still +# useful to run for debug purposes +make test ||: +popd %files %doc README NEWS INSTALL %license LICENSE COPYING /etc/profile.d/* -%{_bindir}/* +%{_bindir}/less +%{_bindir}/lesscomplete +%{_bindir}/lessecho +%{_bindir}/lesskey +%{_bindir}/lesspipe.sh %{_mandir}/man1/* +%files color +%{_bindir}/archive_color +%{_bindir}/code2color +%{_bindir}/sxw2txt +%{_bindir}/vimcolor + %changelog +* Mon Nov 24 2025 Michal Hlavinka - 685-6 +- reintroduce use more feature rich lesspipe filter, but separate + perl dependent colorizer into subpackage, credits Yaakov Selkowitz + * Fri Nov 14 2025 Adam Williamson - 685-5 - Revert new lesspipe filter due to hard perl dependency diff --git a/lesspipe.sh b/lesspipe.sh deleted file mode 100755 index 71b75c7..0000000 --- a/lesspipe.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/sh -# -# To use this filter with less, define LESSOPEN: -# export LESSOPEN="|/usr/bin/lesspipe.sh %s" -# -# The script should return zero if the output was valid and non-zero -# otherwise, so less could detect even a valid empty output -# (for example while uncompressing gzipped empty file). -# For backward-compatibility, this is not required by default. To turn -# this functionality there should be another vertical bar (|) straight -# after the first one in the LESSOPEN environment variable: -# export LESSOPEN="||/usr/bin/lesspipe.sh %s" - -if [ ! -e "$1" ] ; then - exit 1 -fi - -if [ -d "$1" ] ; then - ls -alF -- "$1" - exit $? -fi - -exec 2>/dev/null - -# Allow for user defined filters -if [ -x ~/.lessfilter ]; then - ~/.lessfilter "$1" - if [ $? -eq 0 ]; then - exit 0 - fi -fi - -manfilter () -{ - if test -x /usr/bin/man ; then - # See rhbz#1241543 for more info. Well, actually we firstly - # used 'man -l', then we switched to groff, and then we again - # switched back to 'man -l'. - /usr/bin/man -P /usr/bin/cat -l "$1" - elif test -x /usr/bin/groff; then - # This is from pre-rhbz#1241543-time. - groff -Tascii -mandoc "$1" | cat -s - else - echo "WARNING:" - echo "WARNING: to better show manual pages, install 'man-db' package" - echo "WARNING:" - cat "$1" - fi -} - -export MAN_KEEP_FORMATTING=1 - -case "$1" in -*.[1-9n].bz2|*.[1-9]x.bz2|*.man.bz2|*.[1-9n].[glx]z|*.[1-9]x.[glx]z|*.man.[glx]z|*.[1-9n].lzma|*.[1-9]x.lzma|*.man.lzma|*.[1-9n].zst|*.[1-9]x.zst|*.man.zst|*.[1-9n].br|*.[1-9]x.br|*.man.br) - case "$1" in - *.gz) DECOMPRESSOR="gzip -dc" ;; - *.bz2) DECOMPRESSOR="bzip2 -dc" ;; - *.lz) DECOMPRESSOR="lzip -dc" ;; - *.zst) DECOMPRESSOR="zstd -dcq" ;; - *.br) DECOMPRESSOR="brotli -dc" ;; - *.xz|*.lzma) DECOMPRESSOR="xz -dc" ;; - esac - if [ -n "$DECOMPRESSOR" ] && $DECOMPRESSOR -- "$1" | file - | grep -q troff; then - $DECOMPRESSOR -- "$1" | manfilter - - exit $? - fi -esac -case "$1" in -*.[1-9n]|*.[1-9]x|*.man) - if file "$1" | grep -q troff; then - manfilter "$1" - exit $? - fi -esac -case "$1" in -*.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.lz) tar --lzip -tvvf "$1"; exit $? ;; -*.lz) lzip -dc -- "$1"; exit $? ;; -*.tar.zst) tar --zstd -tvvf "$1"; exit $? ;; -*.zst) zstd -dcq -- "$1"; exit $? ;; -*.tar.br) brotli -dc -- "$1" | tar tvvf -; exit $? ;; -*.br) brotli -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 $? ;; -# --nomanifest -> rhbz#1450277 -*.rpm) rpm -qpivl --changelog --nomanifest -- "$1"; exit $? ;; -*.cpi|*.cpio) cpio -itv < "$1"; exit $? ;; -*.gpg) - if [ -x /usr/bin/gpg2 ]; then - gpg2 -d "$1" - exit $? - elif [ -x /usr/bin/gpg ]; then - gpg -d "$1" - exit $? - else - echo "No GnuPG available." - echo "Install gnupg2 or gnupg to show encrypted files." - exit 1 - fi ;; -*.gif|*.jpeg|*.jpg|*.pcd|*.png|*.tga|*.tiff|*.tif) - if [ -x /usr/bin/identify ]; then - identify "$1" - exit $? - elif [ -x /usr/bin/gm ]; then - gm identify "$1" - exit $? - else - echo "No identify available" - echo "Install ImageMagick or GraphicsMagick to browse images" - exit 1 - fi ;; -*) - if [ -x /usr/bin/file ] && [ -x /usr/bin/iconv ] && [ -x /usr/bin/cut ]; then - case `file -b "$1"` in - *UTF-16*) conv='UTF-16' ;; - *UTF-32*) conv='UTF-32' ;; - esac - if [ -n "$conv" ]; then - env=`echo $LANG | cut -d. -f2` - if [ -n "$env" -a "$conv" != "$env" ]; then - iconv -f $conv -t $env "$1" - exit $? - fi - fi - fi - exit 1 -esac diff --git a/lesspipe.sh.1 b/lesspipe.sh.1 deleted file mode 100644 index b79e329..0000000 --- a/lesspipe.sh.1 +++ /dev/null @@ -1,60 +0,0 @@ -.TH LESSPIPE.SH "1" "August 2025" "lesspipe.sh" "User Commands" -.SH NAME -lesspipe.sh \- a preprocessor for less -.SH SYNOPSIS -.B lesspipe.sh -[\fIFILE\fR] -.SH DESCRIPTION -.PP -The purpose of \fBlesspipe.sh\fP is to enhance the output of \fBless\fP. -.PP -With this preprocessor filter \fBless\fP -will be able to display contents of compressed files. For files -containing archives and directories, a table of contents will be displayed. -These filters can be applied recursively. -.SH FILTER ACTIVATION -For \fBlesspipe.sh\fP to be used by \fBless\fP the environment variable -\fBLESSOPEN\fP must be set properly. For bash like shells the command is: - -.EX -.I LESSOPEN="||lesspipe.sh %s"; export LESSOPEN -.EE - -Use absolute path, if \fBlesspipe.sh\fP is not in the search path. -.PP -Having set the environment variable as described above, \fBless\fP -will then display textual information for a wide range of file formats. -.SH USER DEFINED FILTERING -The \fBlesspipe.sh\fP preprocessing can be replaced or enhanced by a user defined -filter specified in \fB~/.lessfilter\fP This file should have an execute bit -set and accept only one parameter, which represents a filename. If the -user defined filter processes the file, zero should be returned. Otherwise -\fBlesspipe.sh\fP will try to handle the file. -.PP -This can be used not only to add filtering for new formats, but also to block -filtering for certain files types or files. An example ~/.lessfilter - -.RS -.EX -#!/usr/bin/sh - -if [[ "$1" = *.raw ]]; then - # do not process 'raw' files - cat "$1" - exit 0 -elif [[ "$1" = *.txt ]]; then - if [ $(wc -l <"$1") = 1 ]; then - # decorate oneliners with cowsay - cowsay <"$1" - exit 0; - fi -fi -# default, not handled by .lessfilter -exit 1 -.EE -.RE -.SH AUTHOR -Michal Hlavinka -.SH "SEE ALSO" -less(1) - diff --git a/sources b/sources index fd21d4b..703a9df 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ SHA512 (less-685.tar.gz) = aff745f1816e0f996fbdbc33ecae0726cf0d842efc227937ff8c32e734c8b5be4c611ffbb27e5e038b4d95280c95ca60c53af1a47cf419cb06e5fab543c231f3 +SHA512 (lesspipe-2.20.tar.gz) = bfeba1b921959e8cde8ce8bcc75765598cefd2cc705aa5b6417592fdbdb0c43bd3efb0d4379a0514f0da86806988ee95219539974c7af3319595d9b03aac550e