Bug 196437

Summary: zless doesn't correctly display uncompressed files
Product: Base System Reporter: marquis
Component: binAssignee: Fernando Apesteguía <fernape>
Status: Closed FIXED    
Severity: Affects Many People CC: fernape
Priority: ---    
Version: 9.3-RELEASE   
Hardware: Any   
OS: Any   

Description marquis 2015-01-02 13:47:25 UTC
The current FreeBSD /usr/bin/zless:

 export LESSOPEN="||/usr/bin/lesspipe.sh %s"
 exec /usr/bin/less "$@"

displays a blank page when attempting to read a file that is not compressed.  GNU versions:

 if test "${LESSMETACHARS+set}" != set; then
   # Work around a bug in less 394 and earlier;
   # it mishandles the metacharacters '$%=~'.
   space=' '
   tab=' '
   newline='
 '
   LESSMETACHARS="$space$tab$newline'"';*?"()<>[|&^`#\$%=~'
   export LESSMETACHARS
 fi
 LESSOPEN="|-gzip -cdfq -- %s"; export LESSOPEN
 exec less "$@"

work as expected.
Comment 1 Fernando Apesteguía freebsd_committer freebsd_triage 2023-02-19 17:40:32 UTC
https://reviews.freebsd.org/D38674
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-02-20 11:17:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6ffcf4ac7bbfff95fdf7d6debc22880054abc76

commit e6ffcf4ac7bbfff95fdf7d6debc22880054abc76
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2023-02-19 16:31:11 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2023-02-20 10:15:09 +0000

    zless(1): handle uncompressed files

    In the manual page for zmore(1) and zless(1) it is said that zless(1) is
    equivalent to zmore(1) except that it uses less(1) as a pager. However
    zmore(1) is able to handle uncompressed files transparently while zless(1)
    is not.

    Add another case to the switch in lesspipe.sh to handle non-compressed files.

    PR:             196437
    Reported by:    marquis@roble.com
    Approved by:    mjg@
    Differential Revision: https://reviews.freebsd.org/D38674

 usr.bin/less/lesspipe.sh | 2 ++
 1 file changed, 2 insertions(+)
Comment 3 Fernando Apesteguía freebsd_committer freebsd_triage 2023-02-20 11:17:32 UTC
Committed,

Thanks!