Bug 248754

Summary: sysutils/less: charset.c patch appears to break -R
Product: Ports & Packages Reporter: Dennis Boone <jm-fbbz>
Component: Individual Port(s)Assignee: Dmitry Marakasov <amdmi3>
Status: Closed FIXED    
Severity: Affects Some People CC: delphij, jharris, lwhsu
Priority: --- Flags: jharris: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
output.txt
none
dashr.txt none

Description Dennis Boone 2020-08-19 15:53:17 UTC
Created attachment 217340 [details]
output.txt

With the envariable LESS set to:

LESS=-e -i -j4 -m -q -R -x4 -P"file %f (%i of %m) line %lb of %L [%pb\%]--"

and the output shown in , less shows
dashr.txt instead of the expected colorized output.

Replacing -R with -r results in the expected colorization, and the expected long-line induced counting and screen layout issues.

There are no LESSANSI* variables set.

less 551, FreeBSD 12.1.
Comment 1 Dennis Boone 2020-08-19 15:54:51 UTC
Created attachment 217341 [details]
dashr.txt
Comment 2 Dennis Boone 2020-08-19 15:55:30 UTC
Let's try this again.

With the envariable LESS set to:

LESS=-e -i -j4 -m -q -R -x4 -P"file %f (%i of %m) line %lb of %L [%pb\%]--"

and the output shown in output.txt, less shows
dashr.txt instead of the expected colorized output.

Replacing -R with -r results in the expected colorization, and the expected long-line induced counting and screen layout issues.

There are no LESSANSI* variables set.

less 551, FreeBSD 12.1.
Comment 3 Li-Wen Hsu freebsd_committer 2020-08-19 16:44:46 UTC
Is it regarding to the less(1) in the base (/usr/bin/less) or the less in the ports (sysutils/less) ?
Comment 4 Dennis Boone 2020-08-19 17:18:12 UTC
In ports.  I _think_ the older version in base works correctly.  I've forgotten why I needed the newer version now.
Comment 5 Li-Wen Hsu freebsd_committer 2020-08-19 17:23:29 UTC
Also CC delphij@, base less is 551 on 13.0-CURRENT.
Comment 6 jharris 2020-08-23 22:57:30 UTC
That patch is so old, but I don’t have many terminals to test its removal with...  You’re welcome to try removing it with a committer’s help.
Comment 7 Dmitry Marakasov freebsd_committer 2021-03-17 19:24:46 UTC
I can confirm.

ps --libxo json | jq -C | /usr/local/bin/less -R

ESC[1;39m{
  ESC[0mESC[34;1m"process-information"ESC[0mESC[1;39m: ESC[0mESC[1;39m{
    ESC[0mESC[34;1m"process"ESC[0mESC[1;39m: ESC[0mESC[1;39m[
      ESC[1;39m{
        ESC[0mESC[34;1m"pid"ESC[0mESC[1;39m: ESC[0mESC[0;32m"24867"ESC[0mESC[1;39m,
        ESC[0mESC[34;1m"terminal-name"ESC[0mESC[1;39m: ESC[0mESC[0;32m"2 "ESC[0mESC[1;39m,
        ESC[0mESC[34;1m"state"ESC[0mESC[1;39m: ESC[0mESC[0;32m"Is+"ESC[0mESC[1;39m,
        ESC[0mESC[34;1m"cpu-time"ESC[0mESC[1;39m: ESC[0mESC[0;32m"0:03.15"ESC[0mESC[1;39m,
        ESC[0mESC[34;1m"command"ESC[0mESC[1;39m: ESC[0mESC[0;32m"zsh"ESC[0mESC[1;39m
      ESC[1;39m}ESC[0mESC[1;39m,

After patch removed (correctly colored output):

{
  "process-information": {
    "process": [
      {
        "pid": "24867",
        "terminal-name": "2 ",
        "state": "Is+",
        "cpu-time": "0:03.15",
        "command": "zsh"
      },

Both in system console and in urxvt.

> You’re welcome to try removing it with a committer’s help.

I take it as maintainer is OK with removing it. While here, some minor cleanup to the port.
Comment 8 commit-hook freebsd_committer 2021-03-17 19:39:59 UTC
A commit references this bug:

Author: amdmi3
Date: Wed Mar 17 19:39:37 UTC 2021
New revision: 568686
URL: https://svnweb.freebsd.org/changeset/ports/568686

Log:
  - Remove obsolete patch which breaks colorized output (-R option)
  - While here, fix LICENSE and switch to options helpers

  PR:		248754
  Submitted by:	jm-fbbz@yagi.h-net.org
  Approved by:	jharris@widomaker.com (maintainer)

Changes:
  head/sysutils/less/Makefile
  head/sysutils/less/files/patch-charset.c