import UBI less-590-6.el9

This commit is contained in:
eabdullin 2025-11-11 16:02:38 +00:00
parent c5db194cc1
commit 4b42f1026a
2 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,64 @@
diff -up less-590-build/less-590/line.c.fixhyperlink less-590-build/less-590/line.c
--- less-590-build/less-590/line.c.fixhyperlink 2025-03-20 00:18:52.931007552 +0100
+++ less-590-build/less-590/line.c 2025-03-20 00:22:29.299071888 +0100
@@ -38,6 +38,7 @@ struct xbuffer last_ansi;
public int size_linebuf = 0; /* Size of line buffer (and attr buffer) */
static struct ansi_state *line_ansi = NULL;
+static int hlink_in_line;
static int cshift; /* Current left-shift of output line buffer */
public int hshift; /* Desired left-shift of output line buffer */
public int tabstops[TABSTOP_MAX] = { 0 }; /* Custom tabstops */
@@ -221,6 +222,7 @@ prewind(VOID_PARAM)
is_null_line = 0;
pendc = '\0';
in_hilite = 0;
+ hlink_in_line = 0;
xbuf_reset(&shifted_ansi);
xbuf_reset(&last_ansi);
}
@@ -252,6 +254,19 @@ add_linebuf(ch, attr, w)
}
/*
+ * Append a string to the line buffer.
+ */
+ static void
+addstr_linebuf(s, attr, cw)
+ char *s;
+ int attr;
+ int cw;
+{
+ for ( ; *s != '\0'; s++)
+ add_linebuf(*s, attr, cw);
+}
+
+/*
* Set a character in the line prefix buffer.
*/
static void
@@ -958,6 +973,8 @@ store_ansi(ch, rep, pos)
case ANSI_MID:
if (!in_hilite)
STORE_CHAR(ch, AT_ANSI, rep, pos);
+ if (line_ansi->hlink)
+ hlink_in_line = 1;
break;
case ANSI_END:
if (!in_hilite)
@@ -1138,12 +1155,11 @@ pflushmbc(VOID_PARAM)
static void
add_attr_normal(VOID_PARAM)
{
- char *p = "\033[m";
-
if (ctldisp != OPT_ONPLUS || !is_ansi_end('m'))
return;
- for ( ; *p != '\0'; p++)
- add_linebuf(*p, AT_ANSI, 0);
+ addstr_linebuf("\033[m", AT_ANSI, 0);
+ if (hlink_in_line) /* Don't send hyperlink clear if we know we don't need to. */
+ addstr_linebuf("\033]8;;\033\\", AT_ANSI, 0);
}
/*

View File

@ -1,7 +1,7 @@
Summary: A text file browser similar to more, but better
Name: less
Version: 590
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv3+ or BSD
Source0: https://www.greenwoodsoftware.com/less/%{name}-%{version}.tar.gz
Source1: lesspipe.sh
@ -27,6 +27,10 @@ Patch15: less-590-fix_sast1.patch
# from upstream, for less < 661, based on commit#1649cc355a9eb824837feb4359828f5627e2eb69, RHEL-51178
Patch16: less-590-fix_sast2.patch
#from upstream, https://github.com/gwsw/less/commit/d21820c9d8501b5814d33d4fb8a621c6c563e102, RHEL-31219
Patch17: less-590-fixhyperlink.patch
URL: https://www.greenwoodsoftware.com/less/
BuildRequires: ncurses-devel
BuildRequires: autoconf automake libtool
@ -57,6 +61,7 @@ files, and you'll use it frequently.
%patch -P 14 -p1 -b .CVE-2024-32487
%patch -P 15 -p1 -b .fix_sast1
%patch -P 16 -p1 -b .fix_sast2
%patch -P 17 -p2 -b .fixhyperlink
%build
@ -80,6 +85,9 @@ install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/profile.d
%{_mandir}/man1/*
%changelog
* Wed Jul 02 2025 Michal Hlavinka <mhlavink@redhat.com> - 590-6
- fix hyperlink underline continuing on next line (RHEL-31219)
* Tue Aug 06 2024 Michal Hlavinka <mhlavink@redhat.com> - 590-5
- fix static analysis findings (RHEL-51178)